I am running a model with the Heckman correction, and then asking for the predicted probabilities. What is not clear is why I obtain a lot of predicted probabilities with negative values. This does not happen when I run the same model without Heckman correction (but using the -logit- command).
Below my data and the results I obtain.
Thanks a lot in advance, best, G.P.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte(inc20 nasses3 sg11 tit3 cletad) int anno float shagreg . 1 1 2 6 2017 3.232878 . 1 1 1 3 2018 8.721139 . 1 1 1 6 2016 3.981817 0 1 1 1 4 2018 1.3068345 . 1 1 3 5 2015 7.125418 . 1 1 2 6 2018 4.281139 . 1 2 2 6 2015 2.3719475 1 3 1 1 5 2017 2.1255476 0 1 1 2 3 2016 3.482502 . 1 1 2 6 2014 1.622628 1 1 2 2 5 2018 5.693385 0 1 1 1 5 2014 2.1621373 1 1 1 1 5 2014 7.840507 0 1 1 3 5 2016 6.721983 . 1 1 1 6 2018 2.5998094 . 1 1 1 5 2016 3.981817 0 1 1 2 4 2015 2.0788703 0 1 2 2 4 2014 6.954388 1 3 1 1 5 2017 6.60916 . 1 1 2 5 2018 5.66036 end label values nasses3 nasses3 label def nasses3 1 "italia", modify label def nasses3 3 "low income countries", modify label values sg11 sg11 label def sg11 1 "maschio", modify label def sg11 2 "femmina", modify label values cletad cletad label def cletad 3 "25-34 anni", modify label def cletad 4 "35-44 anni", modify label def cletad 5 "45-54 anni", modify label def cletad 6 "55-64 anni", modify
Code:
. heckman inc20 i.nasses3 i.sg11 i.tit3 i.cletad i.anno shagreg c.shagreg#nasses3, select (i.nasses3 i.sg11 i.tit3 i.cletad i.anno sh
> agreg c.shagreg#nasses3 i.famstat5) twostep
Heckman selection model -- two-step estimates Number of obs = 1118684
(regression model with sample selection) Selected = 493,499
Nonselected = 625,185
Wald chi2(16) = 47204.41
Prob > chi2 = 0.0000
-----------------------------------------------------------------------------------------------------
inc20 | Coef. Std. Err. z P>|z| [95% Conf. Interval]
------------------------------------+----------------------------------------------------------------
inc20 |
nasses3 |
high income countries | .0431644 .0075018 5.75 0.000 .028461 .0578677
low income countries | .126201 .003864 32.66 0.000 .1186276 .1337744
|
sg11 |
femmina | .1592556 .0016643 95.69 0.000 .1559936 .1625175
|
tit3 |
2 | .0022904 .0027069 0.85 0.397 -.003015 .0075958
3 | -.0673849 .0032428 -20.78 0.000 -.0737407 -.0610292
|
cletad |
25-34 anni | .0576349 .006063 9.51 0.000 .0457516 .0695182
35-44 anni | .0301163 .0069944 4.31 0.000 .0164076 .043825
45-54 anni | .002839 .007034 0.40 0.686 -.0109473 .0166253
55-64 anni | -.1246012 .0048802 -25.53 0.000 -.1341663 -.1150362
|
anno |
2015 | -.0024898 .0018466 -1.35 0.178 -.0061091 .0011295
2016 | .0080837 .0018876 4.28 0.000 .0043842 .0117833
2017 | .0185776 .0018876 9.84 0.000 .0148779 .0222773
2018 | .0199895 .0019185 10.42 0.000 .0162292 .0237497
|
shagreg | .0020818 .0004167 5.00 0.000 .001265 .0028985
|
nasses3#c.shagreg |
high income countries | .0027072 .0016497 1.64 0.101 -.0005261 .0059406
low income countries | .0250872 .0010147 24.72 0.000 .0230984 .027076
|
_cons | -.1918065 .0124832 -15.37 0.000 -.2162732 -.1673398
------------------------------------+----------------------------------------------------------------
select |
nasses3 |
high income countries | -.1207626 .0156957 -7.69 0.000 -.1515255 -.0899996
low income countries | -.0050783 .0083631 -0.61 0.544 -.0214696 .011313
|
sg11 |
femmina | -.260509 .0025667 -101.49 0.000 -.2655397 -.2554782
|
tit3 |
2 | .4669964 .002781 167.93 0.000 .4615458 .472447
3 | .552387 .0038212 144.56 0.000 .5448976 .5598764
|
cletad |
25-34 anni | .7875154 .0054319 144.98 0.000 .7768692 .7981617
35-44 anni | .8949092 .0058644 152.60 0.000 .8834152 .9064033
45-54 anni | .8811257 .0059315 148.55 0.000 .8695001 .8927513
55-64 anni | .3945313 .0061617 64.03 0.000 .3824546 .406608
|
anno |
2015 | .0199867 .0039074 5.12 0.000 .0123284 .027645
2016 | .0665531 .003962 16.80 0.000 .0587877 .0743184
2017 | .0662696 .0039608 16.73 0.000 .0585066 .0740326
2018 | .0863712 .0039899 21.65 0.000 .0785511 .0941914
|
shagreg | -.0591747 .0005719 -103.47 0.000 -.0602956 -.0580539
|
nasses3#c.shagreg |
high income countries | .0089005 .0033042 2.69 0.007 .0024245 .0153766
low income countries | .0283409 .0020948 13.53 0.000 .0242352 .0324466
|
famstat5 |
coniugato/a convivente con figli | -.04411 .0039826 -11.08 0.000 -.0519157 -.0363043
coniugato/a convivente senza figli | -.1225326 .0047492 -25.80 0.000 -.1318408 -.1132244
figlio che vive con i genitori | -.3911102 .0052395 -74.65 0.000 -.4013795 -.380841
monogenitore | .10228 .0069334 14.75 0.000 .0886909 .1158692
|
_cons | -.6348052 .0075043 -84.59 0.000 -.6495134 -.6200969
------------------------------------+----------------------------------------------------------------
/mills |
lambda | .3578496 .0079531 45.00 0.000 .3422619 .3734374
------------------------------------+----------------------------------------------------------------
rho | 0.78044
sigma | .45852232
-----------------------------------------------------------------------------------------------------
. margins nasses3, at(shagreg=(0(4)12))
Predictive margins Number of obs = 1,118,684
Model VCE : Conventional
Expression : Linear prediction, predict()
1._at : shagreg = 0
2._at : shagreg = 4
3._at : shagreg = 8
4._at : shagreg = 12
------------------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------------------+----------------------------------------------------------------
_at#nasses3 |
1#italia | -.1243442 .0063967 -19.44 0.000 -.1368815 -.1118069
1#high income countries | -.0811798 .009987 -8.13 0.000 -.100754 -.0616056
1#low income countries | .0018568 .0070757 0.26 0.793 -.0120113 .0157248
2#italia | -.1160171 .0075079 -15.45 0.000 -.1307323 -.101302
2#high income countries | -.0620238 .008536 -7.27 0.000 -.0787541 -.0452936
2#low income countries | .1105327 .0068814 16.06 0.000 .0970454 .12402
3#italia | -.1076901 .0087963 -12.24 0.000 -.1249306 -.0904496
3#high income countries | -.0428678 .0115183 -3.72 0.000 -.0654433 -.0202924
3#low income countries | .2192087 .0086493 25.34 0.000 .2022563 .236161
4#italia | -.099363 .0101951 -9.75 0.000 -.119345 -.079381
4#high income countries | -.0237118 .0167082 -1.42 0.156 -.0564594 .0090357
4#low income countries | .3278846 .0115081 28.49 0.000 .3053291 .3504401
------------------------------------------------------------------------------------------Code:
logit inc20 i.nasses3 i.sg11 i.tit3 i.cletad i.anno shagreg c.shagreg#nasses3
Iteration 0: log likelihood = -241621.34
Iteration 1: log likelihood = -206432.72
Iteration 2: log likelihood = -203216.43
Iteration 3: log likelihood = -203196.69
Iteration 4: log likelihood = -203196.69
Logistic regression Number of obs = 493,500
LR chi2(16) = 76849.32
Prob > chi2 = 0.0000
Log likelihood = -203196.69 Pseudo R2 = 0.1590
----------------------------------------------------------------------------------------
inc20 | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-----------------------+----------------------------------------------------------------
nasses3 |
high income countries | .5621639 .046834 12.00 0.000 .4703709 .653957
low income countries | .9428491 .0222722 42.33 0.000 .8991964 .9865018
|
sg11 |
femmina | 1.635258 .0087927 185.98 0.000 1.618024 1.652491
|
tit3 |
2 | -.7434007 .0088528 -83.97 0.000 -.7607519 -.7260494
3 | -1.554398 .0132781 -117.06 0.000 -1.580423 -1.528374
|
cletad |
25-34 anni | -.9948178 .0169151 -58.81 0.000 -1.027971 -.9616648
35-44 anni | -1.541289 .0163707 -94.15 0.000 -1.573375 -1.509203
45-54 anni | -1.787111 .0163471 -109.32 0.000 -1.81915 -1.755071
55-64 anni | -1.95677 .0178128 -109.85 0.000 -1.991682 -1.921857
|
anno |
2015 | -.0568865 .0125321 -4.54 0.000 -.081449 -.0323241
2016 | -.0564039 .0125813 -4.48 0.000 -.0810628 -.0317451
2017 | .0292715 .0124994 2.34 0.019 .0047731 .0537699
2018 | .0059687 .0125931 0.47 0.636 -.0187134 .0306508
|
shagreg | .1241858 .0019213 64.64 0.000 .1204201 .1279515
|
nasses3#c.shagreg |
high income countries | -.0203934 .0100241 -2.03 0.042 -.0400403 -.0007464
low income countries | .0352157 .0056569 6.23 0.000 .0241283 .046303
|
_cons | -.9381701 .0193737 -48.42 0.000 -.976142 -.9001983
----------------------------------------------------------------------------------------
. margins nasses3, at(shagreg=(0(4)12))
Predictive margins Number of obs = 493,500
Model VCE : OIM
Expression : Pr(inc20), predict()
1._at : shagreg = 0
2._at : shagreg = 4
3._at : shagreg = 8
4._at : shagreg = 12
------------------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------------------+----------------------------------------------------------------
_at#nasses3 |
1#italia | .1163328 .0008455 137.59 0.000 .1146756 .11799
1#high income countries | .1780373 .0058645 30.36 0.000 .166543 .1895316
1#low income countries | .231282 .0030835 75.01 0.000 .2252384 .2373256
2#italia | .1698266 .0005533 306.92 0.000 .1687421 .1709111
2#high income countries | .2365587 .0033462 70.69 0.000 .2300003 .2431172
2#low income countries | .3398336 .0018796 180.80 0.000 .3361497 .3435174
3#italia | .2390556 .0013317 179.51 0.000 .2364455 .2416657
3#high income countries | .3055811 .0078081 39.14 0.000 .2902776 .3208846
3#low income countries | .4656072 .005409 86.08 0.000 .4550058 .4762087
4#italia | .3231823 .0028526 113.29 0.000 .3175913 .3287732
4#high income countries | .3832656 .0157352 24.36 0.000 .3524251 .4141061
4#low income countries | .5955947 .0093665 63.59 0.000 .5772367 .6139527
------------------------------------------------------------------------------------------
0 Response to Predicted probabilities out of range after Heckman
Post a Comment