Statalist


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

Re: st: Moment evaluator programs with K equations


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Moment evaluator programs with K equations
Date   Wed, 17 Feb 2010 09:48:11 -0500

Christopher Kodongo <Christopher.Kodongo@students.wits.ac.za>:
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
<Christopher.Kodongo@students.wits.ac.za> 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index