Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf ·...

44
1 Henrik Madsen H. Madsen, Time Series Analysis, Chapmann Hall Time Series Analysis Henrik Madsen [email protected] Informatics and Mathematical Modelling Technical University of Denmark DK-2800 Kgs. Lyngby

Transcript of Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf ·...

Page 1: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

1Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Time Series Analysis

Henrik Madsen

[email protected]

Informatics and Mathematical Modelling

Technical University of Denmark

DK-2800 Kgs. Lyngby

Page 2: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

2Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Outline of the lectureIdentification of univariate time series models

Introduction, Sec. 6.1

Estimation of auto-covariance and -correlation, Sec. 6.2.1(and the intro. to 6.2)

Using SACF, SPACF, and SIACF for suggesting modelstructure, Sec. 6.3

Estimation of model parameters, Sec. 6.4

Examples...

Cursory material:The extended linear model class in Sec. 6.4.2

(we’ll come back to the extended model class later)

Page 3: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

3Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Model building in general

1. Identification

2. Estimation

(Prediction, simulation, etc.)

3. Model checking

(Specifying the model order)

(of the model parameters)

Is the model OK ?

Data

physical insight

Theory

No

Yes

Applications using the model

Page 4: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

4Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Identification of univariate time series modelsWhat ARIMA structure would be appropriate for the data athand? (If any)

0 20 40 60 80 100

24

68

12

Given the structure we will then consider how to estimate theparameters (next lecture)

What do we know about ARIMA models which could help us?

Page 5: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

5Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Estimation of the autocovariance functionEstimate of γ(k)

CY Y (k) = C(k) = γ(k) =1

N

N−|k|∑

t=1

(Yt − Y )(Yt+|k| − Y )

It is enough to consider k > 0

S-PLUS: acf(x, type = "covariance")

Page 6: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

6Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Some properties of C(k)

The estimate is a non-negative definite function (as γ(k))

The estimator is non-central :

E[C(k)] =1

N

N−|k|∑

t=1

γ(k) = (1 − |k|N

)γ(k)

Asymptotically central (consistent) for fixed k:E[C(k)] → γ(k) for N → ∞The estimates are autocorrelated them self (don’t trustapparent correlation at high lags too much)

Page 7: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

7Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

How does C(k) behave for non-stationary series?

C(k) =1

N

N−|k|∑

t=1

(Yt − Y )(Yt+|k| − Y )

Page 8: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

7Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

How does C(k) behave for non-stationary series?

C(k) =1

N

N−|k|∑

t=1

(Yt − Y )(Yt+|k| − Y )

0 5 10 15 20 25

7200

7400

7600

7800

8000

Series : arima.sim(model = list(ar = 0.9, ndiff = 1), n = 500)

Page 9: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

8Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Autocorrelation and Partial AutocorrelationSample autocorrelation function (SACF):ρ(k) = rk = C(k)/C(0)

For white noise and k 6= 1 it holds that E[ρ(k)] ≃ 0 andV [ρ(k)] ≃ 1/N , this gives the bounds ±2/

√N for deciding

when it is not possible to distinguish a value from zero.

S-PLUS: acf(x)

Sample partial autocorrelation function (SPACF): Use theYule-Walker equations on ρ(k) (exactly as for the theoreticalrelations)

It turns out that ±2/√

N is also appropriate for deciding whenthe SPACF is zero (more in the next lecture)

S-PLUS: acf(x, type="partial")

Page 10: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

9Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

What would be an appropriate structure?

1

1

0.8 0.9 1.0 1.1 1.2

0.8

0.9

1.0

1.1

1.2

0 20 40 60 80 100

−2

−1

01

2

Lag

AC

F

0 5 10 15 20

−0.

20.

20.

61.

0

Lag

Par

tial A

CF

0 5 10 15 20

−0.

2−

0.1

0.0

0.1

0.2

Page 11: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

10Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

