Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: gmm with two equations and one parameter


From   "Brian P. Poi" <brian@poiholdings.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: gmm with two equations and one parameter
Date   Wed, 08 Jun 2011 07:57:28 -0400

On 06/07/2011 09:59 PM, Wu Zhang wrote:
OK. I attach all the files.

my gmm command is:
gmm (gmm_poi2) (gmm_poi3), mylhs(y) myrhs(x)  instruments(1:d1, noconstant)
instruments(2:d2, noconstant) vce(cluster id) myidvar(id) onestep


This represents a misunderstanding of the -gmm- syntax. You are combining elements of the interactive version of -gmm- along with elements of the function evaluator program version. If you write a program to evaluate your moment equations, then you write a single program that computes all of them; you cannot write separate programs for separate moment equations. Second, if you write a function evaluator program, then you do not bind its name in parentheses; the parentheses indicate to -gmm- that you are typing a moment equation interactively with substitutable expressions.

Here is a trivial example:

-------
sysuse auto, clear


program	mygmm

        version	11

        syntax varlist [if] , at(name)

        local eq1 : word 1 of `varlist'
        local eq2 : word 2 of `varlist'

        quietly replace `eq1' = mpg - `at'[1,1] - `at'[1,2]*turn
        quietly replace `eq2' = mpg - `at'[1,1] - `at'[1,3]*head

end

gmm mygmm, nequations(2) nparameters(3)               ///
           instruments(turn head) winitial(identity)
-------


   -- Brian Poi
   -- brian@poiholdings.com

*
*   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   |   Site index