Lecture 11 Seasonal ARIMA Colin Rundel 02/22/2017 1 Seasonal - - PowerPoint PPT Presentation

lecture 11
SMART_READER_LITE
LIVE PREVIEW

Lecture 11 Seasonal ARIMA Colin Rundel 02/22/2017 1 Seasonal - - PowerPoint PPT Presentation

Lecture 11 Seasonal ARIMA Colin Rundel 02/22/2017 1 Seasonal Models 2 Australian Wine Sales Example (Lecture 6) Australian total wine sales by wine makers in bottles <= 1 litre. Jan 1980 3 Aug 1994. wineind 35000 25000 15000


slide-1
SLIDE 1

Lecture 11

Seasonal ARIMA

Colin Rundel 02/22/2017

1

slide-2
SLIDE 2

Seasonal Models

2

slide-3
SLIDE 3

Australian Wine Sales Example (Lecture 6)

Australian total wine sales by wine makers in bottles <= 1 litre. Jan 1980 – Aug 1994.

wineind

1980 1985 1990 1995 15000 25000 35000 5 10 15 20 25 30 35 −0.2 0.2 0.4 0.6 0.8 Lag ACF 5 10 15 20 25 30 35 −0.2 0.2 0.4 0.6 0.8 Lag PACF

3

slide-4
SLIDE 4

Differencing

diff(wineind)

1980 1985 1990 1995 −25000 −10000 10000 5 10 15 20 25 30 35 −0.5 0.0 0.5 Lag ACF 5 10 15 20 25 30 35 −0.5 0.0 0.5 Lag PACF

4

slide-5
SLIDE 5

Seasonal ARIMA

We can extend the existing ARIMA model to handle these higher order lags (without having to include all of the intervening lags). Seasonal ARIMA (p, d, q) × (P, D, Q)s:

ΦP(Ls) ϕp(L) ∆D

s ∆d yt = δ + ΘQ(Ls) θq(L) wt

where

p L

1

1L 2L2 pLp q L

1

1L 2L2 pLq d

1 L d

P Ls

1

1Ls 2L2s PLPs Q Ls

1

1L 2L2s pLQs D s

1 Ls D

5

slide-6
SLIDE 6

Seasonal ARIMA

We can extend the existing ARIMA model to handle these higher order lags (without having to include all of the intervening lags). Seasonal ARIMA (p, d, q) × (P, D, Q)s:

ΦP(Ls) ϕp(L) ∆D

s ∆d yt = δ + ΘQ(Ls) θq(L) wt

where

ϕp(L) = 1 − ϕ1L − ϕ2L2 − . . . − ϕpLp θq(L) = 1 + θ1L + θ2L2 + . . . + θpLq ∆d = (1 − L)d ΦP(Ls) = 1 − Φ1Ls − Φ2L2s − . . . − ΦPLPs ΘQ(Ls) = 1 + Θ1L + Θ2L2s + . . . + θpLQs ∆D

s = (1 − Ls)D 5

slide-7
SLIDE 7

Seasonal ARIMA for wineind

Lets consider an ARIMA(0, 0, 0) × (1, 0, 0)12:

(1 − Φ1L12) yt = δ + wt

yt = Φ1yt−12 + δ + wt

(m1 = Arima(wineind, seasonal=list(order=c(1,0,0), period=12))) ## Series: wineind ## ARIMA(0,0,0)(1,0,0)[12] with non-zero mean ## ## Coefficients: ## sar1 mean ## 0.8780 24489.243 ## s.e. 0.0314 1154.487 ## ## sigma^2 estimated as 6906536: log likelihood=-1643.39 ## AIC=3292.78 AICc=3292.92 BIC=3302.29

6

slide-8
SLIDE 8

Fitted model

20000 30000 40000 1980 1985 1990 1995

time sales

wineind model

Model 1 − ARIMA (0,0,0) x (0,1,0)[12] [RMSE: 2613.05] 7

slide-9
SLIDE 9

Residuals

m1$residuals

1980 1985 1990 1995 −10000 5000 5 10 15 20 25 30 35 −0.2 0.0 0.1 0.2 Lag ACF 5 10 15 20 25 30 35 −0.2 0.0 0.1 0.2 Lag PACF

8

slide-10
SLIDE 10

Model 2

ARIMA(0, 0, 0) × (0, 1, 1)12:

(1 − L12)yt = δ + (1 + Θ1L12)wt

yt − yt−12 = δ + wt + Θ1wt−12 yt = δ + yt−12 + wt + Θ1wt−12

(m2 = Arima(wineind, order=c(0,0,0), seasonal=list(order=c(0,1,1), period=12))) ## Series: wineind ## ARIMA(0,0,0)(0,1,1)[12] ## ## Coefficients: ## sma1 ##

  • 0.3246

## s.e. 0.0807 ## ## sigma^2 estimated as 6588531: log likelihood=-1520.34 ## AIC=3044.68 AICc=3044.76 BIC=3050.88

9