What would be an appropriate structure?

1

1

0.8 0.9 1.0 1.1 1.2

0.8

0.9

1.0

1.1

1.2

0 20 40 60 80 100

−2

02

4

Lag

AC

F

0 5 10 15 20

−0.

20.

20.

61.

0

Lag

Par

tial A

CF

0 5 10 15 20

−0.

20.

00.

20.

40.

6

Page 12: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

11Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

What would be an appropriate structure?

1

1

0.8 0.9 1.0 1.1 1.2

0.8

0.9

1.0

1.1

1.2

0 20 40 60 80 100

−6

−4

−2

02

4

Lag

AC

F

0 5 10 15 20

−0.

20.

20.

61.

0

Lag

Par

tial A

CF

0 5 10 15 20

−0.

40.

00.

40.

8

Page 13: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

12Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

What would be an appropriate structure?

1

1

0.8 0.9 1.0 1.1 1.2

0.8

0.9

1.0

1.1

1.2

0 20 40 60 80 100

−4

−2

02

4

Lag

AC

F

0 5 10 15 20

−0.

50.

00.

51.

0

Lag

Par

tial A

CF

0 5 10 15 20

−0.

6−

0.2

0.0

0.2

Page 14: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

13Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

What would be an appropriate structure?

1

1

0.8 0.9 1.0 1.1 1.2

0.8

0.9

1.0

1.1

1.2

0 20 40 60 80 100

−2

−1

01

23

Lag

AC

F

0 5 10 15 20

−0.

20.

20.

61.

0

Lag

Par

tial A

CF

0 5 10 15 20

−0.

20.

00.

20.

40.

6

Page 15: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

14Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

What would be an appropriate structure?

1

1

0.8 0.9 1.0 1.1 1.2

0.8

0.9

1.0

1.1

1.2

0 20 40 60 80 100

−2

−1

01

23

Lag

AC

F

0 5 10 15 20

−0.

20.

20.

61.

0

Lag

Par

tial A

CF

0 5 10 15 20

−0.

20.

00.

20.

4

Page 16: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

15Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

What would be an appropriate structure?

1

1

0.8 0.9 1.0 1.1 1.2

0.8

0.9

1.0

1.1

1.2

0 20 40 60 80 100

−15

0−

130

−11

0−

90

Lag

AC

F

0 5 10 15 20

−0.

20.

20.

61.

0

Lag

Par

tial A

CF

0 5 10 15 20

−0.

40.

00.

40.

8

Page 17: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

16Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Example of data from an MA(2)-process

1

1

0.8 0.9 1.0 1.1 1.2

0.8

0.9

1.0

1.1

1.2

0 20 40 60 80 100

−4

−2

02

4

Lag

AC

F

0 5 10 15 20

−0.

50.

00.

51.

0

Lag

Par

tial A

CF

0 5 10 15 20

−0.

6−

0.2

0.0

0.2

Page 18: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

17Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Example of data from a non-stationary process

1

1

0.8 0.9 1.0 1.1 1.2

0.8

0.9

1.0

1.1

1.2

0 20 40 60 80 100

−40

020

4060

80

Lag

AC

F

0 5 10 15 20

−0.

20.

20.

61.

0

Lag

Par

tial A

CF

0 5 10 15 20

−0.

20.

20.

61.

0

Page 19: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

18Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Same series; analysing ∇Yt = (1 − B)Yt = Yt − Yt−1

1

1

0.8 0.9 1.0 1.1 1.2

0.8

0.9

1.0

1.1

1.2

0 20 40 60 80 100

−4

−2

02

4

Lag

AC

F

0 5 10 15

−0.

20.

20.

61.

0

Lag

Par

tial A

CF

0 5 10 15

−0.

20.

20.

6

Page 20: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

19Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Identification of the order of differencingSelect the order of differencing d as the first order for which theautocorrelation decreases sufficiently fast towards 0

