Chapter 10 - Panel Data Models

Examples

-------------------------------------------------------------------------------
      name:  SN
       log:  myReplications\iiexample10
  log type:  smcl
 opened on:  11 Jun 2019, 14:11:48

. **********************************************
. * Solomon Negash - Examples
. * Wooldridge (2010). Economic Analysis of Cross-Section and Panel Data. 2nd ed.  
. * STATA Program, version 15.1. 

. * Chapter 10  - Basic Linear Unobserved Effects Panel Data Models
. * Computer Exercises (Problems)
. **********************************************

. // Example 10.1 NA
. // Example 10.2 NA
. // Example 10.3 NA
. // Example 10.4 (RE Estimation of the Effects of Job Training Grants):
. bcuse jtrain, clear nodesc

. xtset fcode year
       panel variable:  fcode (strongly balanced)
        time variable:  year, 1987 to 1989
                delta:  1 unit

. xtreg lscrap d88 d89 union grant grant_1, re

Random-effects GLS regression                   Number of obs     =        162
Group variable: fcode                           Number of groups  =         54

R-sq:                                           Obs per group:
     within  = 0.2006                                         min =          3
     between = 0.0206                                         avg =        3.0
     overall = 0.0361                                         max =          3

                                                Wald chi2(5)      =      26.99
corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0001

------------------------------------------------------------------------------
      lscrap |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         d88 |  -.0934519   .1091559    -0.86   0.392    -.3073936    .1204898
         d89 |  -.2698336   .1316496    -2.05   0.040     -.527862   -.0118052
       union |   .5478021    .410625     1.33   0.182    -.2570081    1.352612
       grant |  -.2146961   .1477838    -1.45   0.146     -.504347    .0749548
     grant_1 |  -.3770697   .2053516    -1.84   0.066    -.7795514     .025412
       _cons |   .4148333   .2434322     1.70   0.088    -.0622851    .8919517
-------------+----------------------------------------------------------------
     sigma_u |  1.3900287
     sigma_e |   .4977442
         rho |  .88634984   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. test grant grant_1

 ( 1)  grant = 0
 ( 2)  grant_1 = 0

           chi2(  2) =    3.66
         Prob > chi2 =    0.1601

. // Example 10.5 (FE Estimation of the Effects of Job Training Grants):
. xtreg lscrap d88 d89 union grant grant_1, fe
note: union omitted because of collinearity

Fixed-effects (within) regression               Number of obs     =        162
Group variable: fcode                           Number of groups  =         54

R-sq:                                           Obs per group:
     within  = 0.2010                                         min =          3
     between = 0.0079                                         avg =        3.0
     overall = 0.0068                                         max =          3

                                                F(4,104)          =       6.54
corr(u_i, Xb)  = -0.0714                        Prob > F          =     0.0001

------------------------------------------------------------------------------
      lscrap |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         d88 |  -.0802157   .1094751    -0.73   0.465    -.2973089    .1368776
         d89 |  -.2472028   .1332183    -1.86   0.066    -.5113797     .016974
       union |          0  (omitted)
       grant |  -.2523149    .150629    -1.68   0.097    -.5510178     .046388
     grant_1 |  -.4215895      .2102    -2.01   0.047    -.8384239   -.0047551
       _cons |    .597434   .0677344     8.82   0.000     .4631142    .7317539
-------------+----------------------------------------------------------------
     sigma_u |   1.438982
     sigma_e |   .4977442
         rho |  .89313867   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(53, 104) = 24.66                    Prob > F = 0.0000

. test grant grant_1

 ( 1)  grant = 0
 ( 2)  grant_1 = 0

       F(  2,   104) =    2.23
            Prob > F =    0.1127




. // Example 10.5 (Continued)
. xtreg lscrap d88 d89 union grant grant_1, fe r 
note: union omitted because of collinearity

Fixed-effects (within) regression               Number of obs     =        162
Group variable: fcode                           Number of groups  =         54

R-sq:                                           Obs per group:
     within  = 0.2010                                         min =          3
     between = 0.0079                                         avg =        3.0
     overall = 0.0068                                         max =          3

                                                F(4,53)           =       7.07
corr(u_i, Xb)  = -0.0714                        Prob > F          =     0.0001

                                 (Std. Err. adjusted for 54 clusters in fcode)
------------------------------------------------------------------------------
             |               Robust
      lscrap |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         d88 |  -.0802157   .0978408    -0.82   0.416    -.2764594    .1160281
         d89 |  -.2472028   .1967819    -1.26   0.215    -.6418974    .1474917
       union |          0  (omitted)
       grant |  -.2523149   .1434399    -1.76   0.084    -.5400188     .035389
     grant_1 |  -.4215895   .2824604    -1.49   0.141    -.9881333    .1449543
       _cons |    .597434   .0638746     9.35   0.000     .4693177    .7255503
