0% found this document useful (0 votes)
123 views58 pages

Econometric Methods For Panel Data

This document provides an outline for a lecture on econometric methods for panel data. It introduces key concepts such as fixed effects models, random effects models, and two-way panel models. It discusses advantages of panel data analysis over time series or cross-sectional data in allowing observation of individual histories and dynamics over time. Heterogeneity across individuals is identified as a key challenge that panel data methods aim to address. Influential textbooks on panel data analysis are also cited.

Uploaded by

Daryna Zinchuk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
123 views58 pages

Econometric Methods For Panel Data

This document provides an outline for a lecture on econometric methods for panel data. It introduces key concepts such as fixed effects models, random effects models, and two-way panel models. It discusses advantages of panel data analysis over time series or cross-sectional data in allowing observation of individual histories and dynamics over time. Heterogeneity across individuals is identified as a key challenge that panel data methods aim to address. Influential textbooks on panel data analysis are also cited.

Uploaded by

Daryna Zinchuk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

Introduction Fixed effects Random effects Two-way panels

Econometric Methods for Panel Data


Based on the books by Baltagi: Econometric Analysis of
Panel Data and by Hsiao: Analysis of Panel Data

Robert M. Kunst
[email protected]

University of Vienna
and
Institute for Advanced Studies Vienna

February 28, 2023

1/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

Outline
Introduction
Fixed effects
The LSDV estimator
The algebra of the LSDV estimator
Properties of the LSDV estimator
Pooled regression in the FE model
Differences in differences
Random effects
The GLS estimator for the RE model
feasible GLS in the RE model
Properties of the RE estimator
Two-way panels
The two-way fixed-effects model
The two-way random-effects model
2/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The definition of panel data

The word panel has a Dutch origin and it essentially means a


board. Data for a variable on a board is two-dimensional, the
variable X has two subscripts. One dimension is an individual
index (i), and the other dimension is time (t):
 
X11 . . . X1T
 .. .. 
 . X . 
it
XN1 . . . XNT

3/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

Long and broad boards

 
X11 ... X1T
   .. .. .. 
X11 . . . . . . . . . X1T 
 . . . 

 .. ..   .. .. 
 . . . . Xit . . . .   . Xit . 
.. .. ..
 
XN1 . . . . . . . . . XNT 
 . . .


XN1 . . . XNT
If T ≫ N, the panel is a time-series panel, as it is often
encountered in macroeconomics. If N ≫ T , it is a cross-section
panel, as it is common in microeconomics.

4/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

Not quite panels


▶ longitudinal data sets look like panels but the time index may
not be common across individuals. For examples, growing
plants may be measured according to individual time;
▶ in pseudo-panels, individuals may change between time points:
Xit and Xi,t+1 may relate to different persons;
▶ repeated cross sections, for example household data sampled
in 1980, 1990, and 1995, are often encountered in empirical
microeconomics. Often, they are pseudo-panels with irregular
time intervals and small T ;
▶ in unbalanced panels, T differs among individuals and is
replaced by Ti : no more matrix or ‘board’ shape.

5/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The two dimensions have different quality

▶ In the time dimension t, the panel behaves like a time series:


natural ordering, systematic dependence over time,
asymptotics depend on stationarity, ergodicity etc.
▶ In the cross-section dimension i, there is no natural ordering,
cross-section dependence may play a role (‘second
generation’), otherwise asymptotics may also be simple
assuming independence (‘first generation’). Sometimes, e.g. in
spatial panels, i may have structure and natural ordering.

6/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

Advantages of panel data analysis

▶ Panels are more informative than simple time series of


aggregates, as they allow tracking individual histories. A 10%
unemployment rate is less informative than a panel of
individuals with all of them unemployed 10% of the time or
one with the same 10% always unemployed;
▶ Panels are more informative than cross-sections, as they
reflect dynamics and Granger causality across variables.

7/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The heterogeneity problem

N = 3, T = 20. For each i, there is an identical, positive slope in a linear


relationship between Y and X . For the whole sample, the relationship is
slightly falling and nonlinear. If interest focuses on the former model,
naive estimation over the whole sample results in a heterogeneity bias.
8/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