In practice d is 0, 1, or maybe 2

Sometimes a periodic difference is required, e.g. Yt − Yt−12

Remember to consider the practical application . . . it may bethat the system is stationary, but you measured over a tooshort period

Page 21: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

20Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Stationarity vs. length of measuring periodUS/CA 30 day interest rate differential

1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996

−0.

5−

0.1

0.1

0.3

US/CA 30 day interest rate differential

Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q31990 1991 1992 1993 1994 1995 1996

−0.

5−

0.4

−0.

3−

0.2

−0.

10.

0

Page 22: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

21Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Identification of the ARMA-partCharacteristics for the autocorrelation functions:

ACF ρ(k) PACF φkk

AR(p) Damped exponentialand/or sine functions φkk = 0 for k > p

MA(q)ρ(k) = 0 for k > q

Dominated by dampedexponential and or/sinefunctions

ARMA(p, q) Damped exponentialand/or sine functionsafter lag q − p

Dominated by dampedexponential and/or sinefunctions after lag p − q

The IACF is similar to the PACF; see the book page 133

Page 23: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

22Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Behaviour of the SACF ρ(k) (based on N obs.)If the process is white noise then

±2

√1

N

is an approximate 95% confidence interval for the SACF forlags different from 0

If the process is a MA(q)-process then

±2

√1 + 2(ρ2(1) + . . . + ρ2(q))

N

is an approximate 95% confidence interval for the SACF forlags larger than q

Page 24: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

23Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Behaviour of the SPACF φkk (based on N obs.)If the process is a AR(p)-process then

±2

√1

N

is an approximate 95% confidence interval for the SPACF forlags larger than p

Page 25: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

24Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Model building in general

1. Identification

2. Estimation

(Prediction, simulation, etc.)

3. Model checking

(Specifying the model order)

(of the model parameters)

Is the model OK ?

Data

physical insight

Theory

No

Yes

Applications using the model

Page 26: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

25Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

EstimationWe have an appropriate model structure AR(p), MA(q),ARMA(p, q), ARIMA(p, d, q) with p, d, and q known

Task : Based on the observations find appropriate values ofthe parameters

The book describes many methods:Moment estimatesLS-estimatesPrediction error estimates• Conditioned• UnconditionedML-estimates• Conditioned• Unconditioned (exact)

Page 27: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

26Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

ExampleUsing the autocorre-lation functions weagreed that

yt+1|t = a1yt + a2yt−1

and we would selecta1 and a2 so that thesum of the squaredprediction errors gotso small as possiblewhen using the modelon the data at hand

Page 28: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

26Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

ExampleUsing the autocorre-lation functions weagreed that

yt+1|t = a1yt + a2yt−1

and we would selecta1 and a2 so that thesum of the squaredprediction errors gotso small as possiblewhen using the modelon the data at hand

To comply with the notation of the book we will write the 1-stepforecasts as yt+1|t = −φ1yt − φ2yt−1

Page 29: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

27Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

The errors given the parameters ( φ1 and φ2)Observations: y1, y2, . . . , yN

Errors: et+1|t = yt+1 − yt+1|t = yt+1 − (−φ1yt − φ2yt−1)

Page 30: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

27Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

The errors given the parameters ( φ1 and φ2)Observations: y1, y2, . . . , yN

Errors: et+1|t = yt+1 − yt+1|t = yt+1 − (−φ1yt − φ2yt−1)

e3|2 = y3 + φ1y2 + φ2y1

e4|3 = y4 + φ1y3 + φ2y2

e5|4 = y5 + φ1y4 + φ2y3

...eN |N−1 = yN + φ1yN−1 + φ2yN−2

Page 31: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

27Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

The errors given the parameters ( φ1 and φ2)Observations: y1, y2, . . . , yN

Errors: et+1|t = yt+1 − yt+1|t = yt+1 − (−φ1yt − φ2yt−1)

