Bookmark and Share

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

[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" <>
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


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

   -- Brian Poi

*   For searches and help try:

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