INTRODUCTORY ECONOMETRICS – REPLICATING EXAMPLES

Chapter 14. Advanced Panel Data Methods – Examples

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

. * CHAPTER 14. Advanced Panel Data Methods 
. * Computer Exercises (Examples)
. ******************** SETUP *********************

. *Example 14.1. Effect of Job Training on Firm Scrap Rates

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

. xtreg lscrap d88 d89 grant grant_1, fe

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     -.297309    .1368776
         d89 |  -.2472028   .1332183    -1.86   0.066    -.5113797    .0169741
       grant |  -.2523149    .150629    -1.68   0.097    -.5510178    .0463881
     grant_1 |  -.4215895      .2102    -2.01   0.047    -.8384239   -.0047551
       _cons |   .5974341   .0677344     8.82   0.000     .4631142    .7317539
-------------+----------------------------------------------------------------
     sigma_u |   1.438982
     sigma_e |  .49774421
         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

. display exp(_b[grant_1])-1
-.34399673

. xtreg lscrap d88 d89 grant, fe

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

R-sq:                                           Obs per group:
     within  = 0.1701                                         min =          3
     between = 0.0189                                         avg =        3.0
     overall = 0.0130                                         max =          3

                                                F(3,105)          =       7.18
corr(u_i, Xb)  = -0.0109                        Prob > F          =     0.0002

------------------------------------------------------------------------------
      lscrap |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         d88 |   -.140066    .106835    -1.31   0.193       -.3519    .0717681
         d89 |    -.42704   .0999338    -4.27   0.000    -.6251903   -.2288897
       grant |  -.0822141   .1262632    -0.65   0.516    -.3325706    .1681424
       _cons |   .5974341   .0687024     8.70   0.000     .4612098    .7336583
-------------+----------------------------------------------------------------
     sigma_u |  1.4283441
     sigma_e |  .50485774
         rho |  .88894293   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(53, 105) = 23.90                    Prob > F = 0.0000


. *Example 14.2.Has the Return to Education Changed over Time?

. u wagepan, clear
. xtset nr year
       panel variable:  nr (strongly balanced)
        time variable:  year, 1980 to 1987
                delta:  1 unit

. xtreg lwage c.educ##i.year union mar, fe
note: educ omitted because of collinearity

Fixed-effects (within) regression               Number of obs     =      4,360
Group variable: nr                              Number of groups  =        545

R-sq:                                           Obs per group:
     within  = 0.1708                                         min =          8
     between = 0.1900                                         avg =        8.0
     overall = 0.1325                                         max =          8

                                                F(16,3799)        =      48.91
corr(u_i, Xb)  = 0.0991                         Prob > F          =     0.0000

------------------------------------------------------------------------------
       lwage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        educ |          0  (omitted)
             |
        year |
       1981  |  -.0224158   .1458885    -0.15   0.878    -.3084431    .2636114
       1982  |  -.0057611   .1458558    -0.04   0.968    -.2917243    .2802021
       1983  |   .0104297   .1458579     0.07   0.943    -.2755377    .2963971
       1984  |   .0843743   .1458518     0.58   0.563    -.2015811    .3703297
       1985  |   .0497253   .1458602     0.34   0.733    -.2362465    .3356971
       1986  |   .0656064   .1458917     0.45   0.653    -.2204273    .3516401
       1987  |   .0904448   .1458505     0.62   0.535     -.195508    .3763977
             |
 year#c.educ |
       1981  |   .0115854   .0122625     0.94   0.345    -.0124562    .0356271
       1982  |   .0147905   .0122635     1.21   0.228    -.0092533    .0388342
       1983  |   .0171182   .0122633     1.40   0.163    -.0069251    .0411615
       1984  |   .0165839   .0122657     1.35   0.176     -.007464    .0406319
       1985  |   .0237085   .0122738     1.93   0.053    -.0003554    .0477725
       1986  |   .0274123    .012274     2.23   0.026     .0033481    .0514765
       1987  |   .0304332   .0122723     2.48   0.013     .0063722    .0544942
             |
       union |   .0829785   .0194461     4.27   0.000     .0448527    .1211042
     married |   .0548205   .0184126     2.98   0.003      .018721      .09092
       _cons |   1.362459   .0162385    83.90   0.000     1.330622    1.394296
-------------+----------------------------------------------------------------
     sigma_u |  .37264193
     sigma_e |  .35335713
         rho |  .52654439   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(544, 3799) = 8.09                   Prob > F = 0.0000