e3|2 = y3 + φ1y2 + φ2y1

e4|3 = y4 + φ1y3 + φ2y2

e5|4 = y5 + φ1y4 + φ2y3

...eN |N−1 = yN + φ1yN−1 + φ2yN−2

y3...yN

=

−y2 −y1...

...−yN−1 −yN−2

[

φ1

φ2

]+

e3|2...eN |N−1

Page 32: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

27Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

The errors given the parameters ( φ1 and φ2)Observations: y1, y2, . . . , yN

Errors: et+1|t = yt+1 − yt+1|t = yt+1 − (−φ1yt − φ2yt−1)

e3|2 = y3 + φ1y2 + φ2y1

e4|3 = y4 + φ1y3 + φ2y2

e5|4 = y5 + φ1y4 + φ2y3

...eN |N−1 = yN + φ1yN−1 + φ2yN−2

y3...yN

=

−y2 −y1...

...−yN−1 −yN−2

[

φ1

φ2

]+

e3|2...eN |N−1

Or just:

Y = Xθ + ε

Page 33: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

28Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

SolutionTo minimize the sum of the squared 1-step prediction errors ε

Tε we

use the result for the General Linear Model from Chapter 3:

θ = (XTX)−1

XTY

With

X =

−y2 −y1...

...−yN−1 −yN−2

and Y =

y3...yN

The method is called the LS-estimator for dynamical systems

The method is also in the class of prediction error methodssince it minimize the sum of the squared 1-step predictionerrors

Page 34: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

28Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

SolutionTo minimize the sum of the squared 1-step prediction errors ε

Tε we

use the result for the General Linear Model from Chapter 3:

θ = (XTX)−1

XTY

With

X =

−y2 −y1...

...−yN−1 −yN−2

and Y =

y3...yN

The method is called the LS-estimator for dynamical systems

The method is also in the class of prediction error methodssince it minimize the sum of the squared 1-step predictionerrors

How does it generalize to AR(p)-models?

Page 35: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

29Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Small illustrative example using S-PLUS> obs[1] -3.51 -3.81 -1.85 -2.02 -1.91 -0.88> N <- length(obs); Y <- obs[3:N]> Y[1] -1.85 -2.02 -1.91 -0.88> X <- cbind(-obs[2:(N-1)], -obs[1:(N-2)])> X

[,1] [,2][1,] 3.81 3.51[2,] 1.85 3.81[3,] 2.02 1.85[4,] 1.91 2.02> solve(t(X) %*% X, t(X) %*% Y) # Estimates

[,1][1,] -0.1474288[2,] -0.4476040

Page 36: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

30Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Maximum likelihood estimatesARMA(p, q)-process:

Yt + φ1Yt−1 + · · · + φpYt−p = εt + θ1εt−1 + · · · + θqεt−q

Notation:θ

T = (φ1, . . . , φp, θ1, . . . , θq)

YTt = (Yt, Yt−1, . . . , Y1)

The Likelihood function is the joint probability distributionfunction for all observations for given values of θ and σ2

ε :

L(YN ;θ, σ2ε) = f(YN |θ, σ2

ε)

Given the observations YN we estimate θ and σ2ε as the

values for which the likelihood is maximized.

Page 37: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

31Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

The likelihood function for ARMA(p, q)-modelsThe random variable YN |YN−1 only contains εN as a randomcomponent

εN is a white noise process at time N and does therefore notdepend on anything

We therefore know that the random variables YN |YN−1 andYN−1 are independent, hence:

f(YN |θ, σ2ε ) = f(YN |YN−1,θ, σ2

ε)f(YN−1|θ, σ2ε)

Repeating these arguments:

L(YN ;θ, σ2ε) =

N∏

t=p+1

f(Yt|Yt−1,θ, σ2ε)

f(Yp|θ, σ2ε)

Page 38: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

32Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

