Professional Documents
Culture Documents
Spring 2016
1 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
2 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
Last Unit
3 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
This Unit
4 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
Motivation
In Unit 15, we looked at the pure seasonal ARMA model, and the
multiplicative seasonal ARMA model. These models assumed
stationarity. In this unit, we consider non-stationarity and apply
differencing to the non-seasonal and seasonal components.
5 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
1 Seasonal Trend
2 SARIMA Model
4 Worked Example
6 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
Seasonal Trend
xt = St + yt
7 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
Seasonal Trend
St = St−s = St+s
where s is the length of the period. For example, for monthly data,
a reasonable choice of s is 12. For quarterly data, s = 4. Think
about
t
St = cos(2π ).
s
Then St is a periodic function with period s. How can we get rid
of this trend? In the past, we’ve done a number of things namely
regression, smoothing, and differencing.
8 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
Seasonal Trend
9 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
Seasonal Trend
∇D s D
s = (1 − B ) .
10 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
1 Seasonal Trend
2 SARIMA Model
4 Worked Example
11 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
SARIMA Model
12 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
SARIMA Model
(1 − B 12 )(1 − B)xt =
13 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
SARIMA Model
ΦP (B s )φ(B)∇D d s
s ∇ xt = α + ΘQ (B )θ(B)wt , (1)
14 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
SARIMA Model
where
φ(B) = 1 − φ1 B − φ2 B 2 − · · · − φp B p
θ(B) = 1 + θ1 B + θ2 B 2 + · · · + θq B q
ΦP (B s ) = 1 − Φ1 B s − Φ2 B 2s − · · · − ΦP B Ps
ΘQ (B s ) = 1 + Θ1 B s + Θ2 B 2s + · · · + ΘQ B Qs
∇d xt = (1 − B)d xt , ∇D s D
s xt = (1 − B ) xt
15 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
SARIMA Model
16 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
SARIMA Model
Question: Identify the following as a multiplicative seasonal
ARIMA model
17 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
SARIMA Model
The rest of the analysis is very similar to what we did for the
regular ARIMA models. We will use plotting including ACF and
PACF to help discover s and also the amount of differencing that
is necessary. Then we will attempt to fit appropriate models using
AIC and parameter estimates to guide us. We will use the same
diagnostics to evaluate the appropriateness of the fits.
18 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
1 Seasonal Trend
2 SARIMA Model
4 Worked Example
19 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
Just like how we built ARIMA models in unit 14, the main steps in
building SARIMA models consist of the following:
• Exploratory data analysis.
• Model estimation.
• Model diagnostics.
• Model selection.
20 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
We typically look at
• the time series plot,
• the ACF,
• and the PACF
of the data. This step guides us to our choice for the elements of
the SARIMA model, p, d, q, P, D, Q, s.
21 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
With the time series plot, we examine for trend and seasonality.
Typically, understanding what the data describes will help us know
what the period is (month, quarterly, etc), and what lags to look
out for, so you should have an idea of what value s is.
22 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
23 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
24 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
Model Estimation
After exploratory data analysis, you should have an idea (or ideas)
about the values of p, d, q, P, D, Q, s. When using R, I highly
suggest using the original data, and then specify the values of the
differencing used.
25 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
estimated coefficient
z= .
s.e. of coefficient
If |z| > 1.96, the estimated coefficient is significantly different
from 0. This is exactly what was done with ARIMA models.
26 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
Model Diagnostics
27 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
Model Diagnostics
28 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
Model Selection
If model diagnostics suggest more than one model works, here are
some issues to keep in mind when comparing models:
• Smaller MSE, AIC, etc.
• Simpler model.
• Standard errors of forecasts.
29 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
1 Seasonal Trend
2 SARIMA Model
4 Worked Example
30 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
●
500
●
●
450
●
●
●
●
●
400
● ●
● ●
● ● ●
●
● ●
beer
●
● ●
● ●
●
350
●
●
●
●
● ●
● ●
● ●
● ● ● ●
● ● ●
●
300
●
● ●
● ● ●
●
● ●
● ● ●
● ● ● ●
250
●
● ●
● ●
● ●
● ● ● ●
0 10 20 30 40 50 60 70
Time
40
100
30
20
50
diff(beer, 1)
diff(beer, 4)
10
0
0
−10
−50
−20
0 10 30 50 70 0 10 30 50 70
Time Time
Comments?
32 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
0
−20
−40
0 10 20 30 40 50 60
Time
d = 1, D = 1, s = 4 appear to be reasonable.
33 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
Examine the ACF and PACF of the data after both differencing
operations.
ACF with both differencing PACF with both differencing
0.2
0.2
0.0
0.0
Partial ACF
ACF
−0.2
−0.2
−0.4
−0.4
−0.6
−0.6
5 10 15 5 10 15
Lag Lag
34 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
35 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
36 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
0 10 20 30 40 50 60 70
Time
ACF of Residuals
−0.2 0.2 0.6 1.0
ACF
0 5 10 15
Lag
0.4
●
● ●
●
● ● ●
● ● ● ●
0.0
2 4 6 8 10 12
lag
37 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
Let’s check the AIC , AICc , and BIC for the remaining two models.
> f1.cri
[1] 5.812033 5.852437 4.938514
> f3.cri
[1] 5.786946 5.827350 4.913428
38 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
Coefficients:
ar1 ma1 sma1 sma2
-0.3311 -0.7182 -0.5798 0.0042
s.e. 0.1368 0.0958 0.1541 0.1374
39 / 40
Seasonal Trend SARIMA Model Building SARIMA Models Worked Example
> f3.cri
[1] 5.786946 5.827350 4.913428
> f4.cri
[1] 5.759288 5.795358 4.854149
40 / 40