slide-11
SLIDE 11

Fitted model

20000 30000 40000 1980 1985 1990 1995

time sales

wineind model

Model 2 − ARIMA (0,0,0) x (0,1,1)[12] [RMSE: 2470.2] 10

slide-12
SLIDE 12

Residuals

m2$residuals

1980 1985 1990 1995 −10000 5000 5 10 15 20 25 30 35 −0.2 0.0 0.1 0.2 Lag ACF 5 10 15 20 25 30 35 −0.2 0.0 0.1 0.2 Lag PACF

11

slide-13
SLIDE 13

Model 3

ARIMA(3, 0, 0) × (0, 1, 1)12

(1 − ϕ1L − ϕ2L2 − ϕ3L3) (1 − L12)yt = δ + (1 + Θ1L)wt (1 − ϕ1L − ϕ2L2 − ϕ3L3) (yt − yt−12) = δ + wt + wt−12

yt = δ +

3

i=1

ϕiyt−1 + yt−12 −

3

i=1

ϕiyt−12−i + wt + wt−12

(m3 = Arima(wineind, order=c(3,0,0), seasonal=list(order=c(0,1,1), period=12))) ## Series: wineind ## ARIMA(3,0,0)(0,1,1)[12] ## ## Coefficients: ## ar1 ar2 ar3 sma1 ## 0.1402 0.0806 0.3040

  • 0.5790

## s.e. 0.0755 0.0813 0.0823 0.1023 ## ## sigma^2 estimated as 5948935: log likelihood=-1512.38 ## AIC=3034.77 AICc=3035.15 BIC=3050.27

12

slide-14
SLIDE 14

Fitted model

20000 30000 40000 1980 1985 1990 1995

time sales

wineind model

Model 3 − ARIMA (3,0,0) x (0,1,1)[12] [RMSE: 2325.54] 13

slide-15
SLIDE 15

Model - Residuals

m3$residuals

1980 1985 1990 1995 −5000 5000 5 10 15 20 25 30 35 −0.2 −0.1 0.0 0.1 0.2 Lag ACF 5 10 15 20 25 30 35 −0.2 −0.1 0.0 0.1 0.2 Lag PACF

14

slide-16
SLIDE 16

Federal Reserve Board Production Index

15

slide-17
SLIDE 17

prodn from the astsa package

Monthly Federal Reserve Board Production Index (1948-1978)

prodn

1950 1955 1960 1965 1970 1975 1980 40 80 120 5 10 15 20 25 30 35 −0.2 0.2 0.6 1.0 Lag ACF 5 10 15 20 25 30 35 −0.2 0.2 0.6 1.0 Lag PACF

16

slide-18
SLIDE 18

Differencing

Based on the ACF it seems like standard differencing may be required

diff(prodn)

1950 1955 1960 1965 1970 1975 1980 −10 −5 5 5 10 15 20 25 30 35 −0.2 0.2 0.4 0.6 0.8 Lag ACF 5 10 15 20 25 30 35 −0.2 0.2 0.4 0.6 0.8 Lag PACF

17

slide-19
SLIDE 19

Differencing + Seasonal Differencing

Additional seasonal differencing also seems warranted

(fr_m1 = Arima(prodn, order = c(0,1,0), seasonal = list(order=c(0,0,0), period=12))) ## Series: prodn ## ARIMA(0,1,0) ## ## sigma^2 estimated as 7.147: log likelihood=-891.26 ## AIC=1784.51 AICc=1784.52 BIC=1788.43 (fr_m2 = Arima(prodn, order = c(0,1,0), seasonal = list(order=c(0,1,0), period=12))) ## Series: prodn ## ARIMA(0,1,0)(0,1,0)[12] ## ## sigma^2 estimated as 2.52: log likelihood=-675.29 ## AIC=1352.58 AICc=1352.59 BIC=1356.46

18

slide-20
SLIDE 20

Residuals

fr_m2$residuals

1950 1955 1960 1965 1970 1975 1980 −6 −2 2 4 6 5 10 15 20 25 30 35 −0.4 −0.2 0.0 0.2 Lag ACF 5 10 15 20 25 30 35 −0.4 −0.2 0.0 0.2 Lag PACF

19

slide-21
SLIDE 21

Adding Seasonal MA

(fr_m3.1 = Arima(prodn, order = c(0,1,0), seasonal = list(order=c(0,1,1), period=12))) ## Series: prodn ## ARIMA(0,1,0)(0,1,1)[12] ## ## Coefficients: ## sma1 ##

  • 0.7151

## s.e. 0.0317 ## ## sigma^2 estimated as 1.616: log likelihood=-599.29 ## AIC=1202.57 AICc=1202.61 BIC=1210.34 (fr_m3.2 = Arima(prodn, order = c(0,1,0), seasonal = list(order=c(0,1,2), period=12))) ## Series: prodn ## ARIMA(0,1,0)(0,1,2)[12] ## ## Coefficients: ## sma1 sma2 ##

  • 0.7624