Books on panels
Baltagi, B. Econometric Analysis of Panel Data, Wiley. (textbook)
Hsiao, C. Analysis of Panel Data, Cambridge University Press. (textbook)
Arellano, M. Panel Data Econometrics, Oxford University Press.
Baum, C.F. An Introduction to Modern Econometrics Using Stata, Stata
Press.
Croissant, Y., and G. Millo Panel Data Econometrics with R, Wiley.
Diggle, P., Heagerty, P., Liang, K.Y., and S. Zeger Analysis of
Longitudinal Data, Oxford University Press. (non-economic monograph)
Wooldridge, J.M. Econometric Analysis of Cross Section and Panel Data,
M.I.T. Press.

9/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The LSDV estimator

The pooled regression model


Consider the model

yit = α + β ′ Xit + uit , i = 1, . . . , N, t = 1, . . . , T .

Assume there are K regressors (covariates), such that


dim(β) = K .

Panel models mainly differ in their assumptions on u. u


independent across i and t, Eu = 0, and varu = σ 2 define the
(usually unrealistic) pooled regression model. It is efficiently
estimated by least squares (OLS).

Sometimes, one may consider digressing from the homogeneity


assumption βi ≡ β. This entails that most advantages of panel
modeling are lost.
10/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The LSDV estimator

The fixed-effects regression

The model

yit = α + β ′ Xit + uit ,


uit = µi + νit ,
i = 1, . . . , N, t = 1, . . . , T ,

with the identifying condition N


P
i=1 µi = 0, and the individual
effects µi assumed as unobserved constants (parameters), is the
fixed-effects (FE) regression model. (νit ) fulfills the usual
conditions on errors: independent, Eν = 0, varν = σν2 .

11/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The LSDV estimator

Incidental parameters

Most authors call a parameter incidental when its dimension


increases with the sample size. The nuisance due to such a
parameter is worse than for a typical nuisance parameter whose
dimension may be constant.

As N → ∞, the number of fixed effects µi increases. Thus, the


fixed effects are incidental parameters.

Incidental parameters cannot be consistently estimated, and they


may cause inconsistency in the ML estimation of the remaining
parameters.

12/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The LSDV estimator

OLS in the FE regression model

In the FE model, the regression equation

yit = α + β ′ Xit + uit , i = 1, . . . , N, t = 1, . . . , T ,

does not fulfill the conditions of the Gauss-Markov Theorem, as


Euit = µi ̸= 0. OLS may be biased, inconsistent, and even if it is
unbiased, it is usually inefficient.

13/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The LSDV estimator

Least-squares dummy variables


(j)
Let Zµ,it denote a dummy variable that is 0 for all observations it
with i ̸= j and 1 for i = j. Then, convening
(1) (N)
Zµ,it = (Zµ,it , . . . , Zµ,it )′ and µ = (µ1 , . . . , µN )′ , the regression
model

yit = α + β ′ Xit + µ′ Zµ,it + νit , i = 1, . . . , N, t = 1, . . . , T ,

fulfills all conditions of the Gauss-Markov Theorem. OLS for this


regression is called LSDV (least-squares dummy variables), the
within, or the FE estimator. Assuming X as non-stochastic, LSDV
is unbiased, consistent, and linear efficient (BLUE).

14/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The LSDV estimator

The dummy-variable trap in LSDV

(j)
Note that N
P
j=1 Zµ,it = 1. Inhomogeneous LSDV regression would
be multicollinear. Two (equivalent) solutions:
1. restricted OLS imposing N
P
i=1 µi = 0;
2. homogeneous regression with free µ∗i coefficients. Then, α̂ is
recovered from N ∗ ∗
P
i=1 µ̂i , and µ̂i = µ̂i − α̂.
In any case, parameter dimension is K + N.

15/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The LSDV estimator

Within and between

By conditioning on individual (‘group’) dummies, the within or


within-groups estimator concentrates exclusively on variation
within the individuals.

By contrast, the between estimator results from a regression


among N individual time averages:

ȳi. = α + β ′ X̄i. + ūi. , i = 1 . . . , N,

with ȳi. = T −1 T
P
t=1 yit etc. Because of Eūi. = µi ̸= 0, it violates
the Gauss-Markov conditions and is more of theoretical interest.

16/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The algebra of the LSDV estimator

LSDV regression in matrix form

Stacking all NT observations yields the compact form

