Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Help with heckman


From   "Renzo Comolli" <renzo.comolli@yale.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Help with heckman
Date   Sun, 24 Oct 2004 23:48:31 -0400

Dear Natalia,

The previous responder (Stas Kolenikov) gives you a suggestion that can
certainly be true, but I think there might be more than that. 
There are several different types of mistakes that you could be doing all
conceptually leading to the same incorrect result, but the most likely cause
is just that you mixed up the two syntaxes for -heckman, twostep-
I think it all boils down to the fact that you left out an = sign, but let's
just write it out all so we are sure.
I think I understand your example but I am not sure, therefore allow me to
use the example from the manual

use http://www.stata-press.com/data/r8/womenwk.dta, clear
* note that in this dataset wage is sometimes missing
heckman wage educ age, select(married children educ age) twostep // [1]

gen wage2=wage
replace wage2=0 if wage>=.
gen group=(wage<.)
heckman wage2 educ age, select(group= married children educ age) twostep //
[2] 

probit group married children educ age 
predict phat, xb
gen mills=exp(-0.5*phat*phat)/(sqrt(2*_pi)*normprob(phat))
reg wage educ age mills //[3]

Note that [1] and [2] are two mathematically identical ways of setting up
the same problem, the only difference is in the Stata syntax. Your example
does not have the = sign and therefore it looks like my sintax [1], but I
think you meant the syntax [2] and forgot the =

The syntax [2] is useful only when wage is never missing, confusingly enough
(confusingly for a novice, but smart from StataCorp point of view) you could
still use it even when wage is already missing so even writing the following
would have worked

gen group=(wage<.)
heckman wage educ age, select(group= married children educ age) twostep //
[2b] 

Here in [2b] both wages have their missing and the group variable acts as a
selector, one of the two is redundant, but Stata is not tripped by the
redundancy.

So, to summarize it all, the most likely mistake is that you should have
written
heckman hheck esc exp, select (trab= rpcf2) twostep

Best,
Renzo


----------------------------------------------------------------------------
----
*From   "Natalia Ferreira" <nat6672@hotmail.com> 
To   statalist@hsphsun2.harvard.edu 
Subject   st: Help with heckman 
Date   Wed, 20 Oct 2004 14:28:17 +0000 

----------------------------------------------------------------------------
----

Hi everyone

  I have been trying to estimate a Heckman but Im having problems with the
procedure implemantation in Stata. When I estimate Heckman by two different
equations: first probit (work/ not work) and than after a regress (wage)
with the mills that I got from the probit; I get different results that when
I estimate heckman twosteps with only one procedure (command "heckamn"). The
two different rotines are below, if anyone can tell me what is going wrong I
appreciate.


Thanks, Natalia

Rotine 1:
gen hheck= ln_rend
replace hhec=. if hheck==0
probit trab  rpcf2
predict phat if e(sample), xb
gen mills = exp(-0.5*phat*phat)/(sqrt(2*_pi)*normprob(phat))
reg hheck  esc exp  mills  if  e(sample)

Rotine 2:
gen hheck= ln_rend
replace hhec=. if hheck==0
heckman hheck esc exp, select (trab rpcf2) twostep


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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