Part 5: Random Effects

advertisement
Part 5: Random Effects [ 1/54]
Econometric Analysis of Panel Data
William Greene
Department of Economics
Stern School of Business
Part 5: Random Effects [ 2/54]
Part 5: Random Effects [ 3/54]
Part 5: Random Effects [ 4/54]
Part 5: Random Effects [ 5/54]
Part 5: Random Effects [ 6/54]
MDE-5
How to combine two estimates of ED?
Year 1: .04757357 = b1 , standard error = .00539679 = s1 [Consistent]
Year 7: .05719350 = b 7 , standard error = .00659101 = s7 [Consistent]
 b1  ED   b 7  ED 
Minimize variance weighted: 
 +
 .
 .00539679   .00659101 
1
2

b




0  b1  ED 
 1
ED  s1
Equivalent to min: 
 

2 
b


b


0
s
ED  
ED 
 7
7  7
2
Solution: ˆ ED
1/s12
 w 1b 1 + w 7 b 7 , w 1  2
, w 7  1-w 1
2
1/s1 +1/s 7
2
Part 5: Random Effects [ 7/54]
The Random Effects Model

The random effects model
y it =x itβ+c i +εit , observation for person i at time t
y i =X iβ+c ii+ε i , Ti observations in group i
=X iβ+c i +ε i , note c i  (c i , c i ,...,c i )
y =Xβ+c +ε , Ni=1 Ti observations in the sample
c=(c1 , c2 ,...cN ), Ni=1 Ti by 1 vector

ci is uncorrelated with xit for all t;
E[ci |Xi] = 0
E[εit|Xi,ci]=0
Part 5: Random Effects [ 8/54]
Random vs. Fixed Effects

Random Effects




Fixed Effects





Small number of parameters
Efficient estimation
Objectionable orthogonality assumption (ci  Xi)
Robust – generally consistent
Large number of parameters
More reasonable assumption
Precludes time invariant regressors 
Which is the more reasonable model?
Part 5: Random Effects [ 9/54]
Error Components Model
Generalized Regression Model
y it  x it b+εit +ui
E[εit | X i ]  0
E[εit2 | X i ]  σ 2
E[ui | X i ]  0
E[ui2 | X i ]  σ u2
 2   u2
 u2

2
2
2




u

u
Var[ε i +uii ]  


2
2


u
u

y i =X iβ+ε i +uii for Ti observations
 u2
 u2




2
2
  u 
Part 5: Random Effects [ 10/54]
Notation
 y1   X1 
 ε1   u1i1  T1 observations
y  X 
 ε   u i  T observations
2
2
2
    β   2   2 2
   
  

   
  

y
X
ε
u
i
 N  N
 N   N N  TN observations
= Xβ+ε+u Ni=1 Ti observations
= Xβ+w
In all that follows, except where explicitly noted, X, X i
and x it contain a constant term as the first element.
To avoid notational clutter, in those cases, x it etc. will
simply denote the counterpart without the constant term.
Use of the symbol K for the number of variables will thus
be context specific but will usually include the constant term.
Part 5: Random Effects [ 11/54]
Notation
 2   u2
 u2

2
2
2




u

u
Var[ε i +uii ]  


2
 u2
 u
=  2I Ti   u2ii Ti  Ti
 u2
 u2





 2   u2 
=  2I Ti   u2ii
= Ωi
 Ω1
0
Var[w | X]  


0
0
Ω2
0
0
0  (Note these differ only

 in the dimension Ti )

ΩN 
  2I T   u2ii  IN
Part 5: Random Effects [ 12/54]
Regression Model-Orthogonality
1
X'w  0
# observations
1
1
N
plim N i=1 X i w i  plim N Ni=1 X i (ε i +uii)  0
i1 Ti
i1 Ti
plim
 N
X iε i
X iii 
N
plim N i=1 Ti
+ i=1 Tu

i i
i1 Ti 
Ti
Ti 
 N X iε i
X iii 
Ti
N
plim i=1 fi
+ i=1 fi
ui  , 0 < fi  N
<1
Ti
Ti
i1 Ti


1
 N X iε i

N
plim i=1 fi
+ i=1 fi x iui   0
Ti