y = αιNT + X β + Zµ µ + ν,

where ιNT , y , and ν are NT –vectors. Generally, ιm stands for an


m–vector of ones. Convention is that i is the ‘slow’ index and t
the ‘fast’ index, such that the first T observations belong to i = 1.
X is an NT × K –matrix, β is a K –vector, µ is an N–vector. Zµ is
an NT × N–matrix.

17/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The algebra of the LSDV estimator

The matrix Zµ
The NT × N–matrix for the dummy regressors looks like
 
1 0 ··· 0
 .. .. .. 
 . . . 
 
 1 0 
 
 0 1 
 .. ..
 

 . . 
Zµ =  .
 0 1 
 

 . .. 

 

 0 1  
 . .. 
 .. . 
0 ··· 0 1
This matrix can be written in Kronecker notation as IN ⊗ ιT . IN is the
N × N identity matrix. 18/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The algebra of the LSDV estimator

Review: Kronecker products


The Kronecker product A ⊗ B of two matrices A = [aij ] and
B = [bkl ] of dimensions n × m and n1 × m1 is defined by
a11 B a12 B . . . a1m B
 
 a21 B a22 B . . . a2m B 
A⊗B =
 ... ... ... ... 
,

an1 B an2 B . . . anm B

which gives a large (nn1 ) × (mm1 )–matrix. Left factor determines


‘crude’ form and right factor determines ‘fine’ form. (Note: some
authors use different definitions, t.ex. David Hendry)

I ⊗ B is a block-diagonal matrix.
19/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The algebra of the LSDV estimator

Three calculation rules for Kronecker products

(A ⊗ B )′ = A′ ⊗ B ′
(A ⊗ B )−1 = A−1 ⊗ B −1
(A ⊗ B )(C ⊗ D ) = (AC ⊗ BD )

for non-singular matrices (second rule) and fitting dimensions


(third rule).

20/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The algebra of the LSDV estimator

The matrix Zµ is very big

Direct regression of y on the full NT × (N + K )–matrix is feasible


(unless N is too large) but inconvenient:
▶ This straightforward regression does not exploit the simple
structure of the matrix Zµ ;
▶ it involves inversion of an (N + K ) × (N + K )–matrix, an
obstacle especially for cross-section panels.
Therefore, the regression is run in two steps.

21/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The algebra of the LSDV estimator

The Frisch-Waugh theorem

Theorem
The OLS estimator on the partitioned regression

y = Xβ + Zγ + u

can be obtained by first regressing y and all X variables on Z ,


which yields residuals yZ and XZ , and then regressing yZ on XZ in

yZ = XZ β + v .

The resulting estimate β̂ is identical to the one obtained from the


original regression.

22/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The algebra of the LSDV estimator

Remarks on Frisch-Waugh

▶ Note that the outlined sequence does not yield an OLS


estimate of γ. If that is really needed, one may run the same
sequence with X and Z exchanged.
▶ Frisch-Waugh emphasizes that OLS coefficients in any
multiple regression are really effects conditional on all
remaining regressors.
▶ Frisch-Waugh permits running a multiple regression on two
regressors if only simple regression is available.
▶ Proof by direct evaluation of the regressions, using inversion
of partitioned matrices.

23/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The algebra of the LSDV estimator

Interpreting regression on Zµ
If any variable y is regressed on Zµ , the residuals are

y − Zµ Zµ′ Zµ Zµ′ y
−1

= y − (IN ⊗ ιT ){(IN ⊗ ιT )′ (IN ⊗ ιT )}−1 (IN ⊗ ιT )′ y


= y − T −1 (IN ⊗ ιT ι′T )y
T
X T
X T
X T
X
−1
= y −T ( y1t , . . . , y1t , y2t , . . . , yNt )′
t=1 t=1 t=1 t=1

= y − (ȳ1. , . . . , ȳ1. , ȳ2. , . . . , ȳN. ) ,

such that all observations are adjusted for their individual time
averages. This is done for all variables, y and the covariates X .
24/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The algebra of the LSDV estimator

Applying Frisch-Waugh to LSDV

1. In the first step, y and all regressors in X are regressed on Zµ


