UCLA Academic Technology Services HomeServicesClassesContactJobs
Help the Stat Consulting Group by giving a gift             
Loading

Stata Textbook Examples
Econometric Analysis of Cross Section and Panel Data by Jeffrey M. Wooldridge
Chapter 10: Basic Linear Unobserved Effects Panel Data Models

The data files used for the examples in this text can be downloaded in a zip file from the Stata Web site. You can then use a program such as WinZip to unzip the data files.
Example 10.4 on page 261 using jtrain1.dta.
use jtrain1, clear

xtreg lscrap d88 d89 union grant grant_1, i( fcode)

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

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

Random effects u_i ~ Gaussian                   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    -.3073937    .1204898
         d89 |  -.2698336   .1316496    -2.05   0.040     -.527862   -.0118052
       union |   .5478021    .410625     1.33   0.182    -.2570081    1.352612
       grant |   -.214696   .1477838    -1.45   0.146     -.504347    .0749549
     grant_1 |  -.3770698   .2053516    -1.84   0.066    -.7795515    .0254119
       _cons |   .4148333   .2434322     1.70   0.088    -.0622851    .8919518
-------------+----------------------------------------------------------------
     sigma_u |  1.3900287
     sigma_e |  .49774421
         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 on page 272 using jtrain1.dta.
xtreg lscrap d88 d89 union grant grant_1, i( fcode) fe

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

R-sq:  within  = 0.2010                         Obs per group: 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
       union |  (dropped)
       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) =    23.87             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) on page 276.
Notice that Stata does not calculate the robust standard errors for fixed effect models.
Example 10.6 on page 282 using jtrain1.dta.
use jtrain1, clear

tsset fcode year

       panel variable:  fcode, 410032 to 419486
        time variable:  year, 1987 to 1989

reg d.lscrap d89 d.grant d.grant_1

      Source |       SS       df       MS              Number of obs =     108
-------------+------------------------------           F(  3,   104) =    1.31
       Model |  1.31104125     3   .43701375           Prob > F      =  0.2739
    Residual |  34.5904876   104  .332600842           R-squared     =  0.0365
-------------+------------------------------           Adj R-squared =  0.0087
       Total |  35.9015288   107  .335528307           Root MSE      =  .57672

------------------------------------------------------------------------------
D.lscrap     |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
d89          |  -.0962081   .1254469    -0.77   0.445     -.344974    .1525578
grant        |
          D1 |   -.222781   .1307423    -1.70   0.091     -.482048    .0364859
grant_1      |
          D1 |  -.3512459   .2350848    -1.49   0.138     -.817428    .1149362
_cons        |  -.0906072   .0909695    -1.00   0.322    -.2710032    .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
Example 10.6 (continued) on page 283.
reg d.lscrap d89 d.grant d.grant_1

      Source |       SS       df       MS              Number of obs =     108
-------------+------------------------------           F(  3,   104) =    1.31
       Model |  1.31104125     3   .43701375           Prob > F      =  0.2739
    Residual |  34.5904876   104  .332600842           R-squared     =  0.0365
-------------+------------------------------           Adj R-squared =  0.0087
       Total |  35.9015288   107  .335528307           Root MSE      =  .57672

------------------------------------------------------------------------------
D.lscrap     |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
d89          |  -.0962081   .1254469    -0.77   0.445     -.344974    .1525578
grant        |
          D1 |   -.222781   .1307423    -1.70   0.091     -.482048    .0364859
grant_1      |
          D1 |  -.3512459   .2350848    -1.49   0.138     -.817428    .1149362
_cons        |  -.0906072   .0909695    -1.00   0.322    -.2710032    .0897888
------------------------------------------------------------------------------

predict u, res
(363 missing values generated)

reg u l.u

      Source |       SS       df       MS              Number of obs =      54
-------------+------------------------------           F(  1,    52) =    3.10
       Model |  .971328577     1  .971328577           Prob > F      =  0.0844
    Residual |  16.3125173    52  .313702256           R-squared     =  0.0562
-------------+------------------------------           Adj R-squared =  0.0380
       Total |  17.2838459    53    .3261103           Root MSE      =  .56009

------------------------------------------------------------------------------
u            |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
u            |
          L1 |   .2369063   .1346333     1.76   0.084    -.0332551    .5070678
_cons        |   3.30e-10   .0762188     0.00   1.000    -.1529441    .1529442
------------------------------------------------------------------------------

How to cite this page

Report an error on this page or leave a comment

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California