Slides Commands
Slides Commands
M ARKUS E BERHARDT
University of Nottingham
email: [email protected]
web: http://sites.google.com/site/medevecon (code, data),
http://twitter.com/sjoh2052 (data updates)
2 Introduction
The two worlds of panel data econometrics
Why not just one world?
The domain of panel time series
5 Cointegration testing
7 Outlook
2 Introduction
The two worlds of panel data econometrics
Why not just one world?
The domain of panel time series
5 Cointegration testing
7 Outlook
2 Introduction
The two worlds of panel data econometrics
Why not just one world?
The domain of panel time series
5 Cointegration testing
7 Outlook
ȳi♣ −1
E[ȳi♣ ] = µi Var[ȳi♣ ] = T −1 σ2ε
X
= T yit
t
ȳt♠ −1
E[ȳt♠ ] = µt = µ Var[ȳt♠ ] = N −1 (σ2ε + σ2η )
X
= N yit
i
20
8 8
15
6 6
10
4
5 4
0 2
2
1850 1900 1950 2000
year 0 5 10 15 20
Note: GDP pc (in logs) is plotted in grey (left axis),
Rainfall (cumulative) for Fortaleza (in m)
cumulative rainfall (in m) in black (right axis). Note: GDP pc (in logs) is on the y-axis
Taken from: Eberhardt & Teal (2011) ‘No mangos in the tundra: spatial
heterogeneity in agricultural productivity analysis’, Working paper.
2 Introduction
The two worlds of panel data econometrics
Why not just one world?
The domain of panel time series
5 Cointegration testing
7 Outlook
yt = a + ρyt−1 + εt
⇔ ∆yt = a + (ρ − 1) yt−1 + εt = a + byt−1 + εt (1)
| {z }
b
Dickey-Fuller (DF) test: One way of testing the unit root hypothesis
H0 : ρ = 1 is to compute the t-ratio for yt−1 in equation (1). Since
this involves a definitely I(0) variable on the LHS and a potentially
I(1) variable on the RHS the t-ratio does not have a standard
t-distribution, but ‘Dickey-Fuller distribution’.
The Augmented Dickey-Fuller (ADF) test takes potential serial
correlation in the error term into account — this is achieved by
introducing lagged terms of the dependent variable. Alternative
testing procedures use other parametric or nonparametric
techniques to wash out serial correlation.
F by far the most serious short-coming. Consider the power statistics for
time-series unit root tests:
AR coefficient DF ADF PP
0.25 0.90 0.93 0.95
0.65 0.25 0.78 0.89
0.95 0.09 0.15 0.20
Recall: ‘power’ of a test is its ability to reject the null when it is false; ‘size’ is the
probability of rejecting the null when it is actually true.
Code:
xtfisher lny, lags(1) and
pescadf lny, lags(1) for each variable/lag-length or
multipurt lny lnl lnk lnrd, lags(3)
Table from: Eberhardt, Helmers & Strauss (forthcoming) ‘Do spillovers matter
when estimating private returns to R&D?’, The Review of Economics and Statistics
Markus Eberhardt (Nottingham) Panel Time Series in Stata 2011 21 / 42
1 Overview
Revelance, Approach and References
2 Introduction
The two worlds of panel data econometrics
Why not just one world?
The domain of panel time series
5 Cointegration testing
7 Outlook
Code:
xtcd lny lnl lnk lnrd (Panel A)
Table from: Eberhardt, Helmers & Strauss (forthcoming) ‘Do spillovers matter
when estimating private returns to R&D?’, The Review of Economics and Statistics
2 Introduction
The two worlds of panel data econometrics
Why not just one world?
The domain of panel time series
5 Cointegration testing
7 Outlook
Major approaches
Run some regression, collect residuals and test for stationarity
(‘residual-based tests’)
Construct an error correction model and investigate whether
the EC term is significant (‘error correction tests’)
¢ K 1i K 3i
∆yit = ci + a0i yi,t−1 − bi xi,t−1 + a1ij ∆yi,t−j + a2ij ∆xi,t−j + uit
¡ X X
(3)
j=1 j=−K2i
where a0i is the error correction/speed of adjustment term. Note that penultimate
term includes lags and leads of ∆x, otherwise need to assume exogeneity of x.
Estimate separately ∀ i (appropriate Ki ). If a0i = 0 → no error-correction → y, x not
cointegrated. a0i < 0 → EC → cointegration. In total 4 tests, based on ‘group
mean’, ‘pooled panel’ idea. Large negative values reject H0 of no cointegration.
If CSD is suspected: use bootstrap to obtain robust critical values.
With a little effort this can be coded in Stata — all you’re doing is running
country-regressions. I am currently working on this command: xtectest.
2 Introduction
The two worlds of panel data econometrics
Why not just one world?
The domain of panel time series
5 Cointegration testing
7 Outlook
Taken from: Eberhardt, Helmers & Strauss (forthcoming) ‘Do spillovers matter
when estimating private returns to R&D?’, The Review of Economics and Statistics
Code:
xtmg lny lnl lnk lnrd, trend res(r mg) ([3])
xtmg lny lnl lnk lnrd, cce res(r cmg) ([5])
xtmg lny lnl lnk lnrd, cce trend res(r cmg) ([6])
In I(1) panels this estimator allows for mix of cointegration (λi > 0) and
noncointegration (λi = 0).
2 Introduction
The two worlds of panel data econometrics
Why not just one world?
The domain of panel time series
5 Cointegration testing
7 Outlook