Panel Econometrics IV
ECONOMETRICS
Today’s outline
Specification tests
Unobserved individual-specific effects
Wooldridge’s test of unobserved individual-specific effects
Breusch-Pagan LM test of unobserved individual-specific effects
Tests for autocorrelation
Up next
ECONOMETRICS
Why test for unobserved individual-specific effects?
Recall the error-components model:
yit = xit β + vit , vit = ci + uit
If σc2 = 0, then ci vanishes and the variance matrix of vi becomes
Ω = σu2 IT .
This leads to
! −1 ! ! −1
N N N N
−1 −1 1 1
β̂RE = ∑ Xi0 Ω̂ Xi ∑ Xi0 Ω̂ yi =
σ̂u2 ∑ Xi0 Xi
σ̂u2 ∑ Xi0 yi
i =1 i =1 i =1 i =1
! −1 !
N N
= ∑ Xi0 Xi ∑ Xi0 yi = β̂POLS
i =1 i =1
Hence, pooled OLS is consistent and efficient.
ECONOMETRICS
Hypotheses
H0 : σc2 = 0 versus H1 : σc2 6= 0
This implies for E(vi0 vi ) = Ω
2
σc2 + σu2 σc2
σu 0
H0 : Ω =
..
vs. H1 : Ω =
..
. .
0 σu2 σc2 σc2 + σu2
Comments:
I This is a two-sided alternative.
I Theoretically, σc2 < 0 is not sensible.
I Empirically, σ̂c2 < 0 may happen, indicating some more general deviation from the
implicit null Ω = σu2 IT .
ECONOMETRICS
A simple test statistic
We can use any lower triangular element of E(vi0 vi ) = Ω as the basis for a test
statistic because the hypotheses imply
H0 : E(vit vis ) = 0 vs. H1 : E(vit vis ) = σc2 , for some s > t.
If we were able to observe vit , a simple statistic would be, for some choice of s > t,
N
∑ vit vis → Normal(0, w 2 )
d
N −1/2
i =1
where w 2 = Var(vit vis ) = E(vit2 vis2 ).
Replacing vit by the POLS residuals v̂ˆit , changes nothing asymptotically under the null:
N
∑ v̂ˆit v̂ˆis → Normal(0, w 2 )
d
N −1/2
i =1
and we can estimate w 2 by N −1 ∑N ˆ2 ˆ2
i =1 v̂it v̂is . ECONOMETRICS
Wooldridge’s test statistic
Instead of using one of the triangular elements (which one?), Wooldridge suggests to
use their sum because the hypotheses imply
T −1 T T −1 T
T (T − 1) 2
H0 : ∑ ∑ E(vit vis ) = 0 vs. H1 : ∑ ∑ E(vit vis ) =
2
σc .
t =1 s =t +1 t =1 s =t +1
Note that the random variable
T −1 T
hi = ∑ ∑ vit vis
t =1 s =t +1
has mean zero under the null and is independent and identically distributed. Hence, a
CLT applies:
N
∑ hi → Normal(0, Var(hi )),
d
N −1/2
i =1
2
−1 −1
Var(hi ) = Var ∑T
t =1 ∑T
s =t +1 vit vis =E ∑T
t =1 ∑T
s =t +1 vit vis .
ECONOMETRICS
No residual effect
Replacing vit by the POLS residuals v̂ˆit has no effect asymptotically:
N N T −1 T
∑ ĥi = N −1/2 ∑ ∑ ∑
d
N −1/2 v̂ˆit v̂ˆis → Normal(0, w 2 )
i =1 i =1 t =1 s =t +1
where w 2 can be estimated as
!2
N N T −1 T
ŵ 2 = N −1 ∑ ĥi2 = N −1 ∑ ∑ ∑ v̂ˆit v̂ˆis .
i =1 i =1 t =1 s =t +1
Dividing N −1/2 ∑N
i =1 ĥi by ŵ yields asymptotic standard normality,
∑N ĥi ∑ N ∑ T −1 ∑ T v̂ˆit v̂ˆis d
q = q i =1 = r i =1 t =1 s =t +1 → Normal(0, 1).
2
∑N 2
i =1 ĥi ∑N T −1 T ˆ ˆ
i =1 ∑t =1 ∑s =t +1 v̂it v̂is
ECONOMETRICS
LM principle
ECONOMETRICS
Lagrange multiplier tests (score tests) ?
Recall that the Lagrange multiplier (LM) statistic offers a way to test H0 : c(θo ) = 0
by only estimating the model under the null.
(In our case, estimation under the null is just pooled OLS.)
Let s̃i = si (θ̃) be the score evaluated at the POLS estimate θ̃. This implies that you
(1) have to set up the likelihood function of the unconstrained model,
(2) compute the partial derivatives of `i (θ) with respect to each of the parameters
(also with respect to those which might be restricted under H0 ), and
(3) evaluate this vector of partial derivatives at the restricted estimates.
Hence, you still have to write down the unrestricted model but you only have to
estimate the restricted one.
ECONOMETRICS
Which takes us to ?
The Lagrange multiplier (LM) statistic
!0 !
N N
LM ≡ N N −1
∑ s̃i à −1
N −1
∑ s̃i
i =1 i =1
is distributed asymptotically as χ2Q under H0 , where Q is the number of restrictions.
ECONOMETRICS
Breusch-Pagan LM test
Hypotheses: H0 : σc2 = 0 versus H1 : σc2 6= 0
Estimation under the null: restricted ML estimator = POLS estimator
POLS yields regression residuals ṽit and a ML estimator of σu2 under the null:
N T
1
σ̃u2 =
NT ∑ ∑ ṽit2 .
i =1 t =1
Test statistic: !2
0
NT 1
N ∑N
i =1 ṽi JT ṽi
LM ≡ −1 .
2(T − 1) σ̃u2
Under the null it is asymptotically χ21 distributed.
ECONOMETRICS
An alternative view
It can be shown that the LM statistic can also be written as
2
NT (T − 1) σ̈u2
LM = −1 ,
2 σ̃u2
where
N T
1
σ̃u2 =
NT ∑ ∑ ṽit2
i =1 t =1
is the usual POLS variance estimator and
N T
1
N (T − 1) i =1 t∑
∑
σ̈u2 = (ṽit − ṽ¯i )2
=1
is a within-type variance estimator (but still based on the POLS residuals).
Under the null, both estimators converge towards σu2 but under the alternative, only σ̈u2
does.
ECONOMETRICS
Discussion
I Potential drawback of this test: it is based on the normal distribution.
I Fortunately, Honda (1985, Rev Econ Stud 52(4), 681-690) shows that it is robust
to non-normality.
I A drawback is the two-sided alternative H1 : σc2 6= 0 because σc2 < 0 does not
make sense.
I Therefore, Honda derives a uniformly most powerful test for H0 : σc2 = 0 versus
H1 : σc2 > 0.
I The test statistic turns out to be the root of the Breusch-Pagan LM statistic:
s !
1 N 0 J ṽ
NT N ∑ i = 1 ṽ i T i d
H≡ 2
− 1 → Normal(0, 1).
2(T − 1) σ̃u
It rejects for values of H that exceed the, say, 95% critical value of the standard
normal distribution.
ECONOMETRICS
Implementation in Stata
Use the command xttest0 after a random effects estimation.
First compute the RE estimator:
xtreg y x1 x2 x3, re
Then run the Breusch-Pagan LM test:
xttest0
ECONOMETRICS
Example: Effects of job training grants on scrap rates
Example 10.4 taken from Wooldridge’s textbook
Stata code:
*** load data ***
use "jtrain1.dta", clear
*** set panel ***
xtset fcode year
*** run RE regression with robust s.e.’s, display theta ***
xtreg lscrap d88 d89 union grant grant 1, re vce(robust) theta
*** run Breusch-Pagan LM test ***
xttest0
ECONOMETRICS
Stata output
ECONOMETRICS
Why test for autocorrelation?
Recall that we can always use variance estimators that are robust. Still:
I Economically, it may be interesting whether a kind of partial adjustment is going
on. Recall, e.g., that the transmission of a policy measure may take time if the
model has a distributed lag structure. It can be of particular interest to infer this
structure.
I Recall that vit = ci + uit is autocorrelated with E(vit vis ) = σc2 , t 6= s, whenever
there is an unobserved individual effect ci . Hence, an autocorrelation test is
another way (even if not an efficient one) to test for σc2 > 0.
I Without autocorrelation of vit , OLS might be the best we can do to estimate a
panel equation—the RE estimator is more efficient than OLS only if there is an
error components structure (and thus autocorrelation) in vit .
I Also, remember that the FE estimator is efficient if uit is white noise and the FD
estimator is efficient if eit ≡ ∆uit is white noise.
ECONOMETRICS
Autocorrelation in the error components model
Consider the error components structure
vit = ci + uit
and assume E(ci ) = 0, E(uit ) = 0, and Cov(ci , uit ) = 0. Then vit can be
autocorrelated for different reasons:
(a) If uit is white noise and σc2 > 0, we obtain autocovariance
E(vit vis ) = σc2 .
(b) If uit is autocorrelated, E(uit uis ) = ρs and σc2 = 0, we obtain autocovariance
E(vit vis ) = E(uit uis ) = ρs .
(c) If uit is autocorrelated, E(uit uis ) = ρs and σc2 > 0, we obtain autocovariance
E(vit vis ) = σc2 + ρs .
ECONOMETRICS
Testing for autocorrelation after POLS
Recall that POLS is consistent as long as E(xit0 uit ) = 0 and E(xit0 ci ) = 0.
However, compared to the RE estimator it is inefficient if σc2 > 0.
While the Breusch-Pagan test is better suited, it is straightforward to test
H0 : E(vit vis ) = 0 against H1 : E(vit vis ) 6= 0.
Just keep in mind that rejection of the null does not necessarily imply that σc2 > 0. It
may also be caused by E(uit uis ) 6= 0.
ECONOMETRICS
Residual autocorrelation
Here is a very simple way to test for first-order autocorrelation:
H0 : E(vit vit −1 ) = 0 against H1 : E(vit vit −1 ) 6= 0
I Estimate model yit = xit β + vit by POLS and save the residuals v̂it .
I Regress v̂it on v̂it −1 by POLS and compute the coefficient t statistic (preferably
with a robust variance estimator).
I Reject the null if the absolute t statistic exceeds the critical values of the standard
normal distribution.
I Note that the use of a lagged v̂it −1 as regressor takes away one observation per
individual, thus N observations altogether.
I (In a statistical software, be sure that the correct observations are deleted. In
Stata, execute the xtset command first.)
I Important: consistency of this test hinges on the strict exogeneity assumption, see
Wooldridge (p. 199) for details.
ECONOMETRICS
Implementation in Stata
Example: Data set has identifier for each individual denoted id and for each time
period denoted year.
First tell Stata that you have panel data:
xtset id year
Perform POLS:
regress y x1 x2 x3
Compute residuals:
predict v if e(sample), residuals
Regress residuals on own lag (use the “l.” operator):
regress v l.v, noconstant vce(cluster id)
ECONOMETRICS
Example: Effects of job training grants on scrap rates
Example 10.5 taken from Wooldridge’s textbook
Stata code:
*** load data ***
use "jtrain1.dta", clear
*** set panel ***
xtset fcode year
*** run POLS regression ***
regress lscrap d88 d89 grant grant 1, vce(cluster fcode)
*** Compute residuals ***
predict v if e(sample), residuals
*** Regress residuals on own lag ***
regress v l.v, noconstant vce(cluster fcode)
ECONOMETRICS
Stata output
ECONOMETRICS
Testing for autocorrelation after FE estimation
Since the within transformation wipes out ci , this is effectively a test for
autocorrelation in the remainder disturbance uit .
A complication arises because the within transformation yields üit = uit − ūi which is
autocorrelated even if uit is white noise.
ECONOMETRICS
Residual correlation again
For T > 2, we can proceed as follows to test the hypotheses
H0 : Corr(üit , üit −1 ) = (1 − T )−1 vs. H1 : Corr(üit , üit −1 ) 6= (1 − T )−1 .
I Estimate the model ÿit = ẍit β + üit by FE and save the residuals üˆ it .
I Regress üˆ it on üˆ it −1 by POLS and compute the coefficient t statistic (use the
robust variance estimator because there is autocorrelation under the null).
I Reject the null if the absolute t statistic exceeds the critical values of the standard
normal distribution.
I Note that the use of a lagged üˆ it −1 as regressor takes away one observation per
individual, thus N observations altogether.
I (In a statistical software, be sure that the correct observations are deleted. In
Stata, execute the xtset command first.)
I Important: consistency of this test hinges on the strict exogeneity assumption, see
Wooldridge (p. 311) for details.
ECONOMETRICS
Implementation in Stata
Example: Data set has identifier for each individual denoted id and for each time
period denoted year.
First tell Stata that you have panel data:
xtset id year
Perform FE estimation:
xtreg y x1 x2 x3, fe
Compute FE residuals:
predict u fe if e(sample), e
Regress FE residuals on own lag (use the “l.” operator):
regress u fe l.u fe, noconstant vce(cluster id)
ECONOMETRICS
Example: Effects of job training grants on scrap rates
Example 10.5 taken from Wooldridge’s textbook
Question: How do job training grants affect scrap rates (recall: T = 3)?
Stata code:
*** load data and set panel ***
use "jtrain1.dta", clear
xtset fcode year
*** run POLS regression and compute residuals ***
xtreg lscrap d88 d89 grant grant 1, fe vce(robust)
predict u fe if e(sample), e
*** Regress residuals on own lag with robust s.e.’s ***
regress u fe l.u fe, noconstant vce(cluster fcode)
*** test deviation of coefficient from -1/(T-1) = -1/2 ***
ECONOMETRICS
ECONOMETRICS
Other tests for autocorrelation
Baltagi’s textbook (Chapter 5.2.7) describes several test for autocorrelation, most of
them based on the LM principle.
A good choice is the locally best invariant test by Baltagi and Wu (1999).
You may also use the Durbin-Watson test for panel data.
Both test are implemented in Stata (use the xtregar command with the option lbi)
but critical values need to be looked up.
Therefore, it should be sufficient to either use autocorrelation-consistent standard
errors anyway, or to perform one of the tests described in detail above and use
non-robust standard errors in case the null is not rejected.
If one is interested in the “amount” of autocorrelation, one may specify and estimate
an appropriate model like AR(1) or MA(1). ECONOMETRICS
Coming up
Dynamic Panel Estimators
ECONOMETRICS