Anda di halaman 1dari 25

Correlogram
ARMA models example

Marco Sunder

Nov 04 2010

Marco Sunder

1/ 25

Correlogram
ARMA models example

Contents

Correlogram

## ARMA models example

Marco Sunder

2/ 25

Correlogram
ARMA models example

Music

Marco Sunder

3/ 25

Correlogram
ARMA models example

Music

Marco Sunder

4/ 25

Correlogram
ARMA models example

We often assume that our time series have constant first and second
moments (covariance stationarity).
Trends in the data have to be dealt with.
(Linear) time trends are easy to spot, but what about stochastic trends
(unit roots)?
Simplest possible process with a unit root: random walk
yt = 1 yt1 + t
is white noise
yt = y0 + 1 + 2 + ... + t
Shocks long ago do not lose their effect on todays yt (persistence)
Difficult to distinguish this from AR(1) with 1 = 0.95 in small samples!
Marco Sunder

5/ 25

Correlogram
ARMA models example

Marco Sunder

6/ 25

Correlogram
ARMA models example

The Augmented Dickey-Fuller test (ADF) starts from an AR(p)
model plus a linear time trend (as an alternative trend specification.
E.g.: AR(2) model
yt = + t + 1 yt1 + 2 yt2 + t
A unit root would imply 1 + 2 = 1.
Rewriting the equation yields
yt yt1 = + t + (1 + 2 1)yt1 2 yt1 + 2 yt2 + t
yt

= + t +

Marco Sunder

yt1

2 yt1

+ t

7/ 25

Correlogram
ARMA models example

Test can easily be extended to larger p, just include p 1 augmenting
lags:
p1
X
yt = + t + yt1 +
j ytj + t
j=1

Estimate the equation by OLS and choose p 1 such that the residuals
are not correlated anymore.
Null hypothesis of a single unit root: = 0 (H1 : < 0)
Caution: this test requires special critical t-values!
Critical values of ADF test statistic in large samples
Deterministic regressors
10%
5%
1%
Intercept only
2.57
2.86
3.43
Intercept and time trend
3.12
3.41
3.96
Marco Sunder

8/ 25

Correlogram
ARMA models example

4.5

lnsp500
5.5

6.5

1980m1

1985m1

1990m1

1995m1

time

## Figure: Logarithm of S&P 500 index

Marco Sunder

9/ 25

Correlogram
ARMA models example

## Figure: Testing for a unit root in the levels

Marco Sunder

10/ 25

Correlogram
ARMA models example

## Figure: Testing for a unit root in the first differences

Marco Sunder

11/ 25

Correlogram
ARMA models example

Correlogram
Autocovariances of y :
k = E[(yt )(ytk )] , k = 0, 1, 2, ...
0 denotes the variance of a process
The autocorrelation function (ACF) is the sequence of correlation
coefficients k = j /0
Empirical counterpart:
1 PT
)(yt y )
t=k+1 (ytk y
T
k =
P
T
1
)2
t=1 (yt y
T
The partial autocorrelation function (PACF) gives the strength of
the association between the time series and its k th lag after controlling
for lags 1 through k 1.
Marco Sunder

12/ 25

Correlogram
ARMA models example

Correlogram
ACF and PACF may help you in determining what kind of ARMA(p,q)
process may have generated a time series.
Pure AR processes tend to have many spikes in the ACF and few ones
in the PACF
The opposite is the case for pure MA processes
White noise has no autocorrelation at all (except lag zero)
If the ACF remains close to 1 for many lags, chances are the time series
is not stationary
Is there any (significant) autocorrelation?
Ljung-Box test statistic:
Q = T (T + 2)

m
X
k=1

1
2
T k k

## For white noise: Q 2m

Marco Sunder

13/ 25

Correlogram
ARMA models example

Correlogram
hprescott lnsp500, stub(hp) smooth(14400)

## Figure: Time series of lnsp500 deviations from HP trend

Marco Sunder

14/ 25

Correlogram
ARMA models example

Correlogram
ac hp_lnsp500_1, ylab(-1(0.5)1) lags(52)

## Figure: Autocorrelation function of HP deviations

Marco Sunder

15/ 25

Correlogram
ARMA models example

Correlogram
pac hp_lnsp500_1, ylab(-1(0.5)1) lags(52)

## Figure: Partial autocorrelation function of HP deviations

Marco Sunder

16/ 25

Correlogram
ARMA models example

Correlogram

## Figure: Correlogram in STATA

Marco Sunder

17/ 25

Correlogram
ARMA models example

ARMA models

## Figure: ARMA(2,0) model for lnsp500 deviations from HP trend

Marco Sunder

18/ 25

Correlogram
ARMA models example

ARMA models

## Figure: ARMA(2,1) model for lnsp500 deviations from HP trend

Marco Sunder

19/ 25

Correlogram
ARMA models example

ARMA models
Estimated ARMA(2,0) process:
yt = 0.001 + 1.213yt1 0.365yt2 + t
T = 189,

AIC = 777.3,

BIC = 764.3

## Estimated ARMA(2,1) process:

yt = 0.001 + 1.176yt1 0.332yt2 + t + 0.043 t1
T = 189,

AIC = 775.3,

BIC = 759.1

## How could one select a preferred specification?

Akaike information criterion: AIC = 2 ln L + 2(# parameters)
Schwarz Bayesian information criterion:
BIC = 2 ln L + (# parameters) ln T
Less is better! BIC tends to favor more parsimonious specifications.
Marco Sunder

20/ 25

Correlogram
ARMA models example

## Frequency domain analysis

Autocovariances of a stationary process1 can be cast into the frequency
domain (Fourier transform).
The resulting spectral density function f (spectrum) helps us identify
cyclical features of the process: are there frequency bands that
contribute heavily to the overall variance?
Spectral density of a covariance-stationary process

X
X
f () =
k exp{i2k} = 0 + 2
k cos(2k)
k=

k=1

## frequency [0, 0.5]

imaginary number 1

1

## with the property

k=

|k | <
Marco Sunder

21/ 25

Correlogram
ARMA models example

## Frequency domain analysis: periodogram

If you have a time series rather than a theoretical process, you could
use the Fourier transform formula and replace k by its estimate k .
The result is called periodogram:
f() = 0 + 2

T
1
X

j cos(2k)

k=1

## Problem: Periodogram is not a consistent estimator of the spectral

density as its variance does not approach zero with T . Longer
time horizons imply that more covariances can be estimated.
Covariances are not all based on the same subsample.
Alternative 1: smoothing the periodogram
Alternative 2: obtain spectrum from theoretical covariances implied by
ARMA model
Marco Sunder

22/ 25

Correlogram
ARMA models example

## Frequency domain analysis: periodogram

pergram hp_lnsp500_1

## Figure: Periodogram for HP-filtered lnsp500

Marco Sunder

23/ 25

Correlogram
ARMA models example

## ARMA models: spectral analysis

ARMA processes imply certain autocorrelation structures
These can be used to construct the spectral density of the process
Spectrum of an ARMA(p,q) process
P
| 1 qh=1 h exp{i2h} |2
P
f () =
| 1 pj=1 j exp{i2j} |2

## frequency [0, 0.5]

imaginary number 1

## Set q = 1, 1 = 0 if you have a pure AR model

Marco Sunder

24/ 25

Correlogram
ARMA models example

## ARMA models: spectral analysis

arima hp_lnsp500_1, arima(8,0,0)
do armaspec

Marco Sunder