and the residuals are formed, i.e. the observations corrected
for their individual time averages;
2. in the second step, the ‘purged’ y observations are regressed
on the purged covariates. β̂ is obtained.
The procedure fails for time-constant variables. An OLS estimate
µ̂ follows from regressing the residuals y − X β̂ on dummies.

25/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The algebra of the LSDV estimator

The purging matrix Q


The matrix that defines the purging (or sweep-out) operation in
the first step is Q = INT − T −1 (IN ⊗ JT ) with JT = ιT ι′T a
T × T –matrix filled with ones:

ỹ = y − (ȳ1. , . . . , ȳN. )′ ⊗ ιT
= Qy
Using this matrix allows to write the FE estimator compactly:

β̂FE = (X ′ Q ′ QX )−1 X ′ Q ′ Q y
= (X ′ QX )−1 X ′ Q y ,

as Q ′ = Q and Q 2 = Q .
26/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

Properties of the LSDV estimator

The variance matrix of the LSDV estimator

The LSDV estimator looks like a GLS estimator, and the algebra
for its variance follows the GLS variance:

varβ̂FE = σν2 (X ′ QX )−1

Note: This differs from usual GLS algebra, as Q is singular. There


is no GLS model that motivates FE, though the result is analogous.

27/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

Properties of the LSDV estimator

N and T asymptotics of the LSDV estimator

If Eβ̂FE = β and varβ̂FE → 0, β̂FE will be consistent.


1. If T → ∞, (X ′ QX )−1 converges to 0, assuming that all
covariates show constant or increasing variation around their
individual means, which is plausible (excludes time-constant
covariates).
2. If N → ∞, (X ′ QX )−1 converges to 0, assuming that
covariates vary across individuals (excludes covariates
indicative of time points).
T → ∞ allows to retrieve consistent estimates of all ‘effects’ µi .
For N → ∞, this is not possible.

28/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

Properties of the LSDV estimator

t–statistics on coefficients
1. Plugging in a sensible estimator σ̂ν2 for σν2 in

ΣFE = σν2 (X ′ QX )−1

yields Σ̂FE = [σ̂FE ,jk ]j,k=1,...,K and allows to construct


t–values for the vector β:
−1/2 −1/2
tβ = diag(σ̂FE ,11 , . . . , σ̂FE ,KK )β̂FE .

A suggestion for σ̂ν2 is (NT − N − K )−1 N


P PT 2
i=1 t=1 ν̂it .
2. t–statistics on µi and α are obtained by evaluating the full
model in an analogous way.
These t–values are, under their null, asymptotically distributed
N(0, 1). Under Gauss-Markov assumptions, they are t distributed
in small samples. Statistics for effects need T → ∞. 29/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

Pooled regression in the FE model

The bias of pooled regression in the FE model

The ‘pooled’ OLS estimate in the FE model is

β̂# = (X#

X# )−1 X#′ y ,
where X# etc. denotes the X matrix extended by the intercept
column. As in usual derivation of ‘omitted-variable bias’:

E β̂# = β# + X# X# −1 X#′ Zµ µ,
 



so the bias depends on the correlation of X and Zµ and on µ. It


disappears for µ = 0 (no effects) and for corr(X , Zµ ) = 0, i.e. if
the covariates have no individual-specific appearance.

30/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

Differences in differences

Differences in differences: the idea


If one of the covariates is an important binary 0–1 variable, it can
be interpreted as treatment with ‘0’ for non-treated and ‘1’ for
treated cases. If T = 2 with t = 1 before potential treatment and
t = 2 after potential treatment, a popular panel estimator is the
differences-in-differences estimator (DID).
First differences remove all individual effects. The difference
between the influence on the response (regression intercept) in the
treated and non-treated (control) subsamples should then be an
estimate for the response effect of treatment.
A major conceptual problem in applications is the potential
endogeneity of treatment.

31/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

Differences in differences

First differences can be inefficient


Assume

yit = α + β ′ Xit + µi + νit , i = 1, . . . , N, t = 1, . . . , T ,

with white-noise νit . Then, the errors in

∆yit = β ′ ∆Xit + ∆νit , i = 1, . . . , N, t = 1, . . . , T ,

follow MA(1) processes. Gauss-Markov is violated, and OLS


becomes inefficient. Feasible GLS could be used but this is rare in
DID applications.
First differences (FD) defines an efficient estimator if errors νit
follow a random walk, as then ∆νit will be white noise.
32/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