1
=
if Ti  T  i
N
Part 5: Random Effects [ 13/54]
Convergence of Moments
X i X i
X X
N
 i1 fi
 a weighted sum of individual moment matrices
N
i1 T
Ti
X iΩi X i
X ΩX
N
 i1 fi
 a weighted sum of individual moment matrices
N
i1 T
Ti
=  2 Ni1fi
X i X i
  u2 Ni1fi x i x i
Ti
Note asymptotics are with respect to N. Each matrix
X i X i
is the
Ti
moments for the Ti observations. Should be 'well behaved' in micro
level data. The average of N such matrices should be likewise.
T or Ti is assumed to be fixed (and small).
Part 5: Random Effects [ 14/54]
Ordinary Least Squares

Standard results for OLS in a GR model




Consistent
Unbiased
Inefficient
True Variance
1
1
 X X  X ΩX  X X 




Ni1 Ti  Ni1 Ti  Ni1 Ti  Ni1 Ti 
 0   Q-1   Q *   Q-1
 0 as N   with our convergence assumptions
Var[b | X] 
1
Part 5: Random Effects [ 15/54]
Estimating the Variance for OLS
1
1
 X X   X ΩX   X X 
Var[b | X ]  N  N   N


i1 Ti  i1 Ti   i1 Ti   Ni1 Ti 
X iΩi X i
X ΩX
N
 i1 fi
, where = Ωi=E[w i w i | X i ]
N
i1 T
Ti
1
In the spirit of the White estimator, use
ˆ iw
ˆ i X i
X i w
X ΩX
N
ˆ i = y i - X ib
 i1 fi
, w
N
i1 T
Ti
Hypothesis tests are then based on Wald statistics.
THIS IS THE 'CLUSTER' ESTIMATOR
Part 5: Random Effects [ 16/54]
Mechanics
1
Est.Var[b | X ]  X X 

N
i1

