程序代写代做代考 Lecture 10 – Seasonal ARIMA Models

Lecture 10 – Seasonal ARIMA Models

Lecture 10 – Seasonal ARIMA Models

MAS 640 – Times Series Analysis and Forecasting

February 14, 2018

Seasonal ARIMA Models

I Stationarity
I Constant mean
I Constant variance
I No seasonality

Dealing with nonstationarity

I We have covered two ways for removing trends from a series
1. Model it and study the residuals
2. Difference it

I We have covered how to correct for nonconstant variance
I Transformation
I Box-Cox for guidance

I Seasonality is a common problem that needs to be handled as
well

Seasonality nonstationarity

Time

m
ilk

1994 1996 1998 2000 2002 2004 2006

1
3

0
0

1
4

0
0

1
5

0
0

1
6

0
0

1
7

0
0

J

F

MA

M

JJ
A

S

O

N

D

J

F

M
A

M

JJ

A

S

O

N

D

J

F

M

A

M

JJ
A

S

O

N

D
J

F

M
A

M

JJ

A

S

O

N

D

J

F

M
A

M

JJ
A

S

O

N

D

J

F

M

A

M

J
J
A

S

O

N

D

J

F

M

A

M

J
J

A

S

O

N

D

J

F

M

A

M

JJ

A

S

O

N

D

J

F

M

A

M

JJA

S

O

N

D

J

F

M

A

M

JJ
A

S

O

N

D

J

F

M
A

M

J
J
A

S

O

N

D

J

F

M
A

M

JJ
A

S

O

N

D

Seasonality causing nonstationarity
I 1st order differencing generally used for removing trends
I But seasonality persists. . .

Time

m
ilk

1994 1996 1998 2000 2002 2004 2006


1

0
0


5

0
0

5
0

1
0

0
1

5
0

J

F

M

A

M

J

J

A

S

O

N

D

J

F

M

A

M

J

JA

S

O

N

D

J

F

M

A

M

J

J

A

S

O

N

D

J

F

M

A

M

J

J

A

S

O

N

D

J

F

M

A

M

J

J

A

S

O

N

D

J

F

M

A

M

J
J

A

S

O

N

D

J

F

M

A

M

J

J

A

S

O

N

D

J

F

M

A

M

J

J

A

S

O

N

D

J

F

M

A

M

JJ

A

S

O

N

D

J

F

M

A

M

J

J

A

S

O

N

D

J

F

M

A

M

J

J

A

S

O

N

D

J

F

M

A

M

JJ

A

S

O

N

Seasonal Lag Differencing

I To remove seasonality (hopefully), we can try taking
seasonal-lagged differences

I Try both seasonal lag on the differences, and only a seasonal lag
I Remember, we are just looking for something that looks

stationary

I Seasonal-lag difference (with monthly data)

∇12Yt = Yt − Yt−12

Seasonal Differencing

Seasonal Difference

Time

m
ilk

1996 1998 2000 2002 2004 2006


5

0
0

5
0

1
0

0

Seasonal and First order Difference

Time

m
ilk

1996 1998 2000 2002 2004 2006


4

0
0

2
0

Guidance on Differencing

I Plot the ACF of the original data
I If it tails TOO slow at recent lags, need first order difference
I If it tails TOO slow at seasonal lags, need seasonal difference

Finding Seasonal Correlation

I As before, after converting our series to stationary we hope to
model that process with some ARMA model

I Unlike before, we can now incorporate seasonal ARMA terms

Detrending and Studying Residuals

Time

g
n

p

1950 1960 1970 1980 1990 2000

2
0

0
0

4
0

0
0

6
0

0
0

8
0

0
0

Detrending and Studying Residuals

0 50 100 150 200


4

0
0

0
2

0
0

Index

fit
$

re
si

d
u

a
ls

5 10 15 20


0

.2
0

.2
0

.6
1

.0

Series fit$residuals

Lag

A
C

F

Seasonal Autocorrelations

Time

b
e

e
rs

a
le

s

1975 1980 1985 1990

1
0

