Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: GMM with 93+ regressors produces error


From   Julian Reif <jreif@uchicago.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: GMM with 93+ regressors produces error
Date   Mon, 28 Feb 2011 09:40:43 -0600

I reran my example using the function evaluator program, as Brian suggested, and can confirm it works with large numbers of regressors.  So Stas, it looks like if you just write everything with function evaluator programs then you won't have to worry about this issue.

Julian

On Feb 26, 2011, at 7:04 PM, Brian P. Poi wrote:

> 
> On 2/26/2011 7:11 PM, Stas Kolenikov wrote:
>> Brian,
>> 
>> this is a pretty peculiar case of a deeply hidden limit that does not
>> produce an informative error message. Can you please discuss this
>> situation in the help for -gmm- or in the manual in more detail? Can
>> you show the syntax you used for parsing Julian's expression, so that
>> others can reproduce it in order to judge whether they have problems
>> with the length of an expression? Or did you just pick the long
>> expression from the trace? As I said, I encountered some pretty long
>> -gmm- expressions in my work, and want to find out how stable my code
>> would be for longer lists of regressors or instruments, preferably
>> before sending the syntax to -gmm- only to find it breaking down.
>> 
> 
> Stas,
> 
> I just -set trace on- then grabbed the -replace- statement that actually caused the error message.  Then I just copied that into a do-file, removed the ">"'s that appear in the trace log, and ran it.
> See below.
> 
> My advice would be that if are using -gmm- inside another command or are working on something that can create lengthy substitutable expressions, you're better off writing a function evaluator program instead.
> 
>   -- Brian Poi
>   -- brian@poiholdings.com
> 
> 
> Here's what I ran:
> 
> 
> 
> clear all
> set seed 38
> set obs 93
> gen id =  _n
> expand 10
> gen lhs = uniform() < 0.5
> xi I.id
> 
> * These two commands should produce the same coefficient estimates.
> * -gmm- produces an error here though.
> 
> *logit lhs _I*
> 
> 
> gen __00002X = 3
> mat __000006 = J(1,100,1)
> 
> #delimit ;
> local express lhs - exp(
> 	(__000006[1,1] *_Iid_2 +
> 	 __000006[1,2] *_Iid_3 +
> 	 __000006[1,3] *_Iid_4 +
> 	 __000006[1,4] *_Iid_5 +
> 	 __000006[1,5] *_Iid_6 +
> 	 __000006[1,6] *_Iid_7 +
> 	 __000006[1,7] *_Iid_8 +
> 	 __000006[1,8] *_Iid_9 +
> 	 __000006[1,9] *_Iid_10 +
> 	 __000006[1,10] *_Iid_11 +
> 	 __000006[1,11] *_Iid_12 +
> 	 __000006[1,12] *_Iid_13 +
> 	 __000006[1,13] *_Iid_14 +
> 	 __000006[1,14] *_Iid_15 +
> 	 __000006[1,15] *_Iid_16 +
> 	 __000006[1,16] *_Iid_17 +
> 	 __000006[1,17] *_Iid_18 +
> 	 __000006[1,18] *_Iid_19 +
> 	 __000006[1,19] *_Iid_20 +
> 	 __000006[1,20] *_Iid_21 +
> 	 __000006[1,21] *_Iid_22 +
> 	 __000006[1,22] *_Iid_23 +
> 	 __000006[1,23] *_Iid_24 +
> 	 __000006[1,24] *_Iid_25 +
> 	 __000006[1,25] *_Iid_26 +
> 	 __000006[1,26] *_Iid_27 +
> 	 __000006[1,27] *_Iid_28 +
> 	 __000006[1,28] *_Iid_29 +
> 	 __000006[1,29] *_Iid_30 +
> 	 __000006[1,30] *_Iid_31 +
> 	 __000006[1,31] *_Iid_32 +
> 	 __000006[1,32] *_Iid_33 +
> 	 __000006[1,33] *_Iid_34 +
> 	 __000006[1,34] *_Iid_35 +
> 	 __000006[1,35] *_Iid_36 +
> 	 __000006[1,36] *_Iid_37 +
> 	 __000006[1,37] *_Iid_38 +
> 	 __000006[1,38] *_Iid_39 +
> 	 __000006[1,39] *_Iid_40 +
> 	 __000006[1,40] *_Iid_41 +
> 	 __000006[1,41] *_Iid_42 +
> 	 __000006[1,42] *_Iid_43 +
> 	 __000006[1,43] *_Iid_44 +
> 	 __000006[1,44] *_Iid_45 +
> 	 __000006[1,45] *_Iid_46 +
> 	 __000006[1,46] *_Iid_47 +
> 	 __000006[1,47] *_Iid_48 +
> 	 __000006[1,48] *_Iid_49 +
> 	 __000006[1,49] *_Iid_50 +
> 	 __000006[1,50] *_Iid_51 +
> 	 __000006[1,51] *_Iid_52 +
> 	 __000006[1,52] *_Iid_53 +
> 	 __000006[1,53] *_Iid_54 +
> 	 __000006[1,54] *_Iid_55 +
> 	 __000006[1,55] *_Iid_56 +
> 	 __000006[1,56] *_Iid_57 +
> 	 __000006[1,57] *_Iid_58 +
> 	 __000006[1,58] *_Iid_59 +
> 	 __000006[1,59] *_Iid_60 +
> 	 __000006[1,60] *_Iid_61 +
> 	 __000006[1,61] *_Iid_62 +
> 	 __000006[1,62] *_Iid_63 +
> 	 __000006[1,63] *_Iid_64 +
> 	 __000006[1,64] *_Iid_65 +
> 	 __000006[1,65] *_Iid_66 +
> 	 __000006[1,66] *_Iid_67 +
> 	 __000006[1,67] *_Iid_68 +
> 	 __000006[1,68] *_Iid_69 +
> 	 __000006[1,69] *_Iid_70 +
> 	 __000006[1,70] *_Iid_71 +
> 	 __000006[1,71] *_Iid_72 +
> 	 __000006[1,72] *_Iid_73 +
> 	 __000006[1,73] *_Iid_74 +
> 	 __000006[1,74] *_Iid_75 +
> 	 __000006[1,75] *_Iid_76 +
> 	 __000006[1,76] *_Iid_77 +
> 	 __000006[1,77] *_Iid_78 +
> 	 __000006[1,78] *_Iid_79 +
> 	 __000006[1,79] *_Iid_80 +
> 	 __000006[1,80] *_Iid_81 +
> 	 __000006[1,81] *_Iid_82 +
> 	 __000006[1,82] *_Iid_83 +
> 	 __000006[1,83] *_Iid_84 +
> 	 __000006[1,84] *_Iid_85 +
> 	 __000006[1,85] *_Iid_86 +
> 	 __000006[1,86] *_Iid_87 +
> 	 __000006[1,87] *_Iid_88 +
> 	 __000006[1,88] *_Iid_89 +
>         __000006[1,89] *_Iid_90 +
>         __000006[1,90] *_Iid_91 +
>         __000006[1,91] *_Iid_92 +
>         __000006[1,92] *_Iid_93) +
>         __000006[1,93] )/(1+exp( (
>         __000006[1,1] *_Iid_2 +
> 	__000006[1,2] *_Iid_3 +
> 	__000006[1,3] *_Iid_4 +
> 	__000006[1,4] *_Iid_5 +
> 	__000006[1,5] *_Iid_6 +
> 	__000006[1,6] *_Iid_7 +
> 	__000006[1,7] *_Iid_8 +
> 	__000006[1,8] *_Iid_9 +
> 	__000006[1,9] *_Iid_10 +
> 	__000006[1,10] *_Iid_11 +
> 	__000006[1,11] *_Iid_12 +
> 	__000006[1,12] *_Iid_13 +
> 	__000006[1,13] *_Iid_14 +
> 	__000006[1,14] *_Iid_15 +
> 	__000006[1,15] *_Iid_16 +
> 	__000006[1,16] *_Iid_17 +
> 	__000006[1,17] *_Iid_18 +
> 	__000006[1,18] *_Iid_19 +
> 	__000006[1,19] *_Iid_20 +
> 	__000006[1,20] *_Iid_21 +
> 	__000006[1,21] *_Iid_22 +
> 	__000006[1,22] *_Iid_23 +
> 	__000006[1,23] *_Iid_24 +
> 	__000006[1,24] *_Iid_25 +
> 	__000006[1,25] *_Iid_26 +
> 	__000006[1,26] *_Iid_27 +
> 	__000006[1,27] *_Iid_28 +
> 	__000006[1,28] *_Iid_29 +
> 	__000006[1,29] *_Iid_30 +
> 	__000006[1,30] *_Iid_31 +
> 	__000006[1,31] *_Iid_32 +
> 	__000006[1,32] *_Iid_33 +
> 	__000006[1,33] *_Iid_34 +
> 	__000006[1,34] *_Iid_35 +
> 	__000006[1,35] *_Iid_36 +
> 	__000006[1,36] *_Iid_37 +
> 	__000006[1,37] *_Iid_38 +
> 	__000006[1,38] *_Iid_39 +
> 	__000006[1,39] *_Iid_40 +
> 	__000006[1,40] *_Iid_41 +
> 	__000006[1,41] *_Iid_42 +
> 	__000006[1,42] *_Iid_43 +
> 	__000006[1,43] *_Iid_44 +
> 	__000006[1,44] *_Iid_45 +
> 	__000006[1,45] *_Iid_46 +
> 	__000006[1,46] *_Iid_47 +
> 	__000006[1,47] *_Iid_48 +
> 	__000006[1,48] *_Iid_49 +
> 	__000006[1,49] *_Iid_50 +
> 	__000006[1,50] *_Iid_51 +
> 	__000006[1,51] *_Iid_52 +
> 	__000006[1,52] *_Iid_53 +
> 	__000006[1,53] *_Iid_54 +
> 	__000006[1,54] *_Iid_55 +
> 	__000006[1,55] *_Iid_56 +
> 	__000006[1,56] *_Iid_57 +
> 	__000006[1,57] *_Iid_58 +
> 	__000006[1,58] *_Iid_59 +
> 	__000006[1,59] *_Iid_60 +
> 	__000006[1,60] *_Iid_61 +
> 	__000006[1,61] *_Iid_62 +
> 	__000006[1,62] *_Iid_63 +
> 	__000006[1,63] *_Iid_64 +
> 	__000006[1,64] *_Iid_65 +
> 	__000006[1,65] *_Iid_66 +
> 	__000006[1,66] *_Iid_67 +
> 	__000006[1,67] *_Iid_68 +
> 	__000006[1,68] *_Iid_69 +
> 	__000006[1,69] *_Iid_70 +
> 	__000006[1,70] *_Iid_71 +
> 	__000006[1,71] *_Iid_72 +
> 	__000006[1,72] *_Iid_73 +
> 	__000006[1,73] *_Iid_74 +
> 	__000006[1,74] *_Iid_75 +
> 	__000006[1,75] *_Iid_76 +
> 	__000006[1,76] *_Iid_77 +
> 	__000006[1,77] *_Iid_78 +
> 	__000006[1,78] *_Iid_79 +
> 	__000006[1,79] *_Iid_80 +
> 	__000006[1,80] *_Iid_81 +
> 	__000006[1,81] *_Iid_82 +
> 	__000006[1,82] *_Iid_83 +
> 	__000006[1,83] *_Iid_84 +
> 	__000006[1,84] *_Iid_85 +
> 	__000006[1,85] *_Iid_86 +
> 	__000006[1,86] *_Iid_87 +
> 	__000006[1,87] *_Iid_88 +
> 	__000006[1,88] *_Iid_89 +
> 	__000006[1,89] *_Iid_90 +
> 	__000006[1,90] *_Iid_91 +
> 	__000006[1,91] *_Iid_92 +
> 	__000006[1,92] *_Iid_93) +
> 	__000006[1,93] ))
> ;
> 
> #delimit cr
> 
> local express2 : list retok express
> di "-->`express2'<--"
> 
> gen k = 1
> replace k = `express2'
> 
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index