Statalist


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

Re: st: Moment evaluator programs with K equations


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: Moment evaluator programs with K equations
Date   Wed, 17 Feb 2010 09:50:43 -0500

Christopher Kodongo <[email protected]>:
But what is probably causing the error message comes later:
replace `varlist' = `depvars' - `xb' `if'
has `depvars' evaluating to three "words" (kenemr moremr zaremr),
which makes no sense in Stata syntax, or as a subtraction problem.

On Wed, Feb 17, 2010 at 9:48 AM, Austin Nichols <[email protected]> wrote:
> Christopher Kodongo <[email protected]>:
> Probably several things are fundamentally wrong, but what jumps out at
> me is that the parameter vector cannot be k by i, only 1 by i.
> Did you send your message in HTML or plain text?  Only the latter is allowed.
>
> On Wed, Feb 17, 2010 at 9:43 AM, Christopher Kodongo
> <[email protected]> wrote:
>>
>> Dear statalisters
>>
>> Something appears to be fundamentally wrong with the following program. Trouble is - I can't spot it. Can you?
>>
>> program tryagain2, eclass
>> version 11
>> syntax varlist [if], at(name) depvars(varlist) indvars(varlist)
>> quietly {
>>     tempvar xb
>>     generate double `xb' = 0 `if'
>>     local k = 1
>>     local i = 1
>>     foreach var of varlist `depvars' {
>>         foreach var of varlist `indvars' {
>>             replace `xb' = `xb' + `at'[`k',`i']*`var' `if'
>>             local `++i'
>>         }
>>         local `++k'
>>     }
>>     replace `xb' = `xb' + `at'[`k',`i'] `if'
>>     replace `varlist' = `depvars' - `xb' `if'
>> }
>> end
>>
>> gmm tryagain2, nequations(3) parameters(wldemr usaemr _cons) ///
>>     depvars(kenemr moremr zaremr) indvars(wldemr usaemr) ///
>>     instruments(nigemr empemr zaremr) wmatrix(robust) vce(hac bartlett 2) igmm
>>
>> The output when I run it: INVALID MOREMR. (moremr is one of my dependent variables).
>> THANK YOU.
>>
>

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index