1
ˆ iw
ˆ i X i X X 
X i w
ˆ i = set of Ti OLS residuals for individual i.
w
X i = Ti xK data on exogenous variable for individual i.
ˆ i = K x 1 vector of products
X i w
ˆ i )(w
ˆ i X i )  KxK matrix (rank 1, outer product)
(X i w


ˆ i  w
ˆ i X i  = sum of N rank 1 matrices. Rank  K.
Ni1  X i w
Part 5: Random Effects [ 17/54]
Cornwell and Rupert Data
Cornwell and Rupert Returns to Schooling Data, 595 Individuals, 7 Years
Variables in the file are
EXP
WKS
OCC
IND
SOUTH
SMSA
MS
FEM
UNION
ED
LWAGE
=
=
=
=
=
=
=
=
=
=
=
work experience, EXPSQ = EXP2
weeks worked
occupation, 1 if blue collar,
1 if manufacturing industry
1 if resides in south
1 if resides in a city (SMSA)
1 if married
1 if female
1 if wage set by unioin contract
years of education
log of wage = dependent variable in regressions
These data were analyzed in Cornwell, C. and Rupert, P., "Efficient Estimation with Panel
Data: An Empirical Comparison of Instrumental Variable Estimators," Journal of Applied
Econometrics, 3, 1988, pp. 149-155. See Baltagi, page 122 for further analysis. The data
were downloaded from the website for Baltagi's text.
Part 5: Random Effects [ 18/54]
Alternative OLS Variance Estimators
+---------+--------------+----------------+--------+---------+
|Variable | Coefficient | Standard Error |b/St.Er.|P[|Z|>z] |
+---------+--------------+----------------+--------+---------+
Constant
5.40159723
.04838934
111.628
.0000
EXP
.04084968
.00218534
18.693
.0000
EXPSQ
-.00068788
.480428D-04
-14.318
.0000
OCC
-.13830480
.01480107
-9.344
.0000
SMSA
.14856267
.01206772
12.311
.0000
MS
.06798358
.02074599
3.277
.0010
FEM
-.40020215
.02526118
-15.843
.0000
UNION
.09409925
.01253203
7.509
.0000
ED
.05812166
.00260039
22.351
.0000
Robust
Constant
5.40159723
.10156038
53.186
.0000
EXP
.04084968
.00432272
9.450
.0000
EXPSQ
-.00068788
.983981D-04
-6.991
.0000
OCC
-.13830480
.02772631
-4.988
.0000
SMSA
.14856267
.02423668
6.130
.0000
MS
.06798358
.04382220
1.551
.1208
FEM
-.40020215
.04961926
-8.065
.0000
UNION
.09409925
.02422669
3.884
.0001
ED
.05812166
.00555697
10.459
.0000
Part 5: Random Effects [ 19/54]
Generalized Least Squares
ˆ=[X Ω-1 X ]1 [X Ω-1 y ]
β
=[Ni1 X iΩi-1 X i ]1 [Ni1 X iΩi-1 y i ]
2



1
-1
u
Ωi  2 I Ti  2
ii
2
 
  Tiu 
(note, depends on i only through Ti )
Part 5: Random Effects [ 20/54]
Panel Data Algebra (1)
Ωi = σ 2ε I+σ u2ii, depends on 'i' because it is Ti  Ti
Ωi = σ 2ε [I + 2ii], 2 = σ u2 / σ 2ε
Ωi = σ 2ε [I + 2ii] = σ 2ε [A  bb], A=I, b=i.
Using (A-66) in Greene (p. 964)
Ω
-1
i
1
 2
σε
1
= 2
σε
1
 -1
-1
-1 

A
A
bb
A


1+bA -1b


2




σ
1
1
2
u
 ii = 2 I - 2
ii
I 2
2
 1+Ti
 σ ε  σ ε +Tσ
i u

Part 5: Random Effects [ 21/54]
Panel Data Algebra (2)
(Based on Wooldridge p. 286)
2
-1
2
2 i


Ωi  σ 2ε I+σ u2ii  σ 2ε I+Tσ
i(i
i)
i

σ
I
+Tσ
i u
ε
i uPD
2
i
 σ 2ε I+Tσ
(
I

M
i u
D)
2
i
i
2
2
2
 (σ 2ε +Tσ
)[
P


(
I

P
)],

=
σ
/(σ
+Tσ
i u
D
D
i
ε
ε
i u)
2
i
i
 (σ 2ε +Tσ
)[
P


M
i u
D
D]
2
 (σ 2ε +Tσ
i u )S i
S i1  PDi  (1 / i )MDi (Prove by multiplying. PDi MDi  0.)
S i1 / 2  PDi  (1 / i )MDi 
(Note S ia  PDi  iaMDi )
1
I  iPDi  , i =1- i
1  i
Part 5: Random Effects [ 22/54]
Panel Data Algebra (3)
Ωi1 / 2 

i
1
2  Tiu2
(PDi  (1 / i )MDi )
1
1
I  iPDi  ,
2  Tiu2 1  i
2

=1- 2

1

  Tiu2
2  Tiu2
Ωi1 / 2 
1
[I  iPDi ]

Var[Ωi1 / 2 (ε i  uii)]  2 I
Ωi1 / 2 y i  (1 /  )( y i  i y i .i) for the GLS transformation.
Part 5: Random Effects [ 23/54]
GLS (cont.)
GLS is equivalent to OLS regression of
y it *  y it  i y i. on x it *  x it  i x i .,
where i  1 

2  Tiu2
ˆ]  [XΩ-1 X]-1  2 [X * X*]-1
Asy.Var[β

Part 5: Random Effects [ 24/54]
Estimators for the Variances
y it  x it β  it  ui
Using the OLS estimator of β, bOLS ,
Ni1 tTi 1 (y it - a - x it b)2
  T  -1-K
N
i1
estimates 2  U2
i
With the LSDV estimates, ai and bLSDV ,
Ni1 tTi 1 (y it - ai - x it b)2
  T  -N-K
N
i1
estimates 2
i
Using the difference of the two,
 N  Ti (y - a - x  b)2   N  Ti (y - a - x  b)2 
it
it
 i1 t 1 it
   i1 t 1 it i
 estimates U2

 

Ni1 Ti -1-K
Ni1 Ti -N-K

 





Part 5: Random Effects [ 25/54]
Feasible GLS
Feasible GLS requires (only) consistent estimators of 2 and u2 .
Candidates:
Ti
N
2



2
i1 t 1 (y it  ai  x it bLSDV )
From the robust LSDV estimator: 
ˆ 
Ni1 Ti  K  N
Ni1 tTi 1 (y it  aOLS  x itbOLS )2
From the pooled OLS estimator: Est(   ) 
Ni1 Ti  K  1
2

2
u
Ni1 (y it  a  x ibMEANS )2
From the group means regression: Est( / T   ) 
N  K 1
ˆ it w
ˆ is
Ni1 tTi 11 sTi t 1 w
2
2
(Wooldridge) Based on E[w it w is | X i ]  u if t  s, 
ˆu 
Ni1 Ti  K  N
2

2
u
There are many others.
x´ does not contain a constant term in the preceding.
Part 5: Random Effects [ 26/54]
Practical Problems with FGLS
 The preceding regularly produce negative estimates of u2 .
 Estimation is made very complicated in unbalanced panels.
A bulletproof solution (originally used in TSP, now NLOGIT and others).
Ni1 tTi 1 (y it  ai  x itbLSDV )2
From the robust LSDV estimator: 
ˆ 
Ni1 Ti
2

Ni1 tTi 1 (y it  aOLS  x itbOLS )2
2
From the pooled OLS estimator: Est(   ) 


ˆ

Ni1 Ti
2

2
u
Ni1 tTi 1 (y it  aOLS  x itbOLS )2  Ni1 tTi 1 (y it  ai  x itbLSDV )2

0
ˆ 
Ni1 Ti
2
u
Part 5: Random Effects [ 27/54]
Stata Variance Estimators
Ni1 tTi 1 (y it  ai  x it bLSDV )2

> 0 based on FE estimates
ˆ 
Ni1 Ti  K  N
2

2


(N

K)

SSE(group
means)
ˆ
2



ˆ u  Max 0,
  0
NA
(N  A)T 

2
where A = K or if 
ˆ u is negative,
A=trace of a matrix that somewhat resembles IK .
Many other adjustments exist. None guaranteed to be
positive. No optimality properties or even guaranteed consistency.
Part 5: Random Effects [ 28/54]
Computing Variance Estimators
Using full list of variables (FEM and ED are time invariant)
OLS sum of squares = 522.2008.
Est(2 +u2 ) = 522.2008 / (4165 - 9) = 0.12565.
Using full list of variables and a generalized inverse (same
as dropping FEM and ED), LSDV sum of squares = 82.34912.
2

ˆ  = 82.34912 / (4165 - 8-595) = 0.023119.
2

ˆ u  0.12565 - 0.023119 = 0.10253
2
Both estimators are positive. We can stop here. If 
ˆ u were
negative, we would use estimators without DF corrections.
Part 5: Random Effects [ 29/54]
Application
+--------------------------------------------------+
| Random Effects Model: v(i,t) = e(i,t) + u(i)
|
| Estimates: Var[e]
=
.231188D-01 |
|
Var[u]
=
.102531D+00 |
|
Corr[v(i,t),v(i,s)] =
.816006
|
| (High (low) values of H favor FEM (REM).)
|
|
Sum of Squares
.141124D+04 |
|
R-squared
-.591198D+00 |
+--------------------------------------------------+
+---------+--------------+----------------+--------+---------+----------+
|Variable | Coefficient | Standard Error |b/St.Er.|P[|Z|>z] | Mean of X|
+---------+--------------+----------------+--------+---------+----------+
EXP
.08819204
.00224823
39.227
.0000
19.8537815
EXPSQ
-.00076604
.496074D-04
-15.442
.0000
514.405042
OCC
-.04243576
.01298466
-3.268
.0011
.51116447
SMSA
-.03404260
.01620508
-2.101
.0357
.65378151
MS
-.06708159
.01794516
-3.738
.0002
.81440576
FEM
-.34346104
.04536453
-7.571
.0000
.11260504
UNION
.05752770
.01350031
4.261
.0000
.36398559
ED
.11028379
.00510008
21.624
.0000
12.8453782
Constant
4.01913257
.07724830
52.029
.0000
Part 5: Random Effects [ 30/54]
Testing for Effects: An LM Test
Breusch and Pagan Lagrange Multiplier statistic
 0   u2
y it  x it  ui  it , ui and it ~ Normal   , 

 0  0
H0 : u2  0
2
  (Ti ei )

( Ti )
2
LM =

1



[1]


N
T
2
2i 1 Ti (Ti  1)    t 1 eit

N
i 1
2
N
i 1
N
i 1
2
2

NT  T  e
=
 1 if T is constant

2(T  1)    e

2
N
i 1
N
T
i 1 t 1
2
i
2
it
0 
2 
  
Part 5: Random Effects [ 31/54]
LM Tests
+--------------------------------------------------+
| Random Effects Model: v(i,t) = e(i,t) + u(i)
|
| Estimates: Var[e]
=
.216794D+02 |
|
Var[u]
=
.958560D+01 |
|
Corr[v(i,t),v(i,s)] =
.306592
|
| Lagrange Multiplier Test vs. Model (3) = 4419.33 |
| ( 1 df, prob value = .000000)
|
| (High values of LM favor FEM/REM over CR model.) |
| Baltagi-Li form of LM Statistic =
1618.75 |
+--------------------------------------------------+
+--------------------------------------------------+
| Random Effects Model: v(i,t) = e(i,t) + u(i)
|
| Estimates: Var[e]
=
.210257D+02 |
|
Var[u]
=
.860646D+01 |
|
Corr[v(i,t),v(i,s)] =
.290444
|
| Lagrange Multiplier Test vs. Model (3) = 1561.57 |
| ( 1 df, prob value = .000000)
|
| (High values of LM favor FEM/REM over CR model.) |
| Baltagi-Li form of LM Statistic =
1561.57 |
+--------------------------------------------------+
Unbalanced Panel
#(T=1) = 1525
#(T=2) = 1079
#(T=3) = 825
#(T=4) = 926
#(T=5) = 1051
#(T=6) = 1200
#(T=7) = 887
Balanced Panel
T = 7
REGRESS ; Lhs=docvis ; Rhs=one,hhninc,age,female,educ ; panel $
Part 5: Random Effects [ 32/54]
Testing for Effects: Moments
Wooldridge (page 265) suggests based on the off diagonal elements
Z=
T-1 T
Ni=1 t=1
s=t+1 eit eis

N
i=1

T-1
t=1

T
s=t+1
eit eis

2
d

 N[0,1]
which converges to standard normal. ("We are not assuming any
particular distribution for the it . Instead, we derive a similar test that
has the advantage of being valid for any distribution...") It's convenient
to examine Z 2 which, by the Slutsky theorem converges (also) to chisquared with one degree of freedom.
Part 5: Random Effects [ 33/54]
Testing (2)
T-1 T
 t=1
s=t+1 eit eis = 1/2 of the sum of all off diagonal elements of
of ei e i or 1/2 the sum of all the elements minus the diagonal elements.
T-1 T
 t=1
s=t+1 eit eis =1/2[i(ei ei)i  eiei ]. But, ie i = T ei . So,
T-1 T
 t=1
s=t+1 eit eis = (1/2)[(T ei )2  eiei ]
Z
2



Ni 1 [(T ei )2  eiei ]
Ni 1 [(T ei )2  eiei ]2
2
[Ni 1 eiei ]2
2(T  1)
 LM 
NT Ni 1 [(T ei )2  eiei ]2
Note, also
Z=
Ni 1ri
Ni 1ri2

N r
, where ri  (T ei )2  eiei .
sr
Part 5: Random Effects [ 34/54]
Testing for Effects
? Obtain OLS residuals
Regress; lhs=lwage;rhs=fixedx,varyingx;res=e$
? Vector of group sums of residuals
Calc
; T = 7 ; Groups = 595
Matrix ; tebar=T*gxbr(e,person)$
? Direct computation of LM statistic
Calc
; list;lm=Groups*T/(2*(T-1))*
(tebar'tebar/sumsqdev - 1)^2$
? Wooldridge chi squared (N(0,1) squared)
Create ; e2=e*e$
Matrix ; e2i=T*gxbr(e2,person)$
Matrix ; ri=dirp(tebar,tebar)-e2i ; sumri=ri'1$
Calc
; list;z2=(sumri)^2/ri'ri$
LM
Z2
= .37970675705025540D+04
= .16533465085356830D+03
Part 5: Random Effects [ 35/54]
Two Way Random Effects Model
y it  x it   ui  v t  it
How to estimate the variance components?
(1) Two way FEM residual variance estimates 2
(2) Simple OLS residual variance estimates 2  u2  2v
(3) There are numerous ways to get a third equation.
E.g., the one way FEM residual variance in either dimension
One way FEM based on groups estimates (2  2v ) / (1  1 / T)
E.g., the group mean regressions in either dimension.
Based on group means estimates u2  (2  2v )/T
(Period means regression may have a tiny number of observations.)
(And a whole library of others - see Baltagi, sec. 3.3.)
Negative estimators of common variances are common.
Solutions are complicated.
Part 5: Random Effects [ 36/54]
One Way REM
Part 5: Random Effects [ 37/54]
Two Way REM
Note sum
= .102705
Part 5: Random Effects [ 38/54]
Hausman Test for FE vs. RE
Estimator
FGLS
(Random Effects)
LSDV
(Fixed Effects)
Random Effects
E[ci|Xi] = 0
Consistent and
Efficient
Fixed Effects
E[ci|Xi] ≠ 0
Inconsistent
Consistent
Inefficient
Consistent
Possibly Efficient
Part 5: Random Effects [ 39/54]
Hausman Test for Effects
ˆ -β
ˆ
Basis for the test, β
FE
RE
ˆ -β
ˆ ;W=q
ˆ=β
ˆ[Var(q
ˆ)]-1q
ˆ
Wald Criterion: q
FE
RE
A lemma (Hausman (1978)): Under the null hypothesis (RE)
d
ˆ - β] 
nT[β
 N[0,VRE ] (efficient)
RE
d
ˆ - β] 
nT[β
 N[0,VFE ] (inefficient)
FE
ˆ - β)-(β
ˆ  β). The lemma states that in the
ˆ = (β
Note: q
FE
RE
joint limiting distribution of
ˆ - β] and
nT[β
RE
ˆ , the
nT q
limiting covariance, C Q,RE is 0. But, C Q,RE = CFE,RE - VRE . Then,
 . Using the lemma, CFE,RE = VRE .
Var[q] = VFE + VRE - CFE,RE - CFE,RE
It follows that Var[q]=VFE - VRE . Based on the preceding
ˆ -β
ˆ ) [Est.Var(β
ˆ ) - Est.Var(β
ˆ )]-1 (β
ˆ -β
ˆ )
H=(β
FE
RE
FE
RE
FE
RE
β does not contain the constant term in the preceding.
Part 5: Random Effects [ 40/54]
Computing the Hausman Statistic
 N

1  
2
ˆ
Est.Var[βFE ]  
ˆ  i1 Xi  I  ii  X i 
Ti  


1
-1
2
 N



T


ˆ
ˆ
2
i
u
i
ˆ ]
Est.Var[β
 1
ˆ  i1 Xi  I  ii  X i  , 0  ˆ i = 2
RE
2
T


T

ˆ


i
 
iˆu
2
2
ˆ ]  Est.Var[β
ˆ ]
As long as 
ˆ  and 
ˆ u are consistent, as N  , Est.Var[β
FE
RE
will be nonnegative definite. In a finite sample, to ensure this, both must
2
be computed using the same estimate of 
ˆ  . The one based on LSDV will
generally be the better choice.
ˆ ] if there are time
Note that columns of zeros will appear in Est.Var[β
FE
invariant variables in X.
β does not contain the constant term in the preceding.
Part 5: Random Effects [ 41/54]
Part 5: Random Effects [ 42/54]
Part 5: Random Effects [ 43/54]
Hausman Test?
What went wrong?
The matrix is not positive definite.
It has a negative characteristic root.
The matrix is indefinite.
(Software such as Stata and
NLOGIT find this problem and
refuse to proceed.)
Properly, the statistic cannot be
computed.
The naïve calculation came out
positive by the luck of the draw.
Part 5: Random Effects [ 44/54]
A Variable Addition Test



Asymptotically equivalent to Hausman
Also equivalent to Mundlak formulation
In the random effects model, using FGLS



Only applies to time varying variables
Add expanded group means to the regression (i.e.,
observation i,t gets same group means for all t.
Use standard F or Wald test to test for coefficients
on means equal to 0. Large F or chi-squared weighs
against random effects specification.
Part 5: Random Effects [ 45/54]
Variable Addition
A Fixed Effects Model
yit  i  xit  it
LSDV estimator - Deviations from group means:
To estimate , regress (yit  yi ) on (xit  xi )
Algebraic equivalent: OLS regress yit on (xit , xi )
Mundlak interpretation: i    xi  u i
Model becomes yit    xi  u i  xit  it
=   xi  xit  it  u i
 a random effects model with the group means.
Estimate by FGLS.
Part 5: Random Effects [ 46/54]
Application: Wu Test
NAMELIST
create ;
create ;
create ;
create ;
create ;
create ;
create ;
create ;
create ;
namelist
; XV = exp,expsq,wks,occ,ind,south,smsa,ms,union,ed,fem$
expb=groupmean(exp,pds=7)$
expsqb=groupmean(expsq,pds=7)$
wksb=groupmean(wks,pds=7)$
occb=groupmean(occ,pds=7)$
indb=groupmean(ind,pds=7)$
southb=groupmean(south,pds=7)$
smsab=groupmean(smsa,pds=7)$
unionb=groupmean(union,pds=7)$
msb = groupmean(ms,pds=7) $
; xmeans = expb,expsqb,wksb,occb,indb,southb,smsab,msb,
unionb $
REGRESS ; Lhs = lwage ; Rhs = xmeans,Xv,one ; panel ; random $
MATRIX ; bmean = b(1:9) ; vmean = varb(1:9,1:9) $
MATRIX ; List ; Wu = bmean'<vmean>bmean $
Part 5: Random Effects [ 47/54]
Means Added
Part 5: Random Effects [ 48/54]
Wu (Variable Addition) Test
Part 5: Random Effects [ 49/54]
Basing Wu Test on a Robust VC
? Robust Covariance matrix for REM
Namelist ; XWU = wks,occ,ind,south,smsa,union,exp,expsq,ed,blk,fem,
wksb,occb,indb,southb,smsab,unionb,expb,expsqb,one $
Create ; ewu = lwage - xwu'b $
Matrix ; Robustvc = <Xwu'Xwu>*Gmmw(xwu,ewu,_stratum)*<XwU'xWU>
; Stat(b,RobustVc,Xwu) $
Matrix ; Means = b(12:19);Vmeans=RobustVC(12:19,12:19)
; List ; RobustW=Means'<Vmeans>Means $
Part 5: Random Effects [ 50/54]
Robust Standard Errors
Part 5: Random Effects [ 51/54]
Fixed vs. Random Effects
 N

ˆ i,Model  
ˆ
βModel  i1 X i  I 
ii  X i 
Ti


 
ˆModel  1 for fixed effects.
ˆ i,Model 
-1
 N

ˆ i,Model  
ii  y i 
i1 X i  I 
Ti


 
2
Ti
ˆu
for random effects.
2
2

ˆ   Ti
ˆu
As Ti  , ˆ i,RE  1, random effects becomes fixed effects
2
As 
ˆ u  0, ˆ i,RE  0, random effects becomes OLS (of course)
2
As 
ˆ u  , ˆ i,RE  1, random effects becomes fixed effects
2
2
For the C&R application, 
ˆ u =.133156, 
ˆ  =.0235231, ˆ  .975384.
Looks like a fixed effects model. Note the Hausman statistic agrees.
β does not contain the constant term in the preceding.
Part 5: Random Effects [ 52/54]
Another Comparison (Baltagi p. 20)
ˆGLS  W
ˆLSDV(Within)  (I  W)
ˆBetween

Limiting and Special Cases
(1) If u2  0, GLS = OLS
ˆLSDV(Within)
(2) As T  , GLS  
ˆGLS  
ˆLSDV(Within)
(3) As between variation  0, 
ˆGLS  
ˆBetween
(4) As within variation  0, 
Part 5: Random Effects [ 53/54]
A Hierarchical Linear Model
Interpretation of the FE Model
y it  x it β  c i +εit , (x does not contain a constant)
E[εit|X i , c i ]  0, Var[ε it|X i , c i ]=2
c i  +ziδ + ui ,
E[u|i zi ]  0, Var[u|i zi ]  u2
y it  x it β  [  ziδ  ui ]  εit
Part 5: Random Effects [ 54/54]
Hierarchical Linear Model as REM
+--------------------------------------------------+
| Random Effects Model: v(i,t) = e(i,t) + u(i)
|
| Estimates: Var[e]
=
.235368D-01 |
|
Var[u]
=
.110254D+00 |
|
Corr[v(i,t),v(i,s)] =
.824078
|
|
Sigma(u)
= 0.3303
|
+--------------------------------------------------+
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
OCC
|
-.03908144
.01298962
-3.009
.0026
.51116447
SMSA
|
-.03881553
.01645862
-2.358
.0184
.65378151
MS
|
-.06557030
.01815465
-3.612
.0003
.81440576
EXP
|
.05737298
.00088467
64.852
.0000
19.8537815
FEM
|
-.34715010
.04681514
-7.415
.0000
.11260504
ED
|
.11120152
.00525209
21.173
.0000
12.8453782
Constant|
4.24669585
.07763394
54.702
.0000
Part 5: Random Effects [ 55/54]
Evolution: Correlated Random Effects
Unknown parameters
yit  i  xit  it ,   [1 ,  2 ,...,  N , ,  2 ]
Standard estimation based on LS (dummy variables)
Ambiguous definition of the distribution of yit
Effects model, nonorthogonality, heterogeneity
yit  i  xit  it , E[ i | Xi ]  g( Xi )  0
Contrast to random effects E[i | X i ]  
Standard estimation (still) based on LS (dummy variables)
Correlated random effects, more detailed model
yit  i  xit  it , P[ i | Xi ]  g( Xi )  0
Linear projection?  i  xi  u i Cor(u i , xi )  0
Part 5: Random Effects [ 56/54]
Mundlak’s Estimator
Mundlak, Y., “On the Pooling of Time Series and Cross Section
Data, Econometrica, 46, 1978, pp. 69-85.
Write c i = x iδ  ui , E[c i | x i1 , x i1 ,...x iTi ] = x iδ
Assume c i contains all time invariant information
y i =X iβ+c ii+ε i , Ti observations in group i
=X iβ+ix iδ+ε i + uii
Looks like random effects.
Var[ε i + uii]=Ωi +σ 2uii
This is the model we used for the Wu test.
Part 5: Random Effects [ 57/54]
Correlated Random Effects
Mundlak
c i = x iδ  ui , E[c i | x i1 , x i1 ,...x iTi ] = x iδ
Assume c i contains all time invariant information
y i =X iβ+c ii+ε i , Ti observations in group i
=X iβ+ix iδ+ε i + uii
Chamberlain / Wooldridge
c i = x i1δ1  x i2 δ2  ...  x iT δ T  ui
y i =X iβ  ix i1δ1  ix i1δ2  ...  ix iT δ T  iui +ε i
TxK  TxK  TxK 
TxK etc.
Problems: Requires balanced panels
Modern panels have large T; models have large K
Part 5: Random Effects [ 58/54]
Mundlak’s Approach for an FE Model
with Time Invariant Variables
y it  x itβ+ziδ  c i +εit , (x does not contain a constant)
E[εit|X i , c i ]  0, Var[ε it|X i , c i ]=2
c i  + x iθ + w i ,
E[w i|X i , zi ]  0, Var[w i|X i , zi ]  2w
y it  x itβ  ziδ    x iθ  w i  εit
 random effects model including group means of
time varying variables.
Part 5: Random Effects [ 59/54]
Mundlak Form of FE Model
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
x(i,t)=================================================================
OCC
|
-.02021384
.01375165
-1.470
.1416
.51116447
SMSA
|
-.04250645
.01951727
-2.178
.0294
.65378151
MS
|
-.02946444
.01915264
-1.538
.1240
.81440576
EXP
|
.09665711
.00119262
81.046
.0000
19.8537815
z(i)===================================================================
FEM
|
-.34322129
.05725632
-5.994
.0000
.11260504
ED
|
.05099781
.00575551
8.861
.0000
12.8453782
Means of x(i,t) and constant===========================================
Constant|
5.72655261
.10300460
55.595
.0000
OCCB
|
-.10850252
.03635921
-2.984
.0028
.51116447
SMSAB
|
.22934020
.03282197
6.987
.0000
.65378151
MSB
|
.20453332
.05329948
3.837
.0001
.81440576
EXPB
|
-.08988632
.00165025
-54.468
.0000
19.8537815
Variance Estimates=====================================================
Var[e]|
.0235632
Var[u]|
.0773825
Download