Idea of the random-effects model


If N is large, one may view the ‘effects’ as unobserved random
variables and not as incidental parameters: random effects (RE).
The model becomes more ‘parsimonious’, as it has fewer
parameters.
▶ It should be plausible that all effects are drawn from the same
probability distribution. Strong heterogeneity across
individuals invalidates the RE model.
▶ The concept is unattractive for small N.
▶ The concept is unattractive for large T .
▶ The concept presumes that covariates and effects are
approximately independent. This assumption may often be
implausible a priori.
33/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The GLS estimator for the RE model

The random-effects model

The basic one-way RE model (or variance-components model)


reads:

yit = α + β ′ Xit + uit ,


uit = µi + νit ,
∼ i.i.d. 0, σµ2 ,

µi
∼ i.i.d. 0, σν2 ,

νit

for i = 1, . . . , N, and t = 1, . . . , T . µ and ν are mutually


independent.

34/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The GLS estimator for the RE model

GLS estimation for the RE model

The RE model corresponds to a usual GLS regression model

y = αιNT + X ′ β + u,
varu = σµ2 (IN ⊗ JT ) + σν2 INT .

Denoting the error variance matrix by Euu ′ = Ω, the GLS


estimator is
β̂RE = X# Ω X# X# Ω y .
 ′ −1 −1 ′ −1

This estimator is BLUE for the RE model.

35/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The GLS estimator for the RE model

The matrix Ω is big


GLS estimation involves the inversion of the (NT × NT )–matrix
Ω, which may be inconvenient. It is easily inverted, however, from
a ‘spectral’ decomposition into orthogonal parts. J¯T is a
T × T –matrix of elements T −1 .

Ω = T σµ2 IN ⊗ J¯T + σν2 INT




= T σµ2 + σν2 IN ⊗ J¯T + σν2 INT − IN ⊗ J¯T


  

= T σµ2 + σν2 P + σν2 Q ,




where P and Q have the properties


PQ = QP = 0, P 2 = P , Q 2 = Q , P + Q = I .
36/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The GLS estimator for the RE model

Inversion of Ω

Because of the special properties of the spectral decomposition, Ω


can be inverted componentwise:

IN ⊗ J¯T INT − IN ⊗ J¯T


−1
Ω−1 = T σµ2 + σν2 + σν−2
 
.

Thus, the GLS estimator has the simpler closed form


i−1
X#′ T σµ2 + σν2 −1 P + σν−2 Q X#
h n  o
β̂#,RE = ×

×X# P + σν−2 Q y ,

n −1 o
T σµ2 + σν2

which only requires inversion of a (K + 1) × (K + 1)–matrix.

37/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The GLS estimator for the RE model

Splitting Ω

Any GLS estimator (X ′ Ω−1 X )−1 X ′ Ω−1 y can also be represented


in the form {(MX )′ MX }−1 (MX )′ M y , as OLS on data
transformed by the square root of Ω−1 . Because of P 2 = P etc.,
this form is very simple here:
 ′  −1  ′
β̂#,RE = P̃X# P̃X# P̃X# P̃ y ,
with −1
P̃ = P + σν−1 Q .
q
T σµ2 + σν2

38/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The GLS estimator for the RE model

The weight parameter θ


The GLS estimator is invariant to any re-scaling of the
transformation matrix (cancels out). For example,
 ′  −1  ′
β̂#,RE = P̃1 X# P̃1 X# P̃1 X# P̃1 y
with
P̃1 = q
σν
P +Q
T σµ2 + σν2
= (1 − θ) P + Q ,
and
σν
θ =1− q .
T σµ2 + σν2
39/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The GLS estimator for the RE model

The value of θ determines the RE estimate

Note the following cases:


1. θ = 0, the transformation is I , RE-GLS becomes OLS. This
happens if σµ2 = 0, no ‘effects’;
2. θ = 1, the transformation is Q , RE-GLS becomes FE-LSDV.
This happens if T is very large or σν2 = 0 or σµ2 is large;
3. The transformation can never become just P , which would
yield the between estimator.

40/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

feasible GLS in the RE model

θ must be estimated

In practice, RE-GLS requires the unknown weight parameter


