Panel Data
Analysis
Lecture 3
Introduction
Spring 2025
TS109- WEEK 3&4
Mohamed Abdallah
Lecturer of Applied
Statistics&Economerics
mohamed_stat@yahoo.com
01222596520
Econometric Analysis of Panel Data
5. Random Effects Linear Model
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 , c2 ,...cN ), Ni=1 Ti by 1 vector
ci is uncorrelated with xit for all t;
E[ci |Xi] = 0
E[εit|Xi,ci]=0
We assume that:
E (v i ) E ( it ) 0
E (v i2 ) v2
E ( it2 ) 2 (both components homoscedastic)
E ( it v j ) 0 i ,t , j (independe nce of two components )
E ( it js ) 0 if t s or i j (no autocorrel ation)
E (v i v j ) 0 if i j (no across group correlatio n)
E (v i x it ) E ( it x it ) 0 (both independen t of regressor)
(We could also introduce an error component
which varies across time periods but not across
groups – two way random effects.)
Estimation of the random effects model cannot
be performed by OLS – instead a technique
known as generalised least squares (GLS) must
be used.
Error Components Model
Generalized Regression Model
y it x it b+εit +ui
E[εit | X i ] 0 2 u2 u2 u2
2
2
2
u2
E[εit2 | X i ] σ 2 Var[ε i +uii ] u u
E[ui | X i ] 0 2
u u2 u
2 2
E[ui2 | X i ] σ u2
y i =X iβ+ε i +uii for Ti observations
Notation
y1 X1 ε1 u1i1 T1 observations
y X ε u i T observations
β 2 2 2
2 2 2
y
N NX N N N TN observations
ε u i
= 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.
Notation
2 u2 u2 u2
u2 2 u2 u2
Var[ε i +uii ]
u u2 2 u2
2
= 2I Ti u2ii Ti Ti
= 2I Ti u2ii
= Ωi
Ω1 0 0
0 Ω2 0 (Note these differ only
Var[w | X ]
in the dimension Ti )
0 0 ΩN
Regression Model-Orthogonality
1
plim X'w 0
# observations
1 1
plim N i=1 X i w i plim N Ni=1 X i (ε i +uii) 0
N
i1 Ti i1 Ti
1 N X iε i N X iii
plim N i=1 Ti + i=1 Tu
i i
i1 Ti Ti Ti
N X iε i N X iii Ti
plim i=1 fi + i=1 fi ui , 0 < fi N <1
Ti Ti i1 Ti
N X iε i N 1
plim i=1 fi + i=1 fi x iui 0 = if Ti T i
Ti N
Convergence of Moments
X X N X i X i
N
i1 fi a weighted sum of individual moment matrices
i1 T Ti
X ΩX N X iΩi X i
N
f
i1 i a weighted sum of individual moment matrices
i1 T Ti
X i X i
= 2 Ni1fi u2 Ni1fi x i x i
Ti
X i X i
Note asymptotics are with respect to N. Each matrix 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).
Random vs. Fixed Effects
Random Effects
Small number of parameters
Efficient estimation
Objectionable orthogonality assumption (ci Xi)
Fixed Effects
Robust – generally consistent
Large number of parameters
Ordinary Least Squares
Standard results for OLS in a GR model
Consistent
Unbiased
Inefficient
True Variance
1 1
1 X X X ΩX X X
Var[b | X]
Ni1 Ti Ni1 Ti Ni1 Ti Ni1 Ti
0 Q-1 Q * Q-1
0 as N with our convergence assumptions
Choosing between Fixed Effects (FE) and Random Effects
(RE)
1. With large T and small N there is likely to be little
difference, so FE is preferable as it is easier to compute
2. With large N and small T, estimates can differ
significantly. If the cross-sectional groups are a random
sample of the population RE is preferable. If not the FE is
preferable.
3. If the error component, vi , is correlated with x then RE
is biased, but FE is not.
4. For large N and small T and if the assumptions behind
RE hold then RE is more efficient than FE.
Estimating the Variance for OLS
1 1
1 X X X ΩX X X
Var[b | X] N N N
i1 Ti i1 Ti i1 Ti Ni1 Ti
X ΩX X iΩi X i
N
N
i1 fi , where = Ωi=E[w i wi | X i ]
i1 T Ti
In the spirit of the White estimator, use
X ΩX X i w ˆ i X i
ˆ iw
N
N
f
i1 i
ˆ i = y i - X ib
, w
i1 T Ti
Hypothesis tests are then based on Wald statistics.
THIS IS THE 'CLUSTER' ESTIMATOR
Hausman test:
Tests for the statistical significance of the
difference between the coefficient estimates
obtained by FE and by RE, under then null
hypothesis that the RE estimates are efficient
and consistent, and FE estimates are inefficient.
The test has a Wald test form, and is usually
reported in Chi2 form with k-1 degrees of
freedom (k is the number of regressors).
If W < critical value then random effects is the
preferred estimator.
Generalized Least Squares
ˆ=[X Ω-1 X ]1 [X Ω-1 y]
β
=[Ni1 X iΩi-1 X i ]1 [Ni1 X iΩi-1 y i ]
1 2
-1
Ωi 2 I Ti 2 2
ii
Tiu
(note, depends on i only through Ti )
Estimators for the Variances
y it x it β it ui
With a consistent estimator of β, say bOLS ,
Ni1 tTi 1 (y it - x itb)2 estimates Ni1 tTi 1 (2 U2 )
Divide by something to estimate 2 = 2 U2
With the LSDV estimates, ai and bLSDV ,
Ni1 tTi 1 (y it - ai - x itb)2 estimates Ni1 tTi 12
Divide by something to estimate 2
Estimate U2 with Est(2 U2 )- 2
ˆ .
Feasible GLS
Feasible GLS requires (only) consistent estimators of 2 and u2 .
Candidates:
2 N Ti
i1 t 1 (y it ai x it bLSDV )
2
From the robust LSDV estimator:
ˆ
Ni1 Ti K N
Ni1 tTi 1 (y it aOLS x it bOLS )2
2 2
From the pooled OLS estimator: Est( ) u
Ni1 Ti K 1
2 Ni1 (y it a x ibMEANS )2
2
From the group means regression: Est( / T ) u
N K 1
2 2 Ni1 tTi 11 sTi t 1 w
ˆ it w
ˆ is
(Wooldridge) Based on E[w it w is | X i ] u if t s,
ˆu
Ni1 Ti K N
There are many others.
x´ does not contain a constant term in the preceding.
Testing for Effects: LM Test
Breusch and Pagan Lagrange Multiplier statistic
Assuming normality (and for convenience now, a
balanced panel)
2 2
NT (Tei )
N 2
NT [(Tei ) eiei ]
N 2
LM=
i1
1
i1
TN
i1
2
2(T-1) t 1eit 2(T-1) N
e e
i1 i i
Converges to chi-squared[1] under the null hypothesis
of no common effects. (For unbalanced panels, the
scale in front becomes (Ni1 Ti ) 2 /[2Ni1 Ti (Ti 1)].)
Many adjustments for unbalanced panels and "better small
sample performance," e.g., Baltagi and Li in NLOGIT.
Testing for Effects: Moments
Wooldridge (page 265) suggests based on the off diagonal elements
Ni=1 t=1
T-1 T
s=t+1eit eis
Z=
2
N T-1 T
i=1 t=1 e eis
s=t+1 it
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 chi-
squared with one degree of freedom.
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.
Hausman Test for FE vs. RE
Estimator Random Effects Fixed Effects
E[ci|Xi] = 0 E[ci|Xi] ≠ 0
FGLS Consistent and Inconsistent
(Random Effects) Efficient
LSDV Consistent Consistent
(Fixed Effects) Inefficient Possibly Efficient
A Variable Addition Test
Asymptotic 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.
Thank
you