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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: using macros in -gmm-


From   Daniel Borowczyk Martins <stata.danielbm@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: using macros in -gmm-
Date   Wed, 10 Aug 2011 12:38:35 +0100

Dear stata users,

I am unable to male use of macros with the -gmm- stata command.

Here's an example.

1. Take a cross section data set with variables y and x.
2. I want to estimate an IV regression on the model "y constant x"
3. x is endogenous.
4. I use lags of x to instrument it. I define the  first and last lags
of the instrument set as two macros.

local first = 1
local last = 3

gmm (y - {b0} - {b1}*x1), instruments(l(`first'/`last').x1)

I get the following error "l(`first'/`last') numlist in operator invalid"

I tried with scalar rather than local and the same problem arises.

However, typing

gmm (y - {b0} - {b1}x1), instruments(l(1/3).x1)

works fine.

Now, if I define x1 as a local, we can see that -gmm- doesn't "read" macros.

local regressor "x1"

gmm (y - {b0} - {b1}*x1), instruments(l(1/3).`regressor')

I get the following message "Model not identified. There are more
parameters than instruments".

Is there anyway to circumvent this problem? I want to embed
estimations using -gmm- in a dofile that works with several locals....

Thanks in advance.
Daniel
*
*   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