You are on page 1of 4

Econometric Analysis of Cross Section and Panel Data by Jeffrey M.

Wooldridge
Chapter 10: Basic Linear Unobserved Effects Panel Data Models
STATA Exercise
The data files used for the examples in this text can be downloaded in a zip file from the
http://www.stata.com/texts/eacsap/ or giving commands on your STATA while your are connected to internet as
below:
net from http://www.stata.com/data/jwooldridge/
net describe eacsap
net get eacsap

Example 10.4 on page 261 using jtrain1.dta.


RE Estimation of the Effects of Job Training Grants: We now use the data in JTRAIN1.RAW to estimate the effect of
job training grants on firm scrap rates, using a random effects analysis. There are 54 firms that reported scrap
rates for each of the years 1987, 1988, and 1989. Grants were not awarded in 1987. Some firms received grants in
1988, others received grants in 1989, and a firm could not receive a grant twice. Since there are firms in 1989 that
received a grant only in 1988, it is important to allow the grant effect to persist one period. The estimated equation is

log scrap 0.415 0.93 d 88 0.27 0d 89 0.548 union 0.215 grant 0.377 grant1
0.243

0.109

0.132

0.411

0.148

0.205

The lagged value of grant has the larger impact and is statistically significant at the 5 percent level against a onesided alternative. You are invited to estimate the equation without grant_1 to verify that the estimated grant effect is
much smaller (on the order of 6.7 percent) and statistically insignificant.
use jtrain1, clear
xtreg lscrap d88 d89 union grant grant_1, i( fcode)
Random-effects GLS regression
Group variable (i): fcode

Number of obs
Number of groups

=
=

162
54

R-sq:

Obs per group: min =


avg =
max =

3
3.0
3

within = 0.2006
between = 0.0206
overall = 0.0361

Random effects u_i ~ Gaussian


corr(u_i, X)
= 0 (assumed)

Wald chi2(5)
Prob > chi2

=
=

26.99
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)
------------------------------------------------------------------------------

edipambudi@hotmail.com

Page 1

test grant grant_1


( 1)
( 2)

grant = 0
grant_1 = 0
chi2( 2) =
Prob > chi2 =

3.66
0.1601

Example 10.5 on page 272 using jtrain1.dta.


FE Estimation of the Effects of Job Training Grants: Using the data in JTRAIN1.RAW, we estimate the effects of job
training grants using the fixed effects estimator. The variable union has been dropped because it does not vary over
time for any of the firms in the sample. The estimated equation with standard errors is

log scrap 0.080 d 88 0.247 d 89 0.252 grant 0.422 grant1


0.109

0.133

0.151

0.210

Compared with the random effects, the grant is estimated to have a larger effect, both contemporaneously and
lagged one year. The t statistics are also somewhat more significant with fixed effects.
xtreg lscrap d88 d89 union grant grant_1, i( fcode) fe
Fixed-effects (within) regression
Group variable (i): fcode

Number of obs
Number of groups

=
=

162
54

R-sq:

Obs per group: min =


avg =
max =

3
3.0
3

within = 0.2010
between = 0.0079
overall = 0.0068

corr(u_i, Xb)

F(4,104)
Prob > F

= -0.0714

=
=

6.54
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)
( 2)

grant = 0
grant_1 = 0
F(

2,
104) =
Prob > F =

edipambudi@hotmail.com

2.23
0.1127

Page 2

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
FD Estimation of the Effects of Job Training Grants: We now estimate the effect of job training grants on

log( scrap
) using first differencing. Specifically, we use pooled OLS on

log( scrapit ) 1 2 d 89t 1grantit 2 grantit 1 it


Rather than difference the year dummies and omit the intercept, we simply include an intercept and a dummy
variable for 1989 to capture the aggregate time effects. If we were specifically interested in the year effects from the
structural model (in levels), then we should difference those as well. The estimated equation is

log( scrapit ) 0.91 0.096 d 89t 0.223 grantit 0.351 grantit 1


0.91(0.088)

0.125(0.111)

0.131(0.128)

0.235(0.265)

where the usual standard errors are in parentheses and the robust standard errors are in brackets. We report
R2 0.037 here because it has a useful interpretation: it measures the amount of variation in the growth in the
scrap rate that is explained by grantt and grantt 1 (and d 89 ). The estimates on grantt and grantt 1 are
fairly similar to the fixed effect estimates, although is now statistically grantt more significant than grantt 1 .
The usual F test for joint significance of grantt and grantt 1 is 1.53 with p-value=222.
use jtrain1, clear
tsset fcode year
panel variable:
time variable:

fcode, 410032 to 419486


year, 1987 to 1989

reg d.lscrap d89 d.grant d.grant_1


Source |
SS
df
MS
-------------+-----------------------------Model | 1.31104125
3
.43701375
Residual | 34.5904876
104 .332600842
-------------+-----------------------------Total | 35.9015288
107 .335528307

Number of obs
F( 3,
104)
Prob > F
R-squared
Adj R-squared
Root MSE

=
=
=
=
=
=

108
1.31
0.2739
0.0365
0.0087
.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)
( 2)

D.grant = 0
D.grant_1 = 0

edipambudi@hotmail.com

Page 3

F(

2,
104) =
Prob > F =

1.53
0.2215

Example 10.6 (continued) on page 283.


We test for AR(1) serial correlation in the first-differenced equation by regressing it on it 1 using the year 1989.
We get t 0.237 with t statistic = 1.76. There is marginal evidence of positive serial correlation in the first
differences it . Further, 1 0.237 is very different from 1 0.5 , which is implied by the standard random
and fixed effects assumption that the it are serially uncorrelated.
reg d.lscrap d89 d.grant d.grant_1
Source |
SS
df
MS
-------------+-----------------------------Model | 1.31104125
3
.43701375
Residual | 34.5904876
104 .332600842
-------------+-----------------------------Total | 35.9015288
107 .335528307

Number of obs
F( 3,
104)
Prob > F
R-squared
Adj R-squared
Root MSE

=
=
=
=
=
=

108
1.31
0.2739
0.0365
0.0087
.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
-------------+-----------------------------Model | .971328577
1 .971328577
Residual | 16.3125173
52 .313702256
-------------+-----------------------------Total | 17.2838459
53
.3261103

Number of obs
F( 1,
52)
Prob > F
R-squared
Adj R-squared
Root MSE

=
=
=
=
=
=

54
3.10
0.0844
0.0562
0.0380
.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
------------------------------------------------------------------------------

edipambudi@hotmail.com

Page 4