σν
θ =1− q
T σµ2 + σν2

to be estimated. The estimator with the true covariance matrix Ω


replaced by an estimate Ω̂ is called feasible GLS (fGLS) estimator.

Most algorithms use a consistent (inefficient, non-GLS) estimator


in a first step, in order to estimate variances from residuals. Some
algorithms iterate this idea. Some use joint estimation of all
parameters by nonlinear ML-type optimization.

41/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

feasible GLS in the RE model

OLS and LSDV are consistent in the RE model

The RE model is a traditional GLS model. OLS is consistent and


(for fixed regressors) unbiased though not efficient. LSDV is also
consistent and unbiased for β. It may be more efficient, as
typically θ is closer to one, where LSDV and RE coincide.

Thus, LSDV and OLS are appropriate first-step routines for


estimating θ.

42/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

feasible GLS in the RE model

Estimating numerator and denominator


A customary method is to estimate σ12 = T σµ2 + σν2 by

N T
!2
2 T X 1 X
σ̂1 = ûit
N T
i=1 t=1

and σν2 by
PN PT  PT 2
i=1 t=1 ûit − T −1 s=1 ûis
σ̂ν2 = .
N (T − 1)

û may be OLS or LSDV residuals. A drawback is that the implied


2 −1 2 2

estimate σ̂µ = T σ̂1 − σ̂ν can be negative and inadmissible.
43/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

feasible GLS in the RE model

Estimating σµ2 and σν2

The Nerlove method estimates σµ2 directly from the effect


estimates in a first-step LSDV regression, and forms θ̂ accordingly.

Estimating σ12 , however, is no coincidence. That term appears in


the evaluation of the likelihood. It is implied by an eigenvalue
decomposition of the matrix Ω.

Usually, discrepancies across θ estimation methods are minor.

44/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

feasible GLS in the RE model

Maximum likelihood estimation

Like all parametric statistical models, the RE model has a


log-likelihood
NT N 1
L(α, β, ϕ2 , σν2 ) = constant − log σν2 + log ϕ2 − 2 u ′ Σ−1 u,
2 2 2σν

with ϕ2 = σν2 /(T σµ2 + σν2 ) ∈ (0, 1], Σ = Q + ϕ−2 P , and


u = y − αιNT − X β. The likelihood assumes normal errors. An
algorithm using smart concentration of the likelihood and iterative
maximization is due to Breusch (1987).

45/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

Properties of the RE estimator

RE-GLS is linear efficient for the correct model

By construction, the RE estimator is linear efficient (BLUE) for the


RE model. It has the GLS variance

var β̂#,RE = X# Ω−1 X#


  

−1
.

For the fGLS estimator, this variance is attained asymptotically, for


N → ∞ and T → ∞.

For T → ∞, the RE estimator becomes the FE estimator. Thus,


FE and RE have similar properties for time-series panels.

46/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

Two-way panels: the idea

In a two-way panel, there are individual-specific unobserved


constants (individual effects) as well as time-specific constants
(time effects):

yit = α + β ′ Xit + uit , i = 1, . . . , N, t = 1, . . . , T ,


uit = µi + λt + νit .

The model is important in economic applications but it is less


ubiquitous than the one-way model. Some software routines have
not implemented the two-way RE model, for example.

47/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The two-way fixed-effects model

A compact form for the two-way FE regression

Assume all effects are constants (incidental parameters). Again,


the model can be written compactly as

y = α + X β + Zµ µ + Zλ λ + ν,

with the (TN × T )–matrix Zλ for time dummies, and


λ′ = (λ1 , . .P
. , λT ). The model assumes the identifying restriction
P N T
i=1 µi = t=1 λt = 0. This may be achieved by just using
N − 1 individual dummies, T − 1 time dummies, and an
‘inhomogeneous’ intercept.

Note that Zλ = ιN ⊗ IT .
48/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The two-way fixed-effects model

Two-way LSDV estimation

By construction, OLS regression on X and all time and individual


dummies yields the BLUE for the model. Direct regression requires
the inversion of a (K + N + T − 1) × (K + N + T − 1)–matrix,
which is inconveniently large. Thus, application of the
Frisch-Waugh theorem may be advisable.

49/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The two-way fixed-effects model

The two-way purging matrix


