INTRODUCTORY ECONOMETRICS – REPLICATING EXAMPLES

Chapter 17. Limited Dependent Variable – Examples

-------------------------------------------------------------------------------------
      name:  SN
       log:  ~Wooldridge\intro-econx\iexample18.smcl
  log type:  smcl
 opened on:  18 Jan 2019, 20:45:49
. **********************************************
. * Solomon Negash - Replicating Examples
. * Wooldridge (2016). Introductory Econometrics: A Modern Approach. 6th ed.  
. * STATA Program, version 15.1. 

. * CHAPTER 17 Limited Dependent Variable Models and Sample Selection Corrections
. * Computer Exercises (Examples)
. ******************** SETUP *********************

. *Example 17.1. Married Women’s Labor Force Participation
. u mroz, clear
. eststo LPM_OLS: reg inlf nwifeinc educ exper* age kidslt6 kidsge6 
      Source |       SS           df       MS      Number of obs   =       753
-------------+----------------------------------   F(7, 745)       =     38.22
       Model |  48.8080578         7  6.97257969   Prob > F        =    0.0000
    Residual |  135.919698       745  .182442547   R-squared       =    0.2642
-------------+----------------------------------   Adj R-squared   =    0.2573
       Total |  184.727756       752  .245648611   Root MSE        =    .42713
------------------------------------------------------------------------------
        inlf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    nwifeinc |  -.0034052   .0014485    -2.35   0.019    -.0062488   -.0005616
        educ |   .0379953    .007376     5.15   0.000      .023515    .0524756
       exper |   .0394924   .0056727     6.96   0.000     .0283561    .0506287
     expersq |  -.0005963   .0001848    -3.23   0.001    -.0009591   -.0002335
         age |  -.0160908   .0024847    -6.48   0.000    -.0209686    -.011213
     kidslt6 |  -.2618105   .0335058    -7.81   0.000    -.3275875   -.1960335
     kidsge6 |   .0130122    .013196     0.99   0.324    -.0128935    .0389179
       _cons |   .5855192    .154178     3.80   0.000     .2828442    .8881943
------------------------------------------------------------------------------
. eststo Logit_MLE: logit inlf nwifeinc educ exper* age kidslt6 kidsge6 
Iteration 0:   log likelihood =  -514.8732  
Iteration 1:   log likelihood = -402.38502  
Iteration 2:   log likelihood = -401.76569  
Iteration 3:   log likelihood = -401.76515  
Iteration 4:   log likelihood = -401.76515  
Logistic regression                             Number of obs     =        753
                                                LR chi2(7)        =     226.22
                                                Prob > chi2       =     0.0000
Log likelihood = -401.76515                     Pseudo R2         =     0.2197
------------------------------------------------------------------------------
        inlf |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    nwifeinc |  -.0213452   .0084214    -2.53   0.011    -.0378509   -.0048394
        educ |   .2211704   .0434396     5.09   0.000     .1360303    .3063105
       exper |   .2058695   .0320569     6.42   0.000     .1430391    .2686999
     expersq |  -.0031541   .0010161    -3.10   0.002    -.0051456   -.0011626
         age |  -.0880244    .014573    -6.04   0.000     -.116587   -.0594618
     kidslt6 |  -1.443354   .2035849    -7.09   0.000    -1.842373   -1.044335
     kidsge6 |   .0601122   .0747897     0.80   0.422     -.086473    .2066974
       _cons |   .4254524   .8603697     0.49   0.621    -1.260841    2.111746
------------------------------------------------------------------------------
. margins, dydx( educ)
Average marginal effects                        Number of obs     =        753
Model VCE    : OIM
Expression   : Pr(inlf), predict()
dy/dx w.r.t. : educ
------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        educ |   .0394965   .0072947     5.41   0.000     .0251992    .0537939
------------------------------------------------------------------------------

. eststo Probit_MLE: probit inlf nwifeinc educ exper* age kidslt6 kidsge6 
Iteration 0:   log likelihood =  -514.8732  
Iteration 1:   log likelihood = -402.06651  
Iteration 2:   log likelihood = -401.30273  
Iteration 3:   log likelihood = -401.30219  
Iteration 4:   log likelihood = -401.30219  
Probit regression                               Number of obs     =        753
                                                LR chi2(7)        =     227.14
                                                Prob > chi2       =     0.0000
