Pure Seasonal Models ARIMA Modeling with R Pure Seasonal Models O - - PowerPoint PPT Presentation

pure seasonal models
SMART_READER_LITE
LIVE PREVIEW

Pure Seasonal Models ARIMA Modeling with R Pure Seasonal Models O - - PowerPoint PPT Presentation

ARIMA MODELING WITH R Pure Seasonal Models ARIMA Modeling with R Pure Seasonal Models O en collect data with a known seasonal component Air Passengers (1 cycle every S = 12 months) Johnson & Johnson Earnings (1 cycle every


slide-1
SLIDE 1

ARIMA MODELING WITH R

Pure Seasonal Models

slide-2
SLIDE 2

ARIMA Modeling with R

Pure Seasonal Models

  • Oen collect data with a known seasonal component
  • Air Passengers (1 cycle every S = 12 months)
  • Johnson & Johnson Earnings (1 cycle every S = 4 quarters)
slide-3
SLIDE 3

ARIMA Modeling with R

Pure Seasonal Models

  • Consider pure seasonal models such as an SAR(P = 1)s = 12

Xt = ΦXt−12 + Wt

slide-4
SLIDE 4

ARIMA Modeling with R

ACF and PACF of Pure Seasonal Models

SAR(P)s SMA(Q)s SARMA(P, Q)s ACF* Tails off Cuts off lag QS Tails off PACF* Cuts off lag PS Tails off Tails off * The values at the nonseasonal lags are zero SAR(1)1 SMA(1)1

slide-5
SLIDE 5

ARIMA MODELING WITH R

Let’s practice!

slide-6
SLIDE 6

ARIMA MODELING WITH R

Mixed Seasonal Models

slide-7
SLIDE 7

ARIMA Modeling with R

Mixed Seasonal Model

  • Consider a SARIMA(0, 0, 1) x (1, 0, 0)12 model

Xt = ΦXt−12 + Wt + θWt−1

  • SAR(1): Value this month is related to 


last year’s value

  • MA(1): This month’s value related to last 


month’s shock

Xt−12 Wt−1

  • Mixed model: SARIMA(p, d, q) x (P, D, Q)s model
slide-8
SLIDE 8

ARIMA Modeling with R

ACF and PACF of SARIMA(0,0,1) x (1,0,0) s=12

  • The ACF and PACF for this mixed model:

Xt = .8Xt−12 + Wt − .5Wt−1

Seasonal Non-seasonal

slide-9
SLIDE 9

ARIMA Modeling with R

Seasonal Persistence

Hawaiian Quarterly Occupancy Rate

Time x 2002 2004 2006 2008 2010 2012 2014 2016 65 70 75 80 85 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4

Seasonal Component

Quarterly Occupancy Rate: 
 % rooms filled Seasonal Component: 
 this year vs. last year Q1 ≈ Q1, Q2 ≈ Q2, 
 Q3 ≈ Q3, Q4 ≈ Q4

Seasonal Component

Time Qx 2002 2004 2006 2008 2010 2012 2014 2016

  • 4
  • 2

2 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4

Remove seasonal persistence by a seasonal difference: 
 Xt - Xt-4 or D = 1, S = 4 for quarterly data

Seasonal Difference

Time diff(x, 4) 2004 2006 2008 2010 2012 2014 2016

  • 10
  • 5

5 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4

slide-10
SLIDE 10

ARIMA Modeling with R

Air Passengers

  • Monthly totals of international airline passengers, 1949-1960

x: AirPassengers dlx: diff(lx) ddlx: diff(dlx, 12) lx: log(x)

slide-11
SLIDE 11

ARIMA Modeling with R

Air Passengers: ACF and PACF of ddlx

  • Seasonal: ACF cuing off at lag 1s (s = 12); PACF tailing
  • ff at lags 1s, 2s, 3s…
  • Non-Seasonal: ACF and PACF both tailing off
slide-12
SLIDE 12

ARIMA Modeling with R

Air Passengers

> airpass_fit1 <- sarima(log(AirPassengers), p = 1, d = 1, q = 1, P = 0, D = 1, Q = 1, S = 12) > airpass_fit1$ttable Estimate SE t.value p.value ar1 0.1960 0.2475 0.7921 0.4296 ma1 -0.5784 0.2132 -2.7127 0.0075 sma1 -0.5643 0.0747 -7.5544 0.0000 > airpass_fit2 <- sarima(log(AirPassengers), 0, 1, 1, 0, 1, 1, 12) > airpass_fit2$ttable Estimate SE t.value p.value ma1 -0.4018 0.0896 -4.4825 0 sma1 -0.5569 0.0731 -7.6190 0

slide-13
SLIDE 13

ARIMA Modeling with R

Air Passengers

Standardized Residuals

Time 1950 1952 1954 1956 1958 1960 −3 −1 1 2 3

Model: (0,1,1) (0,1,1) [12]

0.5 1.0 1.5 −0.2 0.2 0.4

ACF of Residuals

LAG ACF

  • −2

−1 1 2 −3 −1 1 2 3

Normal Q−Q Plot of Std Residuals

Theoretical Quantiles Sample Quantiles

  • 5

10 15 20 25 30 35 0.0 0.4 0.8

p values for Ljung−Box statistic

lag p value

slide-14
SLIDE 14

ARIMA MODELING WITH R

Let’s practice!

slide-15
SLIDE 15

ARIMA MODELING WITH R

Forecasting Seasonal ARIMA

slide-16
SLIDE 16

ARIMA Modeling with R

Forecasting ARIMA Processes

  • Once model is chosen, forecasting is easy because the

model describes how the dynamics of the time series behave over time

  • Simply continue the model dynamics into the future
  • In the astsa package, use sarima.for() for

forecasting

slide-17
SLIDE 17

ARIMA Modeling with R

Forecasting Air Passengers

> sarima.for(log(AirPassengers), n.ahead = 24, 0, 1, 1, 0, 1, 1, 12)

  • In the previous video, we decided that a

SARIMA(0,1,1)x(0,1,1)12 model was appropriate

Time log(AirPassengers) 1954 1956 1958 1960 1962 5.5 6.0 6.5

slide-18
SLIDE 18

ARIMA MODELING WITH R

Let’s practice!

slide-19
SLIDE 19

ARIMA MODELING WITH R

Congratulations!

slide-20
SLIDE 20

ARIMA Modeling with R

What you’ve learned

  • How to identify an ARMA model from data looking at

ACF and PACF

  • How to use integrated ARMA (ARIMA) models for

nonstationary time series

  • How to cope with seasonality
slide-21
SLIDE 21

ARIMA Modeling with R

Don’t stop here!

  • astsa-package
  • Other DataCamp courses in Time Series Analysis
slide-22
SLIDE 22

ARIMA MODELING WITH R

Thank you!