Marcel Dettling Institute for Data Analysis and Process Design - - PowerPoint PPT Presentation

marcel dettling
SMART_READER_LITE
LIVE PREVIEW

Marcel Dettling Institute for Data Analysis and Process Design - - PowerPoint PPT Presentation

Applied Time Series Analysis FS 2011 Week 14 Marcel Dettling Institute for Data Analysis and Process Design Zurich University of Applied Sciences marcel.dettling@zhaw.ch http://stat.ethz.ch/~dettling ETH Zrich, May 30, 2011 Marcel


slide-1
SLIDE 1

1

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

Marcel Dettling

Institute for Data Analysis and Process Design Zurich University of Applied Sciences

marcel.dettling@zhaw.ch http://stat.ethz.ch/~dettling

ETH Zürich, May 30, 2011

slide-2
SLIDE 2

2

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

Non-Linear Models: ARIMA and SARIMA

Why? We have seen that many time series we encounter in prac- tice show trends and/or seasonality. While we could de- compose them and model the stationary part, it might also be attractive to directly model a non-stationary series. How does it work? There is a mechanism, "the integration" or "the seasonal integration" which takes care of the deterministic features, while the remainder is modeled using an ARMA(p,q). There are some peculiarities!  see blackboard!

slide-3
SLIDE 3

3

Applied Time Series Analysis

FS 2011 – Week 14

Example: Australian Beer Production

Logged Australian Beer Production

Time log(beer) 1960 1965 1970 1975 1980 1985 1990 4.2 4.6 5.0 5.4

Logged Australian Beer Production, diff with lag 1

Time diff(log(beer)) 1960 1965 1970 1975 1980 1985 1990

  • 0.4

0.0 0.4

slide-4
SLIDE 4

4

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

ARIMA(p,d,q)-Models

Idea: Fit an ARMA(p,q) to a time series where the dth

  • rder difference with lag 1 was taken before.

Example: If , then Notation: With backshift-operator B() Stationarity: ARIMA-models are usually non-stationary! Advantage: it‘s easier to forecast in R!

1

(1 ) ~ ( , )

t t t t

Y X X B X ARMA p q

    ( )(1 ) ( )

d t t

B B X B E     ~ ( ,1, )

t

X ARIMA p q

slide-5
SLIDE 5

5

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

Fitting and Forecasting

We start by fitting an ARIMA(0,1,1) to the beer series: fit <- arima(log(beer), order=c(0,1,1)) > fit Call: arima(x = log(beer), order = c(0, 1, 1)) Coefficients: ma1

  • 0.2934

s.e. 0.0529 sigma^2 estimated as 0.01734 log likelihood = 240.28, aic = -476.57

slide-6
SLIDE 6

6

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

Fitting and Forecasting

We start by fitting an ARIMA(0,1,1) to the beer series: > fit.111 <- arima(log(beer), order=c(1,1,1)) > fit.111 Call: arima(x = log(beer), order = c(1, 1, 1)) Coefficients: ar1 ma1 0.5094 -0.9422 s.e. 0.0469 0.0125 sigma^2 estimated as 0.01491 log likelihood = 269.51, aic = -533.01

slide-7
SLIDE 7

7

Applied Time Series Analysis

FS 2011 – Week 14

Forecasting Australian Beer Production

Time 1985 1986 1987 1988 1989 1990 1991 4.8 5.0 5.2

Forecast of log(beer), ARIMA(0,1,1)

Time 1985 1986 1987 1988 1989 1990 1991 4.8 5.0 5.2

Forecast of log(beer), ARIMA(1,1,1)

slide-8
SLIDE 8

8

Applied Time Series Analysis

FS 2011 – Week 14

Residual Analysis of the ARIMA(1,1,1)

Time series 1960 1965 1970 1975 1980 1985 1990

  • 0.4
  • 0.2

0.0 0.2

  • 0.5

0.5 Lag k Auto-Korr. 5 10 15 20 25

  • 0.4

0.2 Lag k

  • part. Autokorr

1 5 10 15 20 25

slide-9
SLIDE 9

9

Applied Time Series Analysis

FS 2011 – Week 14

ACF/PACF: Differenced Original Series

Time series 1960 1965 1970 1975 1980 1985 1990

  • 0.4
  • 0.2

0.0 0.2 0.4 0.0 1.0 Lag k Auto-Korr. 5 10 15 20 25

  • 0.4

0.0 Lag k

  • part. Autokorr

1 5 10 15 20 25

slide-10
SLIDE 10

10

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

Beer Series: Results

  • From the residuals, we cleary observe that the fitted models

are not adequate, and thus the forecasts are not to be trusted

  • It seems as if we failed to include the seasonality into the
  • model. This is visible from the residuals.
  • However, this is also visible from ACF/PACF of the original

(differenced) series. This is where we made the "mistake" in the first place.

  • We need more complex models which can also deal with
  • seasonality. They exist, see the following slides...
