# Heckman selection model: will full data be used in the second step?

I need to use Heckman selection model. I understand it is a two-step model. The first is the selection model, running on the full data (data with observed DV and unobserved DV). The second is the outcome model. My question being is the outcome model running on the the full data or just the data with observed DV?

This question is related to my second problem, which is about unobserved IV or unreasonable IV. Some of my IVs are only meaningful for the people whose DV is observed. For example, assume the selection is about whether work or not, outcome DV is wage, the focal IV is working hour. Obviously, working hour is only meaningful for those who are working and unavailable for those who stay home. Can this type of IV be used in the outcome model in Heckman selection model?

• Please define what you mean by wage. Nov 8, 2016 at 19:38
• The output from a Heckman selection model run on the full data can be thought of as a kind of weighting scheme which disproportionately weights observations that exist in the full information data but are missing from the subset or, in your words, "the data with observed DV." Heckman's logic is to "weight" the existing observations in the full data that most resemble the observations that are missing from the subsetted data. So, you would not use the full data in the second stage, just the subset incorporating the output or weights from the first stage as a parametric bias control. Nov 8, 2016 at 21:50
• @DJohnson Can you provide a reference for this? I am having trouble seeing why the control function approach is analogous to the weighting. Nov 9, 2016 at 2:21
• @DimitriyV.Masterov No reference. My comment is based on my own very close reading and study of the Heckman model. Nov 9, 2016 at 2:42

You can usually answer questions like your first via proof by computer. First, fit the model using the canned package and then by hand to see if they match. This will also help you understand what's going on.

Let's do the first step using Stata:

. webuse womenwk, clear

. /* Canned */
. heckman wage educ age, select(married children educ age) twostep

Heckman selection model -- two-step estimates   Number of obs     =      2,000
(regression model with sample selection)        Censored obs      =        657
Uncensored obs    =      1,343

Wald chi2(2)      =     442.54
Prob > chi2       =     0.0000

------------------------------------------------------------------------------
wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
wage         |
education |   .9825259   .0538821    18.23   0.000     .8769189    1.088133
age |   .2118695   .0220511     9.61   0.000     .1686502    .2550888
_cons |   .7340391   1.248331     0.59   0.557    -1.712645    3.180723
-------------+----------------------------------------------------------------
select       |
married |   .4308575    .074208     5.81   0.000     .2854125    .5763025
children |   .4473249   .0287417    15.56   0.000     .3909922    .5036576
education |   .0583645   .0109742     5.32   0.000     .0368555    .0798735
age |   .0347211   .0042293     8.21   0.000     .0264318    .0430105
_cons |  -2.467365   .1925635   -12.81   0.000    -2.844782   -2.089948
-------------+----------------------------------------------------------------
mills        |
lambda |   4.001615   .6065388     6.60   0.000     2.812821     5.19041
-------------+----------------------------------------------------------------
rho |    0.67284
sigma |  5.9473529
------------------------------------------------------------------------------


Note that the output distinguishes between censored and uncensored observations.

Now we fit the same model by hand:

. /* By Hand */
. gen int working=wage!=.

. qui probit working married children educ age

. predict xb, xb

. predict phat, pr

. gen imr = normalden(xb)/phat

. reg wage educ age imr

Source |       SS           df       MS      Number of obs   =     1,343
-------------+----------------------------------   F(3, 1339)      =    173.01
Model |  14904.6806         3  4968.22688   Prob > F        =    0.0000
Residual |   38450.214     1,339  28.7156191   R-squared       =    0.2793
-------------+----------------------------------   Adj R-squared   =    0.2777
Total |  53354.8946     1,342  39.7577456   Root MSE        =    5.3587

------------------------------------------------------------------------------
wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
education |   .9825259   .0504982    19.46   0.000     .8834616     1.08159
age |   .2118695   .0206636    10.25   0.000      .171333     .252406
imr |   4.001615   .5771027     6.93   0.000     2.869492    5.133739
_cons |   .7340391   1.166214     0.63   0.529    -1.553766    3.021844
------------------------------------------------------------------------------


As you can see, the sample for the outcome regression is just the 1,343 observations who have a wage out of the total 2,000 women in the dataset, but you have a generated regressor $\hat \lambda$, or the IMR. The coefficients match the heckman output from above (though the standard errors will be off in the outcome equation because of the generated regressor problem with the IMR).

In intuition is that the full sample regression is not feasible since we don't observe the wage for 657 women, and there's nothing this model can do to get around that. All we can do is throw in the IMR, since the IMR times its coefficient captures the expected value of the error in the wage equation, conditional on working. This will reflect the idea that the women with large negative wage errors are not working, so the expected value of the wage error is no longer zero for some of the women who do work.

On your second question, there's nothing wrong with including "working" independent variables from a mechanical perspective. The model will compute coefficients. Whether you want to do that may depend on the details of what you actually want to do and what you mean by wage. The hours example seems contrived, and it's not clear what wage means, so it would be helpful to clarify that.

• "wage" is the same "wage" in the above data. "working hour" may not be a suitable IV here. Nevertheless, I just want to refer an IV that are not available for not working women. As for the second question, I generated a new variable educ1 which only has values for working women and ran "heckman wage educ1 age, select(married children education age) twostep". The result is identical to the above. I think then it proves that only the data of working women will be used in the second step and it is OK to have IVs that are only meaningful/available for working women in the second step. Nov 10, 2016 at 10:48
• @DingLi My only worry is that variables like hours or occupation are also choice variables or intermediate outcomes, and sometimes you may not want to control for these. Nov 11, 2016 at 19:42