Simple algebra shows that residuals of the first-step regression on
all dummies is equivalent to applying the sweep-out (or purging)
matrix

Q2 = IN ⊗ IT − IN ⊗ J¯T − J¯N ⊗ IT + J¯N ⊗ J¯T .


The third matrix has N 2 blocks of diagonal matrices with elements
N −1 on their diagonals; the fourth matrix is filled with the
constant value (NT )−1 .

The second matrix subtracts individual time average, the third


matrix subtracts time-point averages across individuals, which
subtracts means twice, so the last matrix adds a total average.
50/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The two-way fixed-effects model

The GLS-type form of the two-way FE estimator

Again, the FE estimator has the form

X ′ Q2 X X ′ Q2 y ,
−1
β̂FE ,2−way =

with the just defined two-way Q2 . Its variance is

varβ̂ = σν2 X ′ Q2 X −1 ,


which can be estimated by plugging in some variance estimate σ̂ν2


based on the LSDV residuals.

51/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The two-way fixed-effects model

Some properties of the two-way LSDV estimator

▶ The estimator β̂FE ,2−way is BLUE for non-stochastic or


exogenous X ;
▶ β̂FE ,2−way is consistent for T → ∞ and for N → ∞;
▶ µ̂ is consistent for T → ∞;
▶ λ̂ is consistent for N → ∞.

52/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The two-way random-effects model

The two-way random-effects model

The basic two-way RE model (or variance-components model)


reads:

yit = α + β ′ Xit + uit ,


uit = µi + λt + νit ,
∼ i.i.d. 0, σµ2 ,

µi
∼ i.i.d. 0, σλ2 ,

λt
∼ i.i.d. 0, σν2 ,

νit

for i = 1, . . . , N, and t = 1, . . . , T . µ, λt , and ν are mutually


independent.

53/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The two-way random-effects model

Estimation in the two-way random-effects model

This is a GLS regression model, with error variance matrix

Ω = E uu ′


= σµ2 (IN ⊗ JT ) + σλ2 (JN ⊗ IT ) + σν2 INT

Thus, β is estimated consistently though inefficiently by OLS and


(linear) efficiently by GLS.

54/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The two-way random-effects model

The GLS estimator for the two-way model

Calculation of the estimator

β̂RE ,2−way = {X#



Ω−1 X# }−1 X#

Ω−1 y

requires the inversion of an NT × NT –matrix, which is


inconvenient. Unfortunately, the spectral matrix decomposition is
much more involved than for the one-way model.

55/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The two-way random-effects model

The decomposition of the two-way Ω


Some matrix algebra yields
Ω−1 = a1 (IN ⊗ JT ) + a2 (JN ⊗ IT ) + a3 INT + a4 JNT
with the coefficients
σµ2
a1 = −  ,
σν2 + T σµ2 σν2
σλ2
a2 = −  ,
σν2 + Nσλ2 σν2
1
a3 = ,
σν2
σµ2 σλ2 2σν2 + T σµ2 + Nσλ2
a4 = .
σν2 + T σµ2 σν2 + Nσλ2 σν2 + T σµ2 + Nσλ2
 
σν2
56/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The two-way random-effects model

Properties of the two-way GLS estimator

The GLS estimator is linear efficient with variance matrix

{X#

Ω−1 X# }−1 .

For T → ∞, N → ∞, N/T → c ̸= 0, o.c.s. that Ω−1 → Q2 , and


FE and RE become equivalent.

57/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna
Introduction Fixed effects Random effects Two-way panels

The two-way random-effects model

Implementation of feasible GLS in the two-way RE model


The square roots of the weights can be used to transform all
variables y and X in a first step, then inhomogeneous OLS
regression of transformed y on transformed X yields the GLS
estimate.
The variance parameters σν2 , σµ2 , σλ2 are unknown, and so are the

aj terms and the aj for the transformation. If the variance
parameters are estimated from a first-stage LSDV, the resulting
estimator can be shown to be asymptotically efficient. First-stage
OLS yields similar results but entails some slight asymptotic
inefficiency.
Maximum likelihood estimation is also available, based on an
extension of the one-way RE likelihood maximization.
58/58

Econometric Methods for Panel Data University of Vienna and Institute for Advanced Studies Vienna

You might also like