The conditional likelihood functionEvaluation of f(Yp|θ, σ2

ε) requires special attention

It turns out that the estimates obtained using the conditionallikelihood function:

L(YN ;θ, σ2ε) =

N∏

t=p+1

f(Yt|Yt−1,θ, σ2ε)

results in the same estimates as the exact likelihood functionwhen many observations are available

For small samples there can be some difference

Software:The S-PLUS function arima.mle calculate conditionalestimatesThe R function arima calculate exact estimates

Page 39: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

33Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Evaluating the conditional likelihood functionTask : Find the conditional densities given specified values ofthe parameters θ and σ2

ε

The mean of the random variable Yt|Yt−1 is the the 1-stepforecast Yt|t−1

The prediction error εt = Yt − Yt|t−1 has variance σ2ε

We assume that the process is Gaussian:

f(Yt|Yt−1,θ, σ2ε) =

1

σε

√2π

e−(Yt−bYt|t−1(θ))2/2σ2

ε

And therefore:

L(YN ;θ, σ2ε) = (σ2

ε2π)−N−p

2 exp

− 1

2σ2ε

N∑

t=p+1

ε2t (θ)

Page 40: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

34Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

ML-estimates

The (conditional) ML-estimate θ is a prediction error estimatesince it is obtained by minimizing

S(θ) =N∑

t=p+1

ε2t (θ)

By differentiating w.r.t. σ2ε it can be shown that the ML-estimate

of σ2ε is

σ2ε = S(θ)/(N − p)

The estimate θ is asymptoticly “good” and thevariance-covariance matrix is approximately 2σ2

εH−1 where H

contains the 2nd order partial derivatives of S(θ) at theminimum

Page 41: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

35Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Finding the ML-estimates using the PE-method1-step predictions:

Yt|t−1 = −φ1Yt−1 − · · · − φpYt−p + θ1εt−1 + · · · + θqεt−q

If we use εp = εp−1 = · · · = εp+1−q = 0 we can find:

Yp+1|p = −φ1Yp − · · · − φpY1 + θ1εp + · · · + θqεp+1−q

Which will give us εp+1 = Yp+1 − Yp+1|p and we can then

calculate Yp+2|p+1 and εp+1 . . . and so on until we have all the1-step prediction errors we need.

We use numerical optimization to find the parameters whichminimize the sum of squared prediction errors

Page 42: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

36Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

S(θ) for (1 + 0.7B)Yt = (1 − 0.4B)εt with σ2ε = 0.252

−0.4

−0.2

0.0

0.2

0.4

0.6

0.8

1.0

−1.0 −0.5 0.0 0.5

MA−parameter

AR

−pa

ram

eter

Data: arima.sim(model=list(ar=−0.7,ma=0.4), n=500, sd=0.25)

30

35

40

45

Page 43: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

37Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Moment estimatesGiven the model structure: Find formulas for the theoreticalautocorrelation or autocovariance as function of theparameters in the model

Estimate, e.g. calculate the SACF

Solve the equations by using the lowest lags necessary

Complicated!

General properties of the estimator unknown!

Page 44: Time Series Analysis - Technical University of Denmarkhm/time.series.analysis/slides/lect07.pdf · 2007. 8. 23. · Henrik Madsen 2 H. Madsen, Time Series Analysis, Chapmann Hall

38Henrik Madsen

H. Madsen, Time Series Analysis, Chapmann Hall

Moment estimates for AR(p)-processesIn this case moment estimates are simple to find due to theYule-Walker equations. We simply plug in the estimatedautocorrelation function in lags 1 to p:

ρ(1)

ρ(2)...

ρ(p)

=

1 ρ(1) · · · ρ(p − 1)

ρ(1) 1 · · · ρ(p − 2)...

......

ρ(p − 1) ρ(p − 2) · · · 1

−φ1

−φ2...

−φp

and solve w.r.t. the φ’s

The function ar in S-PLUS does this