![Page 1: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/1.jpg)
Lecture 9ARIMA Models
Colin Rundel02/15/2017
1
![Page 2: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/2.jpg)
MA(∞)
2
![Page 3: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/3.jpg)
MA(q)
From last time,
MA(q) : yt = δ + wt + θ1 wt−1 + θ2 wt−2 + · · · + θq wt−q
Properties:
E(yt) = δ
Var(yt) = (1+ θ21 + θ2 + · · · + θ2q)σ2w
Cov(yt, yt+h) =
{θh + θ1 θ1+h + θ2 θ2+h + · · · + θq−h θq if |h| ≤ q
0 if |h| > q
and is stationary for any values of θi
3
![Page 4: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/4.jpg)
MA(∞)
If we let q → ∞ then process will still be stationary if the moving averagecoefficients (θ ’s) are square summable,
∞∑i=1
θ2i < ∞
since this is necessary for Var(yt) < ∞.
Sometimes, a slightly strong condition called absolute summability,∑∞i=1 |θi| < ∞, is necessary (e.g. for some CLT related asymptotic results) .
4
![Page 5: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/5.jpg)
Invertibility
If a MA(q) process, yt = δ + θq(L)wt, can be rewritten as a purely ARprocess then it is said that the MA process is invertible.
MA(1) w/ δ = 0 example:
5
![Page 6: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/6.jpg)
Invertibility vs Stationarity
A MA(q) process is invertible if yt = δ + θq(L)wt can be rewritten as anexclusively AR process (of possibly infinite order), i.e. ϕ(L) yt = α + wt.
Conversely, an AR(p) process is stationary if ϕp(L) yt = δ + wt can berewritten as an exclusively MA process (of possibly infinite order), i.e.yt = δ + θ(L)wt.
So using our results w.r.t. ϕ(L) it follows that if all of the roots of θq(L) areoutside the complex unit circle then the moving average is invertible.
6
![Page 7: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/7.jpg)
Invertibility vs Stationarity
A MA(q) process is invertible if yt = δ + θq(L)wt can be rewritten as anexclusively AR process (of possibly infinite order), i.e. ϕ(L) yt = α + wt.
Conversely, an AR(p) process is stationary if ϕp(L) yt = δ + wt can berewritten as an exclusively MA process (of possibly infinite order), i.e.yt = δ + θ(L)wt.
So using our results w.r.t. ϕ(L) it follows that if all of the roots of θq(L) areoutside the complex unit circle then the moving average is invertible.
6
![Page 8: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/8.jpg)
Invertibility vs Stationarity
A MA(q) process is invertible if yt = δ + θq(L)wt can be rewritten as anexclusively AR process (of possibly infinite order), i.e. ϕ(L) yt = α + wt.
Conversely, an AR(p) process is stationary if ϕp(L) yt = δ + wt can berewritten as an exclusively MA process (of possibly infinite order), i.e.yt = δ + θ(L)wt.
So using our results w.r.t. ϕ(L) it follows that if all of the roots of θq(L) areoutside the complex unit circle then the moving average is invertible.
6
![Page 9: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/9.jpg)
Differencing
7
![Page 10: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/10.jpg)
Difference operator
We will need to define one more notational tool for indicating differencing
∆yt = yt − yt−1
just like the lag operator we will indicate repeated applications of thisoperator using exponents
∆2yt = ∆(∆yt)
= (∆yt) − (∆yt−1)
= (yt − yt−1) − (yt−1 − yt−2)
= yt − 2yt−1 + yt−2
∆ can also be expressed in terms of the lag operator L,
∆d = (1 − L)d
8
![Page 11: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/11.jpg)
Differencing and Stocastic Trend
Using the two component time series model
yt = µt + xt
where µt is a non-stationary trend component and xt is a mean zerostationary component.
We have already shown that differencing can address deterministic trend(e.g. µt = β0 + β1 t). In fact, if µt is any k-th order polynomial of t then∆kyt is stationary.
Differencing can also address stochastic trend such as in the case where µt
follows a random walk.
9
![Page 12: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/12.jpg)
Stochastic trend - Example 1
Let yt = µt + wt where wt is white noise and µt = µt−1 + vt with vtstationary as well. Is∆yt stationary?
10
![Page 13: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/13.jpg)
Stochastic trend - Example 2
Let yt = µt + wt where wt is white noise and µt = µt−1 + vt but nowvt = vt−1 + et with et being stationary. Is∆yt stationary? What about∆2yt,is it stationary?
11
![Page 14: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/14.jpg)
ARIMA
12
![Page 15: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/15.jpg)
ARIMA Models
Autoregressive integrated moving average are just an extension of an ARMAmodel to include differencing of degree d to yt, which is most often used toaddress trend in the data.
ARIMA(p, d, q) : ϕp(L) ∆d yt = δ + θq(L)wt
Box-Jenkins approach:
1. Transform data if necessary to stabilize variance
2. Choose order (p, d, and q) of ARIMA model
3. Estimate model parameters (ϕs and θs)
4. Diagnostics
13
![Page 16: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/16.jpg)
ARIMA Models
Autoregressive integrated moving average are just an extension of an ARMAmodel to include differencing of degree d to yt, which is most often used toaddress trend in the data.
ARIMA(p, d, q) : ϕp(L) ∆d yt = δ + θq(L)wt
Box-Jenkins approach:
1. Transform data if necessary to stabilize variance
2. Choose order (p, d, and q) of ARIMA model
3. Estimate model parameters (ϕs and θs)
4. Diagnostics
13
![Page 17: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/17.jpg)
Using forecast - random walk with drift
Some of R’s base timeseries handling is a bit wonky, the forecast packageoffers some useful alternatives and additional functionality.
rwd = arima.sim(n=500, model=list(order=c(0,1,0)), mean=0.1)
library(forecast)Arima(rwd, order = c(0,1,0), include.constant = TRUE)## Series: rwd## ARIMA(0,1,0) with drift#### Coefficients:## drift## 0.0641## s.e. 0.0431#### sigma^2 estimated as 0.9323: log likelihood=-691.44## AIC=1386.88 AICc=1386.91 BIC=1395.31
14
![Page 18: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/18.jpg)
EDA
Time
rwd
0 100 200 300 400 500
010
2030
40
Time
diff(
rwd)
0 100 200 300 400 500
−3
−2
−1
01
23
0.0
0.4
0.8
AC
F
0 5 10 15 20 25
−0.
100.
000.
10
AC
F
0 5 10 15 20 25
15
![Page 19: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/19.jpg)
Over differencing
Time
diff(
rwd,
2)
0 100 200 300 400 500
−4
−2
02
4
−0.
10.
10.
30.
5
Lag
AC
F
0 5 10 15 20 25
diff(
rwd,
3)
0 100 200 300 400 500
−4
−2
02
4
0.0
0.2
0.4
0.6
AC
F
0 5 10 15 20 25
16
![Page 20: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/20.jpg)
AR or MA?ts
1
0 50 100 150 200 250
−30
−25
−20
−15
−10
−5
0
ts2
0 50 100 150 200 250
020
4060
17
![Page 21: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/21.jpg)
EDA
Time
ts1
0 50 100 150 200 250
−30
−20
−10
0
−0.
20.
20.
61.
0Lag
AC
F5 10 15 20
−0.
20.
20.
61.
0
Lag
Par
tial A
CF
5 10 15 20
ts2
0 50 100 150 200 250
020
4060
−0.
20.
20.
61.
0
AC
F
5 10 15 20
−0.
20.
20.
61.
0
Par
tial A
CF
5 10 15 20
18
![Page 22: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/22.jpg)
ts1 - Finding d
d=1
Time
diff(
ts1)
0 50 100 150 200 250
−3
−1
13
d=2
Time
diff(
ts1,
2)
0 50 100 150 200 250
−6
−2
02
4
d=3
Time
diff(
ts1,
3)
0 50 100 150 200 250
−5
05
−0.
20.
00.
20.
4
Lag
AC
F
5 10 15 20
−0.
20.
20.
6
Lag
AC
F
5 10 15 20
−0.
20.
20.
6
Lag
AC
F
5 10 15 20
−0.
20.
00.
20.
4
Par
tial A
CF
5 10 15 20
−0.
40.
00.
4
Par
tial A
CF
5 10 15 20
−0.
40.
00.
40.
8
Par
tial A
CF
5 10 15 20
19
![Page 23: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/23.jpg)
ts2 - Finding d
d=1
Time
diff(
ts2)
0 50 100 150 200 250
−3
−1
12
34
d=2
Time
diff(
ts2,
2)
0 50 100 150 200 250
−6
−2
24
6
d=3
Time
diff(
ts2,
3)
0 50 100 150 200 250
−5
05
−0.
20.
20.
6
Lag
AC
F
5 10 15 20
−0.
20.
20.
6
Lag
AC
F
5 10 15 20
−0.
20.
20.
6
Lag
AC
F
5 10 15 20
−0.
20.
20.
6
Par
tial A
CF
5 10 15 20
−0.
20.
20.
6
Par
tial A
CF
5 10 15 20
−0.
20.
20.
6
Par
tial A
CF
5 10 15 20
20
![Page 24: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/24.jpg)
ts1 - Models
p d q AIC BIC
0 1 2 729.43 740.001 1 2 731.23 745.312 1 2 731.57 749.182 1 1 744.29 758.382 1 0 747.55 758.121 1 0 747.61 754.651 1 1 748.65 759.210 1 1 764.98 772.020 1 0 800.43 803.95
21
![Page 25: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/25.jpg)
ts2 - Models
p d q AIC BIC
2 1 0 683.12 693.681 1 2 683.25 697.342 1 1 683.83 697.922 1 2 685.06 702.671 1 1 686.38 696.951 1 0 719.16 726.200 1 2 754.66 765.220 1 1 804.44 811.480 1 0 890.32 893.85
22
![Page 26: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/26.jpg)
ts1 - Model Choice
Arima(ts1, order = c(0,1,2))## Series: ts1## ARIMA(0,1,2)#### Coefficients:## ma1 ma2## 0.4138 0.4319## s.e. 0.0547 0.0622#### sigma^2 estimated as 1.064: log likelihood=-361.72## AIC=729.43 AICc=729.53 BIC=740
23
![Page 27: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/27.jpg)
ts2 - Model Choice
Arima(ts2, order = c(2,1,0))## Series: ts2## ARIMA(2,1,0)#### Coefficients:## ar1 ar2## 0.4392 0.3770## s.e. 0.0587 0.0587#### sigma^2 estimated as 0.8822: log likelihood=-338.56## AIC=683.12 AICc=683.22 BIC=693.68
24
![Page 28: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/28.jpg)
Residuals
ts1 Residuals
Time
ts1_
resi
d
0 50 100 150 200 250
−3
−1
13
−0.
20.
00.
2Lag
AC
F5 10 15 20
−0.
20.
00.
2
Lag
Par
tial A
CF
5 10 15 20
ts2 Residuals
ts2_
resi
d
0 50 100 150 200 250
−2
01
23
−0.
20.
00.
2
AC
F
5 10 15 20
−0.
20.
00.
2
Par
tial A
CF
5 10 15 20
25
![Page 29: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/29.jpg)
Electrical Equipment Sales
26
![Page 30: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/30.jpg)
Data
elec_sales
2000 2005 2010
8090
100
110
0 5 10 15 20 25 30 35
−0.
20.
20.
6
Lag
AC
F
0 5 10 15 20 25 30 35
−0.
20.
20.
6
Lag
PAC
F
27
![Page 31: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/31.jpg)
1st order differencing
diff(elec_sales, 1)
2000 2005 2010
−10
−5
05
10
0 5 10 15 20 25 30 35
−0.
3−
0.1
0.1
0.3
Lag
AC
F
0 5 10 15 20 25 30 35
−0.
3−
0.1
0.1
0.3
Lag
PAC
F
28
![Page 32: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/32.jpg)
2nd order differencing
diff(elec_sales, 2)
2000 2005 2010
−10
−5
05
10
0 5 10 15 20 25 30 35
−0.
20.
00.
20.
4
Lag
AC
F
0 5 10 15 20 25 30 35
−0.
20.
00.
20.
4
Lag
PAC
F
29
![Page 33: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/33.jpg)
Model
Arima(elec_sales, order = c(3,1,0))## Series: elec_sales## ARIMA(3,1,0)#### Coefficients:## ar1 ar2 ar3## -0.3488 -0.0386 0.3139## s.e. 0.0690 0.0736 0.0694#### sigma^2 estimated as 9.853: log likelihood=-485.67## AIC=979.33 AICc=979.55 BIC=992.32
30
![Page 34: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/34.jpg)
Residuals
Arima(elec_sales, order = c(3,1,0)) %>% residuals() %>% tsdisplay(points=FALSE)
.
2000 2005 2010
−5
05
0 5 10 15 20 25 30 35
−0.
2−
0.1
0.0
0.1
0.2
Lag
AC
F
0 5 10 15 20 25 30 35
−0.
2−
0.1
0.0
0.1
0.2
Lag
PAC
F
31
![Page 35: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/35.jpg)
Model Comparison
Arima(elec_sales, order = c(3,1,0))$aic## [1] 979.3314
Arima(elec_sales, order = c(3,1,1))$aic## [1] 978.1664
Arima(elec_sales, order = c(4,1,0))$aic## [1] 978.9048
Arima(elec_sales, order = c(2,1,0))$aic## [1] 996.6795
32
![Page 36: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/36.jpg)
Model fit
plot(elec_sales, lwd=2, col=adjustcolor(”blue”, alpha.f=0.75))Arima(elec_sales, order = c(3,1,0)) %>% fitted() %>% lines(col=adjustcolor(’red’,alpha.f=0.75),lwd=2)
Time
elec
_sal
es
2000 2005 2010
8090
100
110
33
![Page 37: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/37.jpg)
Model forecast
Arima(elec_sales, order = c(3,1,0)) %>% forecast() %>% plot()
Forecasts from ARIMA(3,1,0)
2000 2005 2010
6070
8090
100
110
34
![Page 38: Lecture 9 - ARIMA Modelscr173/Sta444_Sp17/slides/Lec9.pdfEDA Time rwd 0 100 200 300 400 500 0 10 20 30 40 Time diff(rwd) 0 100 200 300 400 500-3-2-1 0 1 2 3 0.0 D 0.8 ACF 0 5 10 15](https://reader033.vdocument.in/reader033/viewer/2022050520/5fa4262a778d3a7f9c10d2d8/html5/thumbnails/38.jpg)
General Guidance
1. Positive autocorrelations out to a large number of lags usuallyindicates a need for differencing
2. Slightly too much or slightly too little differencing can be corrected byadding AR or MA terms respectively.
3. A model with no differencing usually includes a constant term, amodel with two or more orders (rare) differencing usually does notinclude a constant term.
4. After differencing, if the PACF has a sharp cutoff then consider addingAR terms to the model.
5. After differencing, if the ACF has a sharp cutoff then consider addingan MA term to the model.
6. It is possible for an AR term and an MA term to cancel each other’seffects, so try models with one fewer AR term and one fewer MA term.
Based on rules from https://people.duke.edu/~rnau/411arim2.htm andhttps://people.duke.edu/~rnau/411arim3.htm
35