Professional Documents
Culture Documents
The Two-Way Error Component Regression Model
The Two-Way Error Component Regression Model
The Two-Way Error Component Regression Model
Model
Badi H. Baltagi
Introduction
Fixed effects
Random effects
Prediction
Example(s)
Two-way Error Component
• i = 1, . . . , N, individual, cross-section,
• t = 1, . . . , T , time-series
• K explanatory variables
• µi , individual effect N
P
i=1 µi = 0
I λt time effect not included in the regression:
I strike year
I oil embargo
I laws restricting smoking
PT
t=1 λt =0
Wallace and Hussain (1969), Nerlove (1971) and Amemiya (1971)
Vector form
u = Zµ µ + Zλ λ + ν (3)
I Zλ Zλ0 = JN ⊗ IT
I JN matrix of ones, dim N
I Zλ (Zλ0 Zλ )−1 Zλ0 = J̄N ⊗ IT projection matrix
I J̄N = JN /N
PN
I (J̄N ⊗ IT )y predicted values: ȳ.t = i=1 yit /N
Fixed effects
I µi and λt fixed parameters
I νit ∼ IID(0, σν2 )
I Xit independent of νit for all i and t
β̃ = (X 0 QX )−1 X 0 Qy (5)
I α̃ = ȳ.. − β̃ x̄..
I µ̃i = (ȳi. + ȳ.. ) − β̃(x̄i. + x̄.. )
I λ̃t = (ȳ.t + ȳ.. ) − β̃(x̄.t + x̄.. )
I Within estimator can not estimate the effect of time- and individual-
invariant variables since Q transformation wipes out these variables
I if estimating (5) with the standard regression package to get the
proper variance-covariance matrix one needs to divide the estimated
one by (NT − N − T + 1 − K ) and multiply by (NT − K )
Testing for fixed effects
I joint significance of the dummy variables
H0 : µ i = 0 and λt = 0
(RRSS − URSS)/(N + T − 2)
F1 = ∼ F(N+T −2),(NT −N−T +1−K )
URSS/(NT − N − T + 1 − K )
2
σ + σλ2 + σν2 i = j, s =t
µ2
σµ i = j, s 6= t
cov (uit , ujs ) = 2 (7)
σλ
i 6= j, s =t
0 i 6= j, s 6= t
2 T ((E +J̄ )⊗J̄ )+σ 2 N(J̄ ⊗(E +J̄ ))+σ 2 ((E +J̄ )⊗(E +J̄ ))
Ω = σµ N N T λ N T T ν N N T T
Matrix spectral decomposition
4
X
Ω= λi Qi (8)
i=1
i λi Qi # λi
1 σν2 EN ⊗ ET NT − N − T + 1
2 T σµ2 + σν2 EN ⊗ J̄T N −1
3 2
Nσλ + σν 2 J̄N ⊗ ET T −1
4 T σµ2 + Nσλ2 + σν2 J̄N ⊗ J̄T 1
4
X
Ωr = λri Qi (9)
i=1
Transformation
4
1/2
X
−1/2
σν Ω = (σν /λi )Qi (10)
i=i
1/2
I θ1 = 1 − (σν /λ2 )
1/2
I θ2 = 1 − (σν /λ3 )
1/2
I θ3 = θ1 + θ2 + (σν /λ4 ) − 1
√ 2 2
2σν4
√NT (σ̂2ν − σ2ν ) 0 0
∼ N 0, 0 2σµ4
√N(σ̂µ2 − σµ2 )
0 (12)
T (σ̂λ − σλ ) 0 0 2σλ4
I both OLS and Within residuals introduces bias into estimates. the
correction of df depend upon traces given by authors
Three LS regressions
Q1 y Q1 X Q1 u
Q2 y = Q2 X β + Q2 u (14)
Q3 y Q3 X Q3 u
since Qi ιNT = 0 and the transformed error has mean 0 and
covariance matrix diag [λi Qi ] for i = 1, 2, 3
∂ log L
= Z 0 Ω−1 y − (Z 0 Ω−1 Z )γ = 0 (17)
∂γ
∂ log L
= −1/2tr Ω−1 + 1/2u 0 Ω−2 u = 0
∂σν2
∂ log L
= −1/2tr Ω−1 (IN ⊗ JT ) + 1/2u 0 Ω−2 (IN ⊗ JT )u = 0
∂σµ2
∂ log L
= −1/2tr Ω−1 (JN ⊗ IT ) + 1/2u 0 Ω−2 (JN ⊗ IT )u = 0
∂σλ2
LL(α, β, σν2 , φ22 , φ23 ) ∝ −(NT /2) log σν2 + (N/2) log φ22 + (18)
+(T /2) log φ23 − (1/2) log[φ22 + φ23 − φ22 φ23 ] − 1/(2σν2 )u 0 Σ−1 u
LLC (β, φ22 , φ23 ) ∝ −(NT /2) log[d 0 (Q1 + φ22 Q2 + φ23 Q3 )d] + (19)
+(N/2) log φ22 + (T /2) log φ23 − (1/2) log[φ22 + φ23 − φ22 φ23 ]
Maximizing iteration
maximizing LLC over β, given φ22 and φ23
∂ log L NT d 0 Q2 d N 1 1 (1 − φ23 )
= − + −
∂σλ2 2 d 0 [Q1 + φ22 Q2 + φ23 Q3 ]d 2 φ22 2 [φ22 + φ23 − φ22 φ23 ]
(21)
can be expressed as
is the unique positive root since a < 0 and c > 0 (Baltagi, Li:
1992)
and since φ23 is fixed using Q̂1 = Q1 + φ23 Q3 :
4
" #
0 −1
X 1
wΩ = σµ2 (li0 ⊗ ι0T ) Qi (27)
λi
i=1
σµ2 0 σµ2 0
= (li ⊗ ι0T ) − ι0NT /N + (ι /N) (28)
λ2 λ4 NT
T σµ2 T σµ2
( ¯i.,GLS − û¯..,GLS ) +
û û¯..,GLS (29)
T σµ2 + σν2 T σµ2 + Nσλ2 + σν2
T σµ2
¯ 2 1 1 ¯
or ûi.,GLS + T σµ − û..,GLS
T σµ2 + σν2 λ4 λ2
if Z contains a constant, than ι0NT Ω−1 ûGLS = 0 and using
ι0NT Ω−1 = ι0NT /λ4 one gets û¯..,GLS = 0 and the BLUP corrects the
GLS prediction by a fraction of the mean of GLS residuals of ith
individual
!
T σµ2
ŷi,T +S = Zi,T +S δ̂GLS + û¯i.,GLS (30)
T σµ2 + σν2
Software
I OLS
I Within estimator
I Swamy and Arora (1972)
I Wallace and Hussain (1969)
I Amemiya (1971)
negative variance estimates indicates zero or small value
Public capital productivity
ln Y = α + β1 ln K1 + β2 ln K2 + β3 ln l + β4 U + u (31)
Call :
plm ( f o r m u l a = l o g ( g s p ) ˜ l o g ( pcap ) + l o g ( pc ) + l o g ( emp ) + unemp ,
d a t a = Produc , e f f e c t = ” twoways ” , model = ” p o o l i n g ” ,
i n d e x = c (” s t a t e ” , ” y e a r ”))
Residuals :
Min . 1 s t Qu . Median 3 r d Qu . Max .
−0.232000 −0.061000 −0.000102 0.050900 0.351000
Coefficients :
E s t i m a t e Std . E r r o r t−v a l u e Pr ( >| t | )
( Intercept ) 1.6433023 0.0575873 28.5359 < 2 . 2 e −16 ∗∗∗
l o g ( pcap ) 0.1550070 0.0171538 9.0363 < 2 . 2 e −16 ∗∗∗
l o g ( pc ) 0.3091902 0.0102720 30.1003 < 2 . 2 e −16 ∗∗∗
l o g ( emp ) 0.5939349 0.0137475 43.2032 < 2 . 2 e −16 ∗∗∗
unemp −0.0067330 0 . 0 0 1 4 1 6 4 −4.7537 2 . 3 6 3 e −06 ∗∗∗
−−−
S i g n i f . codes : 0 ∗∗∗ 0 . 0 0 1 ∗∗ 0.01 ∗ 0.05 . 0.1 1
T o t a l Sum o f S q u a r e s : 849.81
R e s i d u a l Sum o f S q u a r e s : 6 . 2 9 4 2
R−S q u a r e d : 0.99259
Adj . R−S q u a r e d : 0.98651
F− s t a t i s t i c : 2 7 1 7 1 . 7 on 4 and 811 DF , p−v a l u e : < 2 . 2 2 e −16
Twoways e f f e c t s W i t h i n Model
Call :
plm ( f o r m u l a = l o g ( g s p ) ˜ l o g ( pcap ) + l o g ( pc ) + l o g ( emp ) + unemp ,
d a t a = Produc , e f f e c t = ” twoways ” , model = ” w i t h i n ” ,
i n d e x = c (” s t a t e ” , ” y e a r ”))
Residuals :
Min . 1 s t Qu . Median 3 r d Qu . Max .
−0.160000 −0.018000 −0.000859 0.016700 0.171000
Coefficients :
E s t i m a t e Std . E r r o r t−v a l u e Pr ( >| t | )
l o g ( pcap ) −0.0301761 0 . 0 2 6 9 3 6 5 −1.1203 0.2629606
l o g ( pc ) 0.1688280 0.0276563 6.1045 1 . 6 5 5 e −09 ∗∗∗
l o g ( emp ) 0.7693062 0.0281418 27.3368 < 2 . 2 e −16 ∗∗∗
unemp −0.0042211 0 . 0 0 1 1 3 8 8 −3.7065 0 . 0 0 0 2 2 5 7 ∗∗∗
−−−
S i g n i f . codes : 0 ∗∗∗ 0 . 0 0 1 ∗∗ 0 . 0 1 ∗ 0.05 . 0.1 1
T o t a l Sum o f S q u a r e s : 3.5889
R e s i d u a l Sum o f S q u a r e s : 0 . 8 7 9 4 4
R−S q u a r e d : 0.75496
Adj . R−S q u a r e d : 0.69204
F− s t a t i s t i c : 5 7 6 . 1 3 4 on 4 and 748 DF , p−v a l u e : < 2 . 2 2 e −16
Twoways e f f e c t s Random E f f e c t Model
( Swamy−A r o r a ’ s t r a n s f o r m a t i o n )
Call :
plm ( f o r m u l a = l o g ( g s p ) ˜ l o g ( pcap ) + l o g ( pc ) + l o g ( emp ) + unemp ,
d a t a = Produc , e f f e c t = ” twoways ” , model = ” random ” ,
random . method = ” s w a r ” , i n d e x = c ( ” s t a t e ” , ” y e a r ” ) )
Effects :
var s t d . dev s h a r e
i d i o s y n c r a t i c 1 . 1 7 6 e −03 3 . 4 2 9 e −02 0 . 1 4 5
individual 6 . 8 5 4 e −03 8 . 2 7 9 e −02 0 . 8 4 3
time 9 . 6 8 1 e −05 9 . 8 3 9 e −03 0 . 0 1 2
theta : 0.9001 ( i d ) 0.5506 ( time ) 0.5487 ( t o t a l )
Residuals :
Min . 1 s t Qu . Median 3 r d Qu . Max .
−0.12400 −0.02150 −0.00177 0.01970 0.19700
Coefficients :
E s t i m a t e Std . E r r o r t−v a l u e Pr ( >| t | )
( Intercept ) 2.3634993 0.1389056 17.0151 < 2 . 2 e −16 ∗∗∗
l o g ( pcap ) 0.0178529 0.0233207 0.7655 0.4442
l o g ( pc ) 0.2655895 0.0209824 12.6577 < 2 . 2 e −16 ∗∗∗
l o g ( emp ) 0.7448989 0.0241144 30.8902 < 2 . 2 e −16 ∗∗∗
unemp −0.0045755 0 . 0 0 1 0 1 7 9 −4.4952 7 . 9 6 2 e −06 ∗∗∗
−−−
S i g n i f . codes : 0 ∗∗∗ 0.001 ∗∗ 0.01 ∗ 0.05 . 0.1 1
T o t a l Sum o f S q u a r e s : 14.989
R e s i d u a l Sum o f S q u a r e s : 1 . 0 1 7 5
R−S q u a r e d : 0.93212
Adj . R−S q u a r e d : 0.9264
F− s t a t i s t i c : 2 7 8 3 . 9 4 on 4 and 811 DF , p−v a l u e : < 2 . 2 2 e −16
Amemiya, T., 1971, The estimation of the variances in a
variance-components model, International Economic Review
12, 113.
Baltagi, B.H. and Q. Li, 1992, A monotonic property for
iterative GLS in the two-way random effects model, Journal of
Econometrics 53, 4551
Blanchard, P., 1996, Software review, Chapter 33 in L. Mtys
and P. Sevestre, eds., The Econometrics of Panel Data: A
Handbook of the Theory With Applications (Kluwer Academic
Publishers, Dordrecht), 879913.
Fuller, W.A. and G.E. Battese, 1974, Estimation of linear
models with cross-error structure, Journal of Econometrics 2,
6778.
Graybill, F.A., 1961, An Introduction to Linear Statistical
Models (McGraw-Hill, New York).
Munnell, A., 1990, Why has productivity growth declined?
Productivity and public investment, New England Economic
Review, 322.
Nerlove, M., 1971, A note on error components models,
Econometrica 39, 383396.
Swamy, P.A.V.B. and S.S. Arora, 1972, The exact finite
sample properties of the estimators of coefficients in the error
components regression models, Econometrica 40, 261275.
Wallace, T.D. and A. Hussain, 1969, The use of error
components models in combining cross-section and time-series
data, Econometrica 37, 5572.