1
2

1
4

1
6

J

F

M

A

M

J
J

A

S

O

N

D

JFM

A

M

J

J
A

S

O

N
D

J

F

M
A

M

J

J
A

S

OND

J
F

M

A

M

J

J

A

S

O

N

D

J
F

MA

M
J

J

A

SO

N

D

JF

M
A

M

J

J

A

S
O

ND
J
F

M

A

M
JJ

A

S

O

N

D

J

F

MA

M

J

J
A

S

O

N

D
JF

M

A

M
J
J

A

S

O

N

D

JF

M
A

M
JJ
A

S

O

N

D

J

F

M

A

M

J

J

A

S

O

N
D

J

F

M

A

M

J

J

A

S

O

N
D

JF

M

A
M

J

J

A

S
O

N
D

JF

MA

M

J

J
A

S

O

N

D

J

F

M

A

M
J

J

A

S

O

N

D

J

F

M

A

MJJ

A

S

O

N

D

Seasonal Autocorrelations

Time

b
e

e
rs

a
le

s

1975 1980 1985 1990

1
0

1
2

1
4

1
6

J

F

M

A

M

J
J

A

S

O

N

D

JFM

A

M

J

J
A

S

O

N
D

J

F

M
A

M

J

J
A

S

OND

J
F

M

A

M

J

J

A

S

O

N

D

J
F

MA

M
J

J

A

SO

N

D

JF

M
A

M

J

J

A

S
O

ND
J
F

M

A

M
JJ

A

S

O

N

D

J

F

MA

M

J

J
A

S

O

N

D
JF

M

A

M
J
J

A

S

O

N

D

JF

M
A

M
JJ
A

S

O

N

D

J

F

M

A

M

J

J

A

S

O

N
D

J

F

M

A

M

J

J

A

S

O

N
D

JF

M

A
M

J

J

A

S
O

N
D

JF

MA

M

J

J
A

S

O

N

D

J

F

M

A

M
J

J

A

S

O

N

D

J

F

M

A

MJJ

A

S

O

N

D

Plot and ACF of Residuals

0 50 100 150


2


1

0
1

Index

fit
$

re
si

d
u

a
ls

5 10 15 20


0

.1
0

.1
0

.3

Series fit$residuals

Lag

A
C

F

Seasonal Autocorrelations

Estimate Std. Error
(Intercept) -71497.79 8791.41
t 71.96 8.87
I(t^2) -0.02 0.00
monthFebruary -0.16 0.21
monthMarch 2.05 0.21
monthApril 2.35 0.21
monthMay 3.54 0.21
monthJune 3.78 0.21
monthJuly 3.68 0.21
monthAugust 3.51 0.21
monthSeptember 1.46 0.21
monthOctober 1.13 0.21
monthNovember -0.19 0.21
monthDecember -0.58 0.21

Consider February. . .
From the regression results, the estimated equation for the month of
February is

Yt = (−71497.79− 0.16) + 71.96t − 0.02t2

Time

b
e

e
rs

a
le

s

1975 1980 1985 1990

1
0

1
2

1
4

1
6

Seasonal Autocorrelation

1975 1980 1985 1990


2


1

0
1

February Residuals Highlighted

Time

R
e

si
d

u
a

l

1975 1980 1985 1990


0

.5
0

.0
0

.5

Time

R
e

si
d

u
a

l

Modeling Process

1. Plot time series
I Observe trends, variance, seasonality, abrupt changes, outliers

2. Convert to stationary
2.1 Transform for constant variance if needed

I Box-Cox procedure for guidance

2.2 Remove trend if needed
I Differencing (lag 1, seasonal lag, both)
I Build model, use residuals

Modeling Process

3. Investigate autocorrelations via ACF/PACF plots
I Starting point for p, q, P, and Q

4. Fit model and diagnose
I Normality, independence
I After fitting time series model, no correlation should exist in

residuals
I Residual plots, ACF of residuals, Ljung-Box p-values

5. Overfit until you’re happy with model
6. Forecast

I Always provide interval with your estimate