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/