-------------+----------------------------------------------------------------
     sigma_u |   1.438982
     sigma_e |   .4977442
         rho |  .89313867   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. // Example 10.6 (FD Estimation of the Effects of Job Training Grants)
. reg d.lscrap d89 d.grant d.grant_1

      Source |       SS           df       MS      Number of obs   =       108
-------------+----------------------------------   F(3, 104)       =      1.31
       Model |  1.31104171         3  .437013902   Prob > F        =    0.2739
    Residual |  34.5904836       104  .332600804   R-squared       =    0.0365
-------------+----------------------------------   Adj R-squared   =    0.0087
       Total |  35.9015253       107  .335528274   Root MSE        =    .57672

------------------------------------------------------------------------------
    D.lscrap |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         d89 |  -.0962082   .1254469    -0.77   0.445    -.3449741    .1525577
             |
       grant |
         D1. |  -.2227811   .1307423    -1.70   0.091     -.482048    .0364859
             |
     grant_1 |
         D1. |  -.3512459   .2350848    -1.49   0.138     -.817428    .1149361
             |
       _cons |  -.0906072   .0909695    -1.00   0.322    -.2710031    .0897888
------------------------------------------------------------------------------

. test d.grant d.grant_1

 ( 1)  D.grant = 0
 ( 2)  D.grant_1 = 0

       F(  2,   104) =    1.53
            Prob > F =    0.2215

. reg d.lscrap d89 d.grant d.grant_1, robust

Linear regression                               Number of obs     =        108
                                                F(3, 104)         =       1.95
                                                Prob > F          =     0.1254
                                                R-squared         =     0.0365
                                                Root MSE          =     .57672

------------------------------------------------------------------------------
             |               Robust
    D.lscrap |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         d89 |  -.0962082   .1284682    -0.75   0.456    -.3509654    .1585491
             |
       grant |
         D1. |  -.2227811   .1238652    -1.80   0.075    -.4684103    .0228482
             |
     grant_1 |
         D1. |  -.3512459   .2477216    -1.42   0.159    -.8424871    .1399952
             |
       _cons |  -.0906072   .0846918    -1.07   0.287    -.2585543    .0773399
------------------------------------------------------------------------------




. //Example 10.6 (continued)
. reg d.lscrap d89 d.grant d.grant_1 

      Source |       SS           df       MS      Number of obs   =       108
-------------+----------------------------------   F(3, 104)       =      1.31
       Model |  1.31104171         3  .437013902   Prob > F        =    0.2739
    Residual |  34.5904836       104  .332600804   R-squared       =    0.0365
-------------+----------------------------------   Adj R-squared   =    0.0087
       Total |  35.9015253       107  .335528274   Root MSE        =    .57672

------------------------------------------------------------------------------
    D.lscrap |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         d89 |  -.0962082   .1254469    -0.77   0.445    -.3449741    .1525577
             |
       grant |
         D1. |  -.2227811   .1307423    -1.70   0.091     -.482048    .0364859
             |
     grant_1 |
         D1. |  -.3512459   .2350848    -1.49   0.138     -.817428    .1149361
             |
       _cons |  -.0906072   .0909695    -1.00   0.322    -.2710031    .0897888
------------------------------------------------------------------------------

. predict u, r
(363 missing values generated)

. g u_1 = u[_n-1]
(363 missing values generated)

. reg u u_1

      Source |       SS           df       MS      Number of obs   =        54
-------------+----------------------------------   F(1, 52)        =      3.10
       Model |  .971329776         1  .971329776   Prob > F        =    0.0844
    Residual |  16.3125141        52  .313702194   R-squared       =    0.0562
-------------+----------------------------------   Adj R-squared   =    0.0380
       Total |  17.2838438        53  .326110261   Root MSE        =    .56009

------------------------------------------------------------------------------
           u |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         u_1 |   .2369065   .1346333     1.76   0.084    -.0332549    .5070679
       _cons |   3.33e-09   .0762188     0.00   1.000    -.1529441    .1529441
------------------------------------------------------------------------------

. //Example 10.7 (Job Training Grants) 
. *See Example 10.4 above 

------------------------------------------------------------------------------
. log close 
      name:  SN
       log:  myReplications\iiexample10
  log type:  smcl
 closed on:  11 Jun 2019, 14:11:50
-------------------------------------------------------------------------------