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]

From |
Nick Cox <njcoxstata@gmail.com> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: -gmm- Heckman problem |

Date |
Wed, 19 Sep 2012 01:30:35 +0100 |

Nick

Nick On 18 Sep 2012, at 22:12, shetty sandeep <getsane@hotmail.com> wrote:

Hello Nick,I am sorry about not using the initial capitals for proper nouns. Iwill keep that in mind.The $mills in the previous email is a typo only in the email and notin the code. In the code it is $mil - this I define. I am pastingthe full code again.When I run the code (pasted below) I get some errors. I describethem below.--------------------- *Main codeglobal xb "{b1}*tage+{b2}*sqage+{b3}*child_less_18+{b4}*marry+{b5}*faminc+{b6}*efnp+{b7}*metro+{b8}*race+{b9}*firmsize+{b0}"global phi "normalden($xb)" global Phi "normal($xb)"global mil "$phi/$Phi" //calculating the Inverse Mills ratioglobal a1 "($phi/($Phi*(1-$Phi)))*(trad-$Phi)" //derivative of the selection likelihood. Here trad is the dummy forobserved log(wage)//eq 2global xb2 "{beta1}*tage+{beta2}*sqage+{beta3}*marry+{beta4}*metro+{beta5}*race+{beta6}*firmsize+{beta0}" // wage equation//First gmm command gmm (eq1:$a1)(eq2:lnwage-$xb2-{gamma}*($phi/$Phi)), ///instruments(eq1: tage sqage child_less_18 marry faminc efnp metrorace firmsize) ///instruments(eq2: tage sqage marry metro race firmsize $mil) winitial(identity)------------------------When I run the above gmm command where instruments for the secondequation includes $mil, I get the following errornormalden({b1}*tage+{b2}*sqage+{b3}*rfoklt18+{b4}*marry+{b5}*faminc+{b6}*efnp+{b7}*metro+{b8}*race+{b9}*firmsize+{b0})/normalnumlist in operator invalidI have checked the other parts of the code and this error is mainlyto do with the $mil as an instrument in the gmm command.Secondly,When I run the gmm code replacing $mil with $phi and $Phi asinstruments as belowgmm (eq1:$a1)(eq2:lnwage-$xb2-{gamma}*($phi/$Phi)), ///instruments(eq1: tage sqage rfoklt18 marry faminc efnp metro racefirmsize) ///instruments(eq2: tage sqage marry metro race firmsize $phi $Phi)winitial(identity)I get the following error as "{ Invalid name"I would like to know why is this the case and how should I specifythe Inverse Mills ratio ($mil) as an instrument in the -gmm- command?Thank you for any help. ----------------------------------------From: njcoxstata@gmail.com To: statalist@hsphsun2.harvard.edu Subject: Re: st: -gmm- heckman problem Date: Tue, 18 Sep 2012 21:02:20 +0100 According to this, you define $mil, but don't use it, and try to use $mills, but don't define it. Otherwise put, what you are showing us appears to be incomplete at best, or even incorrect. Even if that's typos as far as you are concerned, nevertheless it's hard to figure out what you expect us to figure out if you don't show us code that should be expected to work. Pedantry corner: Heckman is amajor figure, and Mills was a minor figure; either way their namesgetinitial capitals. Nick On 18 Sep 2012, at 20:42, shetty sandeep <getsane@hotmail.com> wrote:I am trying to estimate a heckman wage model using gmm. But I am facing a problem with the stata -gmm- command. I consistently get an error as "{ invalid name". The inverse mills ratio in the second stage moment condition seems to be the problem. My code is pasted below. It is likely that I may have some conceptual issues with gmm heckman. Any help is greatly appreciated. ~~~~~~~~~~~~code~~~~~~~~~~ global xb "{b1}*tage+{b2}*sqage+{b3}*child18+{b4}*marry+{b5}*faminc+ {b6}*famsize+{b7}*metro+{b8}*race+{b9}*firmsize+{b0}" //>0 global phi "normalden($xb)" //>0 global Phi "normal($xb)" //>0 global mil "$phi/$Phi" //>0 global a1 "($phi/($Phi*(1-$Phi)))*(trad-$Phi)" // derivative of the selection likelihood //eq 2 global xb2 "{beta1=0.02}*tage+{beta2=-0.0004}*sqage+{beta3=-0.007} *marry+{beta4}*metro+{beta5}*race+{beta6=1}*firmsize+{beta0=1}" // wage equation gmm (eq1: $a1)(eq2: lwr1-$xb2-{gamma}*($phi/$Phi)), /// instruments(eq1: tage sqage child18 marry faminc famsize metro race firmsize) /// instruments(eq2: tage sqage marry metro race firmsize $phi $Phi) winitial(identity) ~~~~~~~~~~~~~~~~~~~~~~~~~~ I have also tried using $mills as an instrument in which case I get an error as "numlist in operator invalid". I figured out that the division operator "/ " in instruments option of gmm is reserved for lags.

* * 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/

**References**:**st: -gmm- heckman problem***From:*shetty sandeep <getsane@hotmail.com>

**Re: st: -gmm- heckman problem***From:*Nick Cox <njcoxstata@gmail.com>

**RE: st: -gmm- Heckman problem***From:*shetty sandeep <getsane@hotmail.com>

- Prev by Date:
**st: Meta-Analysis of Hazard Ratios and Confidence Intervals** - Next by Date:
**Re: st: ANOVA for quartiles** - Previous by thread:
**RE: st: -gmm- Heckman problem** - Next by thread:
**st: Developing a Predictive Risk Equation from stcox survival analysis** - Index(es):