0.0520 ## s.e. 0.0689 0.0666 ## ## sigma^2 estimated as 1.615: log likelihood=-598.98 ## AIC=1203.96 AICc=1204.02 BIC=1215.61 20

slide-22
SLIDE 22

Adding Seasonal MA (cont.)

(fr_m3.3 = Arima(prodn, order = c(0,1,0), seasonal = list(order=c(0,1,3), period=12))) ## Series: prodn ## ARIMA(0,1,0)(0,1,3)[12] ## ## Coefficients: ## sma1 sma2 sma3 ##

  • 0.7853
  • 0.1205

0.2624 ## s.e. 0.0529 0.0644 0.0529 ## ## sigma^2 estimated as 1.506: log likelihood=-587.58 ## AIC=1183.15 AICc=1183.27 BIC=1198.69 21

slide-23
SLIDE 23

Residuals - Model 3.3

fr_m3.3$residuals

1950 1955 1960 1965 1970 1975 1980 −6 −2 2 4 5 10 15 20 25 30 35 −0.2 0.0 0.1 0.2 0.3 Lag ACF 5 10 15 20 25 30 35 −0.2 0.0 0.1 0.2 0.3 Lag PACF

22

slide-24
SLIDE 24

Adding AR

(fr_m4.1 = Arima(prodn, order = c(1,1,0), seasonal = list(order=c(0,1,3), period=12))) ## Series: prodn ## ARIMA(1,1,0)(0,1,3)[12] ## ## Coefficients: ## ar1 sma1 sma2 sma3 ## 0.3393

  • 0.7619
  • 0.1222

0.2756 ## s.e. 0.0500 0.0527 0.0646 0.0525 ## ## sigma^2 estimated as 1.341: log likelihood=-565.98 ## AIC=1141.95 AICc=1142.12 BIC=1161.37 (fr_m4.2 = Arima(prodn, order = c(2,1,0), seasonal = list(order=c(0,1,3), period=12))) ## Series: prodn ## ARIMA(2,1,0)(0,1,3)[12] ## ## Coefficients: ## ar1 ar2 sma1 sma2 sma3 ## 0.3038 0.1077

  • 0.7393
  • 0.1445

0.2815 ## s.e. 0.0526 0.0538 0.0539 0.0653 0.0526 ## ## sigma^2 estimated as 1.331: log likelihood=-563.98 ## AIC=1139.97 AICc=1140.2 BIC=1163.26 23

slide-25
SLIDE 25

Residuals - Model 4.1

fr_m4.1$residuals

1950 1955 1960 1965 1970 1975 1980 −6 −2 2 4 5 10 15 20 25 30 35 −0.15 −0.05 0.05 0.15 Lag ACF 5 10 15 20 25 30 35 −0.15 −0.05 0.05 0.15 Lag PACF

24

slide-26
SLIDE 26

Residuals - Model 4.2

fr_m4.2$residuals

1950 1955 1960 1965 1970 1975 1980 −6 −2 2 4 5 10 15 20 25 30 35 −0.15 −0.05 0.05 0.15 Lag ACF 5 10 15 20 25 30 35 −0.15 −0.05 0.05 0.15 Lag PACF

25

slide-27
SLIDE 27

Model Fit

60 90 120 150 1950 1960 1970 1980

time sales

prodn model

Model 4.1 − ARIMA (1,1,0) x (0,1,3)[12] [RMSE: 1.131] 26

slide-28
SLIDE 28

Model Forecast

Forecasts from ARIMA(1,1,0)(0,1,3)[12]

1950 1955 1960 1965 1970 1975 1980 50 100 150

27

slide-29
SLIDE 29

Model Forecast (cont.)

Forecasts from ARIMA(1,1,0)(0,1,3)[12]

1975 1976 1977 1978 1979 1980 1981 1982 50 100 150

28

slide-30
SLIDE 30

Model Forecast (cont.)

Forecasts from ARIMA(1,1,0)(0,1,3)[12]

1950 1960 1970 1980 1990 50 100 150 200 250 300

29

slide-31
SLIDE 31

Model Forecast (cont.)

Forecasts from ARIMA(1,1,0)(0,1,3)[12]

1975 1980 1985 1990 50 100 150 200 250 300

30

slide-32
SLIDE 32

Exercise - Cortecosteroid Drug Sales

Monthly cortecosteroid drug sales in Australia from 1992 to 2008.

library(fpp) tsdisplay(h02,points=FALSE)

h02

1995 2000 2005 0.4 0.8 1.2 5 10 15 20 25 30 35 −0.6 −0.2 0.2 0.6 Lag ACF 5 10 15 20 25 30 35 −0.6 −0.2 0.2 0.6 Lag PACF

31

slide-33
SLIDE 33

Hint

ts.intersect(h02, log(h02)) %>% plot()

0.4 0.6 0.8 1.0 1.2 h02 −1.0 −0.6 −0.2 0.2 1995 2000 2005 log(h02) Time

. 32