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.

# Antwort: st: 'mills' output is missing for heckman regression

 From Richard Ochmann To statalist@hsphsun2.harvard.edu Subject Antwort: st: 'mills' output is missing for heckman regression Date Fri, 14 May 2010 10:20:59 +0200

```all I can see here is that at your 'problem 2' you try to -display-
variables which won't work.
-heckman- generates a variable for the Mills ratio and then you generate
another variable from it in:

> .         gen Dpr200412=mills200412*(mills200412+selpr200412)

So, go for e.g.:
***
sum Dpr200412 mills200412
***

best, rich

owner-statalist@hsphsun2.harvard.edu schrieb am 13.05.2010 05:52:02:

> Hi,
>
> I have two problems of calculating the marginal effects of
> coefficients from a heckman regression.
>
> here is my coding:
> xi: heckman lnincome male i.edunew2 urban2 inearthquake certi hr07
> ages2 dep_ratio i.occupation ///
>    if ad01==8 & hr07>=16 & inlist(od04,0,1) ///
>    [pweight=expweigh] ///
>    , select (male i.edunew2 i.hhecosta inearthquake urban2) ///
>    mills(mills200411)
> margins male i.edunew2 urban2 inearthquake
> predict selpr200411, psel
> gen Dpr200411=mills200411*(mills200411+selpr200411)
> display Dpr200411
>
> problem 1, margins command doesn't work at all. the effor message is
>    does anyone know how to use margins command after heckman regression?
>
>
> problem 2, then I cut off the margins command, and calculate the
> marginal effects by hand. but the 'Dpr200411' doesn't show up, it
> comes back with only '.' instead of a figure. Then I 'display
> mills200411', the '.' appears again. But there is a output when i
> 'display selpr200411'.
> the new code is:
> xi: heckman lnincome male i.edunew2 urban2 inearthquake certi hr07
> ages2 dep_ratio i.occupation ///
>    if ad01==8 & hr07>=16 & inlist(od04,0,1) ///
>    [pweight=expweigh] ///
>    , select (male i.edunew2 i.hhecosta inearthquake urban2) ///
>    mills(mills200411)
> predict selpr200411, psel
> gen Dpr200411=mills200411*(mills200411+selpr200411)
> display Dpr200411
>
> here is the output:
> i.edunew2         _Iedunew2_0-4       (naturally coded; _Iedunew2_0
omitted)
> i.occupation      _Ioccupatio_0-6     (naturally coded; _Ioccupatio_0
omitted)
> i.hhecosta5000    _Ihhecosta5_0-3     (naturally coded; _Ihhecosta5_0
omitted)
> note: _Ioccupatio_6 omitted because of collinearity
>
> Iteration 0:   log pseudolikelihood =  -29511151  (not concave)
> Iteration 1:   log pseudolikelihood =  -27814870
> Iteration 2:   log pseudolikelihood =  -27377953  (not concave)
> Iteration 3:   log pseudolikelihood =  -26636133
> Iteration 4:   log pseudolikelihood =  -26458324
> Iteration 5:   log pseudolikelihood =  -26454536
> Iteration 6:   log pseudolikelihood =  -26454530
> Iteration 7:   log pseudolikelihood =  -26454530
>
> Heckman selection model                         Number of obs      =
8179
> (regression model with sample selection)        Censored obs       =
6890
>                                                 Uncensored obs     =
1289
>
>                                                 Wald chi2(15)      =
96.10
> Log pseudolikelihood = -2.65e+07                Prob > chi2        =
0.0000
>
>
------------------------------------------------------------------------------
>              |               Robust
>     lnincome |      Coef.   Std. Err.      z    P>|z|     [95%
Conf.Interval]
>
-------------+----------------------------------------------------------------
> lnincome     |
>         male |  -.0770914   .0420301    -1.83   0.067    -.1594688
.0052859
>  _Iedunew2_1 |   -.151851   .0561303    -2.71   0.007    -.2618645
-.0418376
>  _Iedunew2_2 |  -.2193169   .0574577    -3.82   0.000    -.3319319
-.1067018
>  _Iedunew2_3 |  -.2828423   .0740978    -3.82   0.000    -.4280715
-.1376132
>  _Iedunew2_4 |   .3236262   .2218939     1.46   0.145    -.1112778
.7585302
>       urban2 |   .0602396   .0467554     1.29   0.198    -.0313993
.1518785
> inearthquake |  -.1362456   .0370262    -3.68   0.000    -.2088156
-.0636757
>        certi |   .0316799   .0637047     0.50   0.619     -.093179
.1565388
>         hr07 |   .0346725   .0086475     4.01   0.000     .0177237
.0516213
>        ages2 |  -.0504113   .0112049    -4.50   0.000    -.0723725
-.0284502
>    dep_ratio |  -.2012548   .0757752    -2.66   0.008    -.3497714
-.0527382
> _Ioccupati~1 |   .1470003   .0750557     1.96   0.050    -.0001063
.2941068
> _Ioccupati~2 |   .3799047   .1064299     3.57   0.000      .171306
.5885035
> _Ioccupati~3 |   .0955231   .0798577     1.20   0.232    -.0609951
.2520413
> _Ioccupati~4 |   .1403077   .0831009     1.69   0.091    -.0225672
.3031825
> _Ioccupati~6 |  (omitted)
>        _cons |   6.630357   .2008758    33.01   0.000     6.236648
7.024066
>
-------------+----------------------------------------------------------------
> select       |
>         male |   .5482426   .0394785    13.89   0.000     .4708661
.625619
>  _Iedunew2_1 |   .4617968   .0549549     8.40   0.000     .3540871
.5695065
>  _Iedunew2_2 |   .7589722   .0486543    15.60   0.000     .6636116
.8543329
>  _Iedunew2_3 |   1.236086   .0688923    17.94   0.000     1.101059
1.371112
>  _Iedunew2_4 |  -.4383474   .2718042    -1.61   0.107    -.9710739
.0943792
> _Ihhecosta~1 |    .588973   .0505102    11.66   0.000      .489975
.6879711
> _Ihhecosta~2 |   .2846132   .0427787     6.65   0.000     .2007686
.3684578
> _Ihhecosta~3 |   .2546093   .0601532     4.23   0.000     .1367111
.3725075
> inearthquake |   .1958563   .0450808     4.34   0.000     .1074996
.2842131
>       urban2 |    .439123   .0471768     9.31   0.000     .3466581
.5315879
>        _cons |  -2.084462   .0427642   -48.74   0.000    -2.168278
-2.000645
>
-------------+----------------------------------------------------------------
>      /athrho |  -1.118788    .085606   -13.07   0.000    -1.286573
-.9510036
>     /lnsigma |  -.3448958   .0395288    -8.73   0.000    -.4223709
-.2674207
>
-------------+----------------------------------------------------------------
>          rho |   -.807147   .0298349                     -.8582264
-.740237
>        sigma |   .7082942    .027998                      .6554909
.765351
>       lambda |  -.5716975   .0419986                     -.6540133
-.4893818
>
------------------------------------------------------------------------------
> Wald test of indep. eqns. (rho = 0): chi2(1) =   170.80   Prob > chi2 =
0.0000
>
------------------------------------------------------------------------------
>
> .         predict selpr200412, psel
> (32284 missing values generated)
>
> .         gen Dpr200412=mills200412*(mills200412+selpr200412)
> (159277 missing values generated)
>
> .         display Dpr200412
> .
>
> . display selpr200412
> .30568352
>
> . display mills200412
> .
>
>
> does any one know what's going on??
>
> thanks a lot
>
>
>
>
> --
> Best
>
> 刘京   Jing LIU
>
> *
> *   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/

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