slide-11
SLIDE 11

11

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

SARIMA(p,d,q)(P,D,Q)s

= a.k.a. Airline Model. We are looking at the log-trsf. airline data

Log-Transformed Airline Data

Time AirPassengers 1950 1952 1954 1956 1958 1960 100 200 300 400 600

slide-12
SLIDE 12

12

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

SARIMA(p,d,q)(P,D,Q)s

  • r at the log-transformed Australian Beer Production

Time log(beer) 1960 1965 1970 1975 1980 1985 1990 4.2 4.4 4.6 4.8 5.0 5.2 5.4

Logged Australian Beer Production

slide-13
SLIDE 13

13

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

SARIMA(p,d,q)(P,D,Q)s

We perform some differencing… ( see blackboard)

slide-14
SLIDE 14

14

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

ACF/PACF of SARIMA(p,d,q)(P,D,Q)s

Time series 1950 1952 1954 1956 1958 1960

  • 0.15
  • 0.10
  • 0.05

0.00 0.05 0.10 0.15 0.0 0.5 1.0 Lag k Auto-Korr. 5 10 15 20

  • 0.4
  • 0.1

0.2 Lag k

  • part. Autokorr

1 5 10 15 20

slide-15
SLIDE 15

15

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

Modeling the Airline Data

Since there are “big gaps” in ACF/PACF: This is an MA(13)-model with many coefficients equal to 0,

  • r equivalently, a SARIMA(0,1,1)(0,1,1)12.

Note: Every SARIMA(p,d,q)(P,D,Q)s can be written as an ARMA(p+sP,q+sQ), where many coefficients will be equal to 0.

12 1 1

(1 )(1 )

t t

Z B B E     

1 1 1 12 1 1 13 t t t t

E E E E    

  

   

slide-16
SLIDE 16

16

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

SARIMA(p,d,q)(P,D,Q)s

The general notation is: Interpretation:

  • ne typically chooses d=D=1
  • s = periodicity in the data (season)
  • P,Q describe the dependency on multiples of the period

 see blackboard

(1 ) (1 ) ( ) ( ) ( ) ( )

d s D t t s s s t t

Y B B X B B Y B B E        

slide-17
SLIDE 17

17

Applied Time Series Analysis

FS 2011 – Week 14

Forecasting Australian Beer Production

Time 1985 1986 1987 1988 1989 1990 1991 4.8 4.9 5.0 5.1 5.2 5.3

Forecast of log(beer), SARIMA(1,1,1)(1,0,0)

slide-18
SLIDE 18

18

Applied Time Series Analysis

FS 2011 – Week 14

Residual Analysis of SARIMA(1,1,1)(1,1,0)

Time series 1960 1965 1970 1975 1980 1985 1990

  • 0.2
  • 0.1

0.0 0.1 0.2

  • 0.2

0.6 Lag k Auto-Korr. 5 10 15 20 25

  • 0.3

0.0 Lag k

  • part. Autokorr

1 5 10 15 20 25

slide-19
SLIDE 19

19

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

Outlook to Non-Linear Models

What are linear models? Models which can be written as a linear combination of i.e. all AR-, MA- and ARMA-models What are non-linear models? Everything else, e.g. non-linear combinations of , terms like in the linear combination, and much more! Motivation for non-linear models?

  • modeling cyclic behavior with quicker increase then decrease
  • non-constant variance, even after transforming the series

t

X

t

X

2 t

X

slide-20
SLIDE 20

20

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

Simulated ARCH(1)-Process

Time x 200 400 600 800 1000

  • 6
  • 4
  • 2

2

Simulated ARCH(1) process

slide-21
SLIDE 21

21

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

Residuals from a Fitted ARCH(1)

x

Time Series 200 400 600 800 1000

  • 6
  • 4
  • 2

2

Residuals

Time Series 200 400 600 800 1000

  • 4
  • 2

2 4

slide-22
SLIDE 22

22

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

ARCH(1) is Long-Tailed

Histogram of x

Series Frequency

  • 6
  • 4
  • 2

2 4 200 400

Histogram of Residuals

Series Frequency

  • 4
  • 2

2 4 100 250

slide-23
SLIDE 23

23

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

ARCH(1) is Long-Tailed

  • 3
  • 2
  • 1

1 2 3

  • 6
  • 4
  • 2

2

Q-Q Plot of x

Normal Quantiles Sample Quantiles

  • 3
  • 2
  • 1

1 2 3

  • 4
  • 2

2 4

Q-Q Plot of Residuals

Normal Quantiles Sample Quantiles

slide-24
SLIDE 24

24

Marcel Dettling, Zurich University of Applied Sciences

Applied Time Series Analysis

FS 2011 – Week 14

Dependency in the Squared Series

5 10 15 20 25 30 0.0 0.4 0.8 Lag ACF

ACF of Squared x

5 10 15 20 25 30 0.0 0.4 0.8 Lag ACF

ACF of Squared Residuals