Lecture 11. Time Series
Lecture 11. Time Series
1
Based on lecture notes by Nicolas de Roos.
Simon Kwok ECMT5001 L11 1 / 57 Simon Kwok ECMT5001 L11 2 / 57
Simon Kwok ECMT5001 L11 Time series data 3 / 57 Simon Kwok ECMT5001 L11 Time series data 4 / 57
Time series models: Examples Classical assumptions of the time series model
Simon Kwok ECMT5001 L11 Time series data 5 / 57 Simon Kwok ECMT5001 L11 Time series data 6 / 57
Simon Kwok ECMT5001 L11 Time series data 7 / 57 Simon Kwok ECMT5001 L11 Time series data 8 / 57
Properties of OLS Classical assumptions
TS.4 Homoskedasticity
2
Theorem (Unbiasedness of OLS) Var (ut |X) = Var (ut ) =
Under assumptions TS.1 - TS.3, the OLS estimators are unbiased:
the error variance is independent of the x’s
E ( ˆj ) = j, j = 0, 1, . . . , k the error variance is constant over time
Assumptions TS.1 - TS.3 ensure unbiasedness but they do not allow us to TS.5 No serial correlation
derive variances
Corr (ut , us |X) = 0, t 6= s
we need two more assumptions to derive the estimator variances
if TS.5 fails, the model su↵ers from autocorrelation or serial
correlation
Simon Kwok ECMT5001 L11 Time series data 9 / 57 Simon Kwok ECMT5001 L11 Time series data 10 / 57
Theorem (Variance of the OLS estimators) Theorem (Estimation of the error variance)
Under assumptions TS.1-5, the variance of the OLS estimator is Under assumptions TS.1-5,
2 SSR
Var ( ˆj |X) = , j = 1, . . . , k E (ˆ 2 ) = 2
, ˆ2 =
SSTj (1 Rj2 ) n k 1
Simon Kwok ECMT5001 L11 Time series data 11 / 57 Simon Kwok ECMT5001 L11 Time series data 12 / 57
Inference with time series Outline
The conditions for valid inference are similar to the cross section context
for small samples we need to assume normality of errors
2 Trends in time series
I this ensures we can use the t distribution
for large samples, we can rely on a version of the Central Limit 3 Autocorrelation
Theorem for asymptotic normality
I we can then use the t distribution as an approximation
4 Detecting autocorrelation
Simon Kwok ECMT5001 L11 Time series data 13 / 57 Simon Kwok ECMT5001 L11 Trends in time series 14 / 57
Linear trend
Economic time series often have a trend
yt = ↵ 0 + ↵ 1 t + u t
growth or inflation causes many macroeconomic variables to have a
common trend
e.g. GDP, retail sales, imports, exports, etc. Quadratic trend
Simon Kwok ECMT5001 L11 Trends in time series 15 / 57 Simon Kwok ECMT5001 L11 Trends in time series 16 / 57
Seasonality Seasonality
Consider a seasonal time series with a linear trend
Often we observe periodic patterns in the data
e.g. sales in December may be higher than other months yt = 0 + 1t + 1 d1t + 2 d2t + 3 d3t + ut
e.g. demand for heating may be higher in winter
Predicted values
e.g. demand for soft drinks may be higher in summer
ŷt = ˆ0 + ˆ1 t + ˆ1 if t is in Quarter 1
We can use seasonal dummy variables ŷt = ˆ0 + ˆ1 t + ˆ2 if t is in Quarter 2
e.g. with quarterly data we could use 3 dummies
ŷt = ˆ0 + ˆ1 t + ˆ3 if t is in Quarter 3
d1 = 1 if period is in Quarter 1, else d1 = 0 ŷt = ˆ0 + ˆ1 t if t is in Quarter 4
d2 = 1 if period is in Quarter 2, else d2 = 0
d3 = 1 if period is in Quarter 3, else d3 = 0 hypothesis test for a trend H0 : 1 =0
hypothesis test for seasonality H0 : 1 = 2 = 3 =0
Simon Kwok ECMT5001 L11 Trends in time series 17 / 57 Simon Kwok ECMT5001 L11 Trends in time series 18 / 57
Outline Autocorrelation
Autocorrelation
1 Time series data
error terms are correlated with their previous values
violates assumption TS.5
2 Trends in time series
Corr (ut , us |X) = 0, t 6= s
3 Autocorrelation
Consequences of autocorrelation for the OLS estimator
unbiased (as long as the other TS assumptions are met)
4 Detecting autocorrelation
incorrect variance
we cannot perform inference
5 Remedies for autocorrelation
Note: implications are similar to heteroskedasticity
Simon Kwok ECMT5001 L11 Autocorrelation 19 / 57 Simon Kwok ECMT5001 L11 Autocorrelation 20 / 57
Causes of autocorrelation Business cycle example
Regression line fitted to business cycle data
1. Inertia alternating residual patterns: positive, negative, positive, . . .
a random variable continues its state of motion until hit by an
external force
e.g. cycles in economic time series persist until there is an external
shock
Simon Kwok ECMT5001 L11 Autocorrelation 21 / 57 Simon Kwok ECMT5001 L11 Autocorrelation 22 / 57
Simon Kwok ECMT5001 L11 Autocorrelation 23 / 57 Simon Kwok ECMT5001 L11 Autocorrelation 24 / 57
Functional form example Causes of autocorrelation
3. Data smoothing
data are often “smoothed” by official agencies
well meaning attempt to remove trends or cycles
Common examples
moving averages
seasonal adjustment
interpolation between data periods (e.g. between Census years)
Simon Kwok ECMT5001 L11 Autocorrelation 25 / 57 Simon Kwok ECMT5001 L11 Autocorrelation 26 / 57
2 Trends in time series Residual plots are an informal test for autocorrelation
1. plot of residuals against time
3 Autocorrelation 2. plot of residuals against their lagged values
4 Detecting autocorrelation
Simon Kwok ECMT5001 L11 Detecting autocorrelation 27 / 57 Simon Kwok ECMT5001 L11 Detecting autocorrelation 28 / 57
Detection: Graphical analysis Detection: Graphical analysis
Plot of residuals against time Plot of residuals against time
plot shows a run of positive ût followed by a run of negative ût residuals constantly change from positive to negative
suggests positive autocorrelation (0 < ⇢ < 1) suggests negative autocorrelation ( 1 < ⇢ < 0)
Simon Kwok ECMT5001 L11 Detecting autocorrelation 29 / 57 Simon Kwok ECMT5001 L11 Detecting autocorrelation 30 / 57
Simon Kwok ECMT5001 L11 Detecting autocorrelation 31 / 57 Simon Kwok ECMT5001 L11 Detecting autocorrelation 32 / 57
Detection: Graphical analysis Detection: Graphical analysis
Plot of ût against ût 1 Plot of ût against ût 1
if residuals are negatively correlated we should see a negative if residuals are uncorrelated we should see no obvious relationship
relationship
Simon Kwok ECMT5001 L11 Detecting autocorrelation 33 / 57 Simon Kwok ECMT5001 L11 Detecting autocorrelation 34 / 57
Simon Kwok ECMT5001 L11 Detecting autocorrelation 35 / 57 Simon Kwok ECMT5001 L11 Detecting autocorrelation 36 / 57
t test: estimating ⇢ t test: steps
Simon Kwok ECMT5001 L11 Detecting autocorrelation 37 / 57 Simon Kwok ECMT5001 L11 Detecting autocorrelation 38 / 57
If ⇢ ⇡ 0 then d ⇡ 2
no evidence of first order autocorrelation
The Durbin-Watson test uses the statistic
Pn If d is “close” to zero
2
(ût ût 1) significant positive first order autocorrelation
d = t=2Pn 2
t=1 ût
If d approaches 4
d is closely related to ⇢ˆ since, for large n significant negative first order autocorrelation
Simon Kwok ECMT5001 L11 Detecting autocorrelation 39 / 57 Simon Kwok ECMT5001 L11 Detecting autocorrelation 40 / 57
Durbin-Watson test: Steps Breusch-Godfrey test
Simon Kwok ECMT5001 L11 Detecting autocorrelation 41 / 57 Simon Kwok ECMT5001 L11 Detecting autocorrelation 42 / 57
yt = 0 + 1 xt + ut
The BG test has some advantages over the DW test
2. Obtain the residuals ût 1. it can test for higher orders of autocorrelation
3. Regress ût on all the x’s and ût 1, . . . , ût q 2. the original model can include lagged y ’s as regressors
4. (For large n) Use the R 2 from this auxiliary regression to calculate the
(LM) test statistic The DW test is not applicable for models with lagged y ’s as explanatory
2 2 variables
(n q)R ⇠ q (q degrees of freedom)
Simon Kwok ECMT5001 L11 Detecting autocorrelation 43 / 57 Simon Kwok ECMT5001 L11 Detecting autocorrelation 44 / 57
Outline Remedies for autocorrelation
Simon Kwok ECMT5001 L11 Remedies for autocorrelation 45 / 57 Simon Kwok ECMT5001 L11 Remedies for autocorrelation 46 / 57
Suppose the errors follow an AR(1) process and consider a BLUE estimator yt 1 = 0 + 1 xt 1 + ut 1
Multiply by ⇢
Consider the simple regression model
⇢yt 1 =⇢ 0 + ⇢ 1 xt 1 + ⇢ut 1
yt = 0 + 1 xt + ut , ut = ⇢ut 1 + et , 1<⇢<1
Subtract this from our original model
where
yt ⇢yt 1 = 0 (1 ⇢) + 1 (xt ⇢xt 1) + (ut ⇢ut 1)
2
et ⇠ N(0, ), Cov (et , es ) = 0, for all t 6= s
The transformed white noise error term is
et = u t ⇢ut 1
Simon Kwok ECMT5001 L11 Remedies for autocorrelation 47 / 57 Simon Kwok ECMT5001 L11 Remedies for autocorrelation 48 / 57
The GLS estimator GLS properties
yt⇤ = ⇤
0 + ⇤
1 x1 + et , Note: we lose 1 observation when making the transformation because
y1 ⇢y0 is not available
where
for large n this is not a problem
yt⇤ = yt ⇢yt 1, xt⇤ = xt ⇢xt 1,
⇤
0 = 0 (1 ⇢).
Simon Kwok ECMT5001 L11 Remedies for autocorrelation 49 / 57 Simon Kwok ECMT5001 L11 Remedies for autocorrelation 50 / 57
yt = 0 + 1 xt + ut
How do we obtain the transformed variables yt⇤ and xt⇤ ?
2. Obtain the residuals ût
we need to know ⇢ to calculate
3. Regress ût on ût 1 to obtain an estimate of ⇢
yt⇤ = yt ⇢yt 1, xt⇤ = xt ⇢xt 1 4. Estimate the transformed equation by OLS
where
⇤
0 = (1 ⇢ˆ) 0, yt⇤ = yt ⇢ˆyt 1, xt⇤ = xt ⇢ˆxt 1
Simon Kwok ECMT5001 L11 Remedies for autocorrelation 51 / 57 Simon Kwok ECMT5001 L11 Remedies for autocorrelation 52 / 57
Feasible GLS: Issues Feasible GLS: Remarks
Simon Kwok ECMT5001 L11 Remedies for autocorrelation 53 / 57 Simon Kwok ECMT5001 L11 Remedies for autocorrelation 54 / 57
Simon Kwok ECMT5001 L11 Remedies for autocorrelation 55 / 57 Simon Kwok ECMT5001 L11 Remedies for autocorrelation 56 / 57
Summary
1. OLS inference is valid with time series data under similar assumptions
to the cross-section model
2. Strict exogeneity is required for unbiasedness
3. If errors are autocorrelated, OLS estimates remain unbiased, but
inference is invalid
4. Autocorrelation can be detected graphically or with formal tests (e.g.
t, Durbin-Watson, Breusch-Godfrey)
5. Two possible remedies
a. calculate robust standard errors: inference is valid, but OLS estimates
are inefficient
b. estimate by GLS: GLS estimates are BLUE