Log likelihood = -401.30219                     Pseudo R2         =     0.2206
------------------------------------------------------------------------------
        inlf |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    nwifeinc |  -.0120237   .0048398    -2.48   0.013    -.0215096   -.0025378
        educ |   .1309047   .0252542     5.18   0.000     .0814074     .180402
       exper |   .1233476   .0187164     6.59   0.000     .0866641    .1600311
     expersq |  -.0018871      .0006    -3.15   0.002     -.003063   -.0007111
         age |  -.0528527   .0084772    -6.23   0.000    -.0694678   -.0362376
     kidslt6 |  -.8683285   .1185223    -7.33   0.000    -1.100628    -.636029
     kidsge6 |    .036005   .0434768     0.83   0.408     -.049208    .1212179
       _cons |   .2700768    .508593     0.53   0.595    -.7267473    1.266901
------------------------------------------------------------------------------

. margins, dydx( educ)
Average marginal effects                        Number of obs     =        753
Model VCE    : OIM
Expression   : Pr(inlf), predict()
dy/dx w.r.t. : educ
------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        educ |   .0393703   .0072216     5.45   0.000     .0252161    .0535244
------------------------------------------------------------------------------

. estout, cells(b(nostar fmt(4)) se(par fmt(4))) stats(N, fmt(%9.0g) labels(Observatiions ///
 varlabels(_cons constant) varwidth(10) ti("Table 17.1 LPM, Logit, and Probit ///
 Estimates of Labor Force Participation: (inlf)")
Table 17.1 LPM, Logit, and Probit Estimates of Labor Force Participation: (inlf)
-------------------------------------------------
                LPM_OLS    Logit_MLE   Probit_MLE
                   b/se         b/se         b/se
-------------------------------------------------
main                                             
nwifeinc        -0.0034      -0.0213      -0.0120
               (0.0014)     (0.0084)     (0.0048)
educ             0.0380       0.2212       0.1309
               (0.0074)     (0.0434)     (0.0253)
exper            0.0395       0.2059       0.1233
               (0.0057)     (0.0321)     (0.0187)
expersq         -0.0006      -0.0032      -0.0019
               (0.0002)     (0.0010)     (0.0006)
age             -0.0161      -0.0880      -0.0529
               (0.0025)     (0.0146)     (0.0085)
kidslt6         -0.2618      -1.4434      -0.8683
               (0.0335)     (0.2036)     (0.1185)
kidsge6          0.0130       0.0601       0.0360
               (0.0132)     (0.0748)     (0.0435)
constant         0.5855       0.4255       0.2701
               (0.1542)     (0.8604)     (0.5086)
-------------------------------------------------
Observat~s          753          753          753
-------------------------------------------------
. est clear

. eststo LPM: qui reg inlf nwifeinc educ exper* age kidslt6 kidsge6 
. qui logit inlf nwifeinc educ exper* age kidslt6 kidsge6 
. eststo Logit: qui margins, dydx( nwifeinc educ exper* age kidslt6 kidsge6) post
. qui probit inlf nwifeinc educ exper* age kidslt6 kidsge6 
. eststo Probit: qui margins, dydx( nwifeinc educ exper* age kidslt6 kidsge6) post
. estout, cells(b(nostar fmt(4)) se(par fmt(4))) drop(_cons expersq) varwidth(10) ///
 ti("Table 17.2 Average Partial Effects for the Labor Force Participation Models: (inlf)")
Table 17.2 Average Partial Effects for the Labor Force Participation Models: (inlf)
-------------------------------------------------
                    LPM        Logit       Probit
                   b/se         b/se         b/se
-------------------------------------------------
nwifeinc        -0.0034      -0.0038      -0.0036
               (0.0014)     (0.0015)     (0.0014)
educ             0.0380       0.0395       0.0394
               (0.0074)     (0.0073)     (0.0072)
exper            0.0395       0.0368       0.0371
               (0.0057)     (0.0052)     (0.0052)
age             -0.0161      -0.0157      -0.0159
               (0.0025)     (0.0024)     (0.0024)
kidslt6         -0.2618      -0.2578      -0.2612
               (0.0335)     (0.0319)     (0.0319)
kidsge6          0.0130       0.0107       0.0108
               (0.0132)     (0.0133)     (0.0131)
-------------------------------------------------
. est clear

. *Example 17.2.  Married Women’s Annual Labor Supply
. u mroz, clear
. eststo Linear_OLS: reg hours nwifeinc educ exper* age kidslt6 kidsge6 

      Source |       SS           df       MS      Number of obs   =       753
-------------+----------------------------------   F(7, 745)       =     38.50
       Model |   151647606         7  21663943.7   Prob > F        =    0.0000
    Residual |   419262118       745  562767.944   R-squared       =    0.2656
-------------+----------------------------------   Adj R-squared   =    0.2587
       Total |   570909724       752  759188.463   Root MSE        =    750.18
------------------------------------------------------------------------------
       hours |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    nwifeinc |  -3.446636      2.544    -1.35   0.176    -8.440898    1.547626
        educ |   28.76112   12.95459     2.22   0.027     3.329283    54.19297
       exper |   65.67251   9.962983     6.59   0.000     46.11365    85.23138
     expersq |  -.7004939   .3245501    -2.16   0.031    -1.337635   -.0633524
         age |  -30.51163   4.363868    -6.99   0.000    -39.07858   -21.94469
     kidslt6 |  -442.0899    58.8466    -7.51   0.000    -557.6148    -326.565
     kidsge6 |  -32.77923   23.17622    -1.41   0.158     -78.2777    12.71924
       _cons |   1330.482   270.7846     4.91   0.000     798.8906    1862.074
------------------------------------------------------------------------------
. eststo Linear: qui margins, dydx( nwifeinc educ exper* age kidslt6 kidsge6) post
. eststo Tobit_MLE: tobit hours nwifeinc educ exper* age kidslt6 kidsge6, ll(0)
Refining starting values:
Grid node 0:   log likelihood = -3961.1577
Fitting full model:
Iteration 0:   log likelihood = -3961.1577  
Iteration 1:   log likelihood = -3836.8928  
Iteration 2:   log likelihood = -3819.2637  
Iteration 3:   log likelihood = -3819.0948  
Iteration 4:   log likelihood = -3819.0946  
Tobit regression                                Number of obs     =        753
                                                   Uncensored     =        428
Limits: lower = 0                                  Left-censored  =        325
        upper = +inf                               Right-censored =          0
                                                LR chi2(7)        =     271.59
                                                Prob > chi2       =     0.0000
Log likelihood = -3819.0946                     Pseudo R2         =     0.0343
------------------------------------------------------------------------------
       hours |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    nwifeinc |  -8.814226   4.459089    -1.98   0.048    -17.56808   -.0603706
        educ |   80.64541   21.58318     3.74   0.000     38.27441    123.0164
       exper |    131.564   17.27935     7.61   0.000     97.64211     165.486
     expersq |  -1.864153   .5376606    -3.47   0.001    -2.919661   -.8086455
         age |  -54.40491   7.418483    -7.33   0.000     -68.9685   -39.84133
     kidslt6 |  -894.0202   111.8777    -7.99   0.000    -1113.653   -674.3875
     kidsge6 |  -16.21805    38.6413    -0.42   0.675    -92.07668    59.64057
       _cons |   965.3068   446.4351     2.16   0.031     88.88827    1841.725
-------------+----------------------------------------------------------------
 var(e.hours)|    1258927   93304.48                       1088458     1456093
------------------------------------------------------------------------------
. eststo Tobit: qui margins, dydx( nwifeinc educ exper* age kidslt6 kidsge6) post pred(ystar(0,.))
. estout Linear_OLS Tobit_MLE, cells(b(nostar fmt(4)) se(par fmt(4))) stats(N, fmt(%9.0g) ///
 labels(Observations)) varlabels(_cons constant) varwidth(10) ti("Table 17.3 OLS ///
 and Tobit Estimation of Annual Hours Worked: (hours)")
Table 17.3 OLS and Tobit Estimation of Annual Hours Worked: (hours)
------------------------------------
             Linear_OLS    Tobit_MLE
                   b/se         b/se
------------------------------------
main                                
nwifeinc        -3.4466      -8.8142
               (2.5440)     (4.4591)
educ            28.7611      80.6454
              (12.9546)    (21.5832)
exper           65.6725     131.5640
               (9.9630)    (17.2793)
expersq         -0.7005      -1.8642
               (0.3246)     (0.5377)
age            -30.5116     -54.4049
               (4.3639)     (7.4185)
kidslt6       -442.0899    -894.0202
              (58.8466)   (111.8777)
kidsge6        -32.7792     -16.2181
              (23.1762)    (38.6413)
constant      1330.4824     965.3068
             (270.7846)   (446.4351)
------------------------------------
Observat~s          753          753
------------------------------------
. estout Linear Tobit, cells(b(nostar fmt(4)) se(par fmt(4))) varwidth(10) ti("Table ///
 17.4 Average Partial Effects for the Hours Worked Models: (hours)")
Table 17.4 Average Partial Effects for the Hours Worked Models: (hours)
------------------------------------
                 Linear        Tobit
                   b/se         b/se
------------------------------------
nwifeinc        -3.4466      -5.1886
               (2.5440)     (2.6214)
educ            28.7611      47.4731
              (12.9546)    (12.6214)
exper           65.6725      77.4470
               (9.9630)     (9.9976)
expersq         -0.7005      -1.0974
               (0.3246)     (0.3156)
age            -30.5116     -32.0262
               (4.3639)     (4.2921)
kidslt6       -442.0899    -526.2776
              (58.8466)    (64.7062)
kidsge6        -32.7792      -9.5470
              (23.1762)    (22.7522)
------------------------------------
. est clear

. *Example 17.3.  Poisson Regression for Number of Arrests
. u crime1, clear
. eststo Linear: qui reg narr86 pcnv avgsen tottime ptime86 qemp86 inc86 black hispan born60 
. eststo Poisson: qui poisson narr86 pcnv avgsen tottime ptime86 qemp86 inc86 black hispan born60 
. estout, cells(b(nostar fmt(4)) se(par fmt(4))) stats(r2 rmse ll, fmt(%9.0g %9.0g %9.0g) ///
 labels(R-Squared rmse Log-Likelihood)) varlabels(_cons constant) varwidth(10) ///
 ti("Table 17.5 Determinants of Number of Arrests for Young Men: (narr86)")
Table 17.5 Determinants of Number of Arrests for Young Men: (narr86)
------------------------------------
                 Linear      Poisson
                   b/se         b/se
------------------------------------
main                                
pcnv            -0.1319      -0.4016
               (0.0404)     (0.0850)
avgsen          -0.0113      -0.0238
               (0.0122)     (0.0199)
tottime          0.0121       0.0245
               (0.0094)     (0.0148)
ptime86         -0.0409      -0.0986
               (0.0088)     (0.0207)
qemp86          -0.0513      -0.0380
               (0.0145)     (0.0290)
inc86           -0.0015      -0.0081
               (0.0003)     (0.0010)
black            0.3270       0.6608
               (0.0454)     (0.0738)
hispan           0.1938       0.4998
               (0.0397)     (0.0739)
born60          -0.0225      -0.0510
               (0.0333)     (0.0641)
constant         0.5766      -0.5996
               (0.0379)     (0.0673)
------------------------------------
R-Squared      .0724764             
rmse           .8287301             
Log-Like~d    -3349.678    -2248.761
------------------------------------
. est clear

. *Example 17.4.  Duration of Recidivism
. u recid, clear
. cnreg  ldurat workprg priors tserved felon alcohol drugs black married educ age, censor(cens)
Censored-normal regression                      Number of obs     =      1,445
                                                LR chi2(10)       =     166.74
                                                Prob > chi2       =     0.0000
Log likelihood =  -1597.059                     Pseudo R2         =     0.0496
------------------------------------------------------------------------------
      ldurat |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     workprg |  -.0625715   .1200369    -0.52   0.602    -.2980382    .1728951
      priors |  -.1372529   .0214587    -6.40   0.000    -.1793466   -.0951592
     tserved |  -.0193305   .0029779    -6.49   0.000    -.0251721    -.013489
       felon |   .4439947   .1450865     3.06   0.002     .1593903    .7285991
     alcohol |  -.6349092   .1442166    -4.40   0.000    -.9178072   -.3520113
       drugs |  -.2981602   .1327355    -2.25   0.025    -.5585367   -.0377837
       black |  -.5427179   .1174428    -4.62   0.000    -.7730958     -.31234
     married |   .3406837   .1398431     2.44   0.015      .066365    .6150024
        educ |   .0229196   .0253974     0.90   0.367    -.0269004    .0727395
         age |   .0039103   .0006062     6.45   0.000     .0027211    .0050994
       _cons |   4.099386    .347535    11.80   0.000     3.417655    4.781117
-------------+----------------------------------------------------------------
      /sigma |    1.81047   .0623022                      1.688257    1.932683
------------------------------------------------------------------------------
             0  left-censored observations
           552     uncensored observations
           893 right-censored observations

. *Example 17.5. Wage Offer Equation for Married Women
. u mroz, clear
. eststo OLS: reg lwage educ exper* 
      Source |       SS           df       MS      Number of obs   =       428
-------------+----------------------------------   F(3, 424)       =     26.29
       Model |  35.0222967         3  11.6740989   Prob > F        =    0.0000
    Residual |  188.305144       424  .444115906   R-squared       =    0.1568
-------------+----------------------------------   Adj R-squared   =    0.1509
       Total |  223.327441       427  .523015084   Root MSE        =    .66642
------------------------------------------------------------------------------
       lwage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        educ |   .1074896   .0141465     7.60   0.000     .0796837    .1352956
       exper |   .0415665   .0131752     3.15   0.002     .0156697    .0674633
     expersq |  -.0008112   .0003932    -2.06   0.040    -.0015841   -.0000382
       _cons |  -.5220406   .1986321    -2.63   0.009    -.9124667   -.1316144
------------------------------------------------------------------------------

. eststo Heckit: heckman lwage educ exper*, twostep select(inlf = educ exper* nwifeinc age kidslt6 kidsge6) 
Heckman selection model -- two-step estimates   Number of obs     =        753
(regression model with sample selection)              Selected    =        428
                                                      Nonselected =        325

                                                Wald chi2(3)      =      51.53
                                                Prob > chi2       =     0.0000
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
lwage        |
        educ |   .1090655    .015523     7.03   0.000     .0786411      .13949
       exper |   .0438873   .0162611     2.70   0.007     .0120163    .0757584
     expersq |  -.0008591   .0004389    -1.96   0.050    -.0017194    1.15e-06
       _cons |  -.5781032   .3050062    -1.90   0.058    -1.175904     .019698
-------------+----------------------------------------------------------------
inlf         |
        educ |   .1309047   .0252542     5.18   0.000     .0814074     .180402
       exper |   .1233476   .0187164     6.59   0.000     .0866641    .1600311
     expersq |  -.0018871      .0006    -3.15   0.002     -.003063   -.0007111
    nwifeinc |  -.0120237   .0048398    -2.48   0.013    -.0215096   -.0025378
         age |  -.0528527   .0084772    -6.23   0.000    -.0694678   -.0362376
     kidslt6 |  -.8683285   .1185223    -7.33   0.000    -1.100628    -.636029
     kidsge6 |    .036005   .0434768     0.83   0.408     -.049208    .1212179
       _cons |   .2700768    .508593     0.53   0.595    -.7267473    1.266901
-------------+----------------------------------------------------------------
/mills       |
      lambda |   .0322619   .1336246     0.24   0.809    -.2296376    .2941613
-------------+----------------------------------------------------------------
         rho |    0.04861
       sigma |  .66362875
------------------------------------------------------------------------------

. estout, cells(b(nostar fmt(4)) se(par fmt(4)))  varlabels(_cons constant) varwidth(10) ///
 ti("Table 17.7 Wage Offer Equation for Married Women: (lwage)")
Table 17.7 Wage Offer Equation for Married Women: (lwage)
------------------------------------
                    OLS       Heckit
                   b/se         b/se
------------------------------------
main                                
educ             0.1075       0.1091
               (0.0141)     (0.0155)
exper            0.0416       0.0439
               (0.0132)     (0.0163)
expersq         -0.0008      -0.0009
               (0.0004)     (0.0004)
constant        -0.5220      -0.5781
               (0.1986)     (0.3050)
------------------------------------
inlf                                
educ                          0.1309
                            (0.0253)
exper                         0.1233
                            (0.0187)
expersq                      -0.0019
                            (0.0006)
nwifeinc                     -0.0120
                            (0.0048)
age                          -0.0529
                            (0.0085)
kidslt6                      -0.8683
                            (0.1185)
kidsge6                       0.0360
                            (0.0435)
constant                      0.2701
                            (0.5086)
------------------------------------
. est clear

. log close
      name:  SN
       log:  ~Wooldridge\intro-econx\iexample16.smcl
  log type:  smcl
 closed on:  18 Jan 2019, 20:45:51
-------------------------------------------------------------------------------------




0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

Say No To Ethnic Federalism!




RSS Solomon Negash