. testparm c.educ#i.year

 ( 1)  1981.year#c.educ = 0
 ( 2)  1982.year#c.educ = 0
 ( 3)  1983.year#c.educ = 0
 ( 4)  1984.year#c.educ = 0
 ( 5)  1985.year#c.educ = 0
 ( 6)  1986.year#c.educ = 0
 ( 7)  1987.year#c.educ = 0

       F(  7,  3799) =    1.24
            Prob > F =    0.2787


. *Example 14.3.Effect of Job Training on Firm Scrap Rates

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

. xtreg lscrap d88 d89 grant grant_1 lsales lempl, fe

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

R-sq:                                           Obs per group:
     within  = 0.2131                                         min =          1
     between = 0.0341                                         avg =        2.9
     overall = 0.0004                                         max =          3

                                                F(6,91)           =       4.11
corr(u_i, Xb)  = -0.2258                        Prob > F          =     0.0011

------------------------------------------------------------------------------
      lscrap |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         d88 |  -.0039609   .1195487    -0.03   0.974    -.2414296    .2335079
         d89 |   -.132193   .1536863    -0.86   0.392    -.4374719     .173086
       grant |  -.2967542   .1570861    -1.89   0.062    -.6087863     .015278
     grant_1 |  -.5355783    .224206    -2.39   0.019     -.980936   -.0902207
      lsales |  -.0868577   .2596985    -0.33   0.739    -.6027167    .4290014
     lemploy |  -.0763679   .3502902    -0.22   0.828    -.7721764    .6194405
       _cons |   2.115481    3.10843     0.68   0.498    -4.059034    8.289996
-------------+----------------------------------------------------------------
     sigma_u |  1.4415155
     sigma_e |  .49149057
         rho |  .89585692   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(50, 91) = 20.75                     Prob > F = 0.0000


. *Example 14.4. A Wage Equation Using Panel Data

. u wagepan, clear
. xtset nr year
       panel variable:  nr (strongly balanced)
        time variable:  year, 1980 to 1987
                delta:  1 unit

. eststo POLS: qui reg lwage educ black hisp exper expersq mar union i.year
. eststo RE: qui xtreg lwage educ black hisp exper expersq mar union i.year, re
. eststo FE: qui xtreg lwage expersq mar union i.year, fe
. estout, cells(b(nostar fmt(3)) se(par fmt(3))) stats(r2 N, fmt(%9.3f %9.0g) labels ///
  (R-squared Observations)) varlabels(_cons constant) varwidth(20) ti("Table 14.2 Three ///
  Different Estimators of a Wage Equation (lwage)")

Table 14.2 Three Different Estimators of a Wage Equation (lwage)
-----------------------------------------------------------
                             POLS           RE           FE
                             b/se         b/se         b/se
-----------------------------------------------------------
educ                        0.091        0.092             
                          (0.005)      (0.011)             
black                      -0.139       -0.139             
                          (0.024)      (0.048)             
hisp                        0.016        0.022             
                          (0.021)      (0.043)             
exper                       0.067        0.106             
                          (0.014)      (0.015)             
expersq                    -0.002       -0.005       -0.005
                          (0.001)      (0.001)      (0.001)
married                     0.108        0.064        0.047
                          (0.016)      (0.017)      (0.018)
union                       0.182        0.106        0.080
                          (0.017)      (0.018)      (0.019)
1980.year                   0.000        0.000        0.000
                              (.)          (.)          (.)
1981.year                   0.058        0.040        0.151
                          (0.030)      (0.025)      (0.022)
1982.year                   0.063        0.031        0.253
                          (0.033)      (0.032)      (0.024)
1983.year                   0.062        0.020        0.354
                          (0.037)      (0.042)      (0.029)
1984.year                   0.090        0.043        0.490
                          (0.040)      (0.051)      (0.036)
1985.year                   0.109        0.058        0.617
                          (0.043)      (0.061)      (0.045)
1986.year                   0.142        0.092        0.765
                          (0.046)      (0.071)      (0.056)
1987.year                   0.174        0.135        0.925
                          (0.049)      (0.081)      (0.069)
constant                    0.092        0.024        1.426
                          (0.078)      (0.151)      (0.018)
-----------------------------------------------------------
R-squared                   0.189                     0.181
Observations                 4360         4360         4360
-----------------------------------------------------------
. est clear

. log close
      name:  SN
       log:  ~Wooldridge\intro-econx\iexample14.smcl
  log type:  smcl
 closed on:  17 Jan 2019, 11:20:48
-------------------------------------------------------------------------------------
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 *