Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

Stat 153: Lecture 2 – Di↵erencing and SARIMA

Sören Künzel

srk@berkeley.edu

Wednesday 2nd November, 2016

Wednesday 2nd November, 2016 1/


Sören Künzel (UC Berkeley) Stat 153: Lecture 2 15
Trend and Seasonality

X t = m t + s t + Zt

mt is the trend, e.g. mt = (t 150)3


st is the seasonality, e.g. st = 15 sin(2⇡t/30)
Zt is a stationary process, e.g. Gaussian white noise.

White noise is in a sense the worst case. Whenever we have more


structure we try to exploit it for better predictions

Wednesday 2nd November, 2016 2/


Sören Künzel (UC Berkeley) Stat 153: Lecture 2 15
Trend and Seasonality

no seasonality with seasonality


150

100

50

no trend
0

−50

−100

150

100

50

with trend
0

−50

−100

0 100 200 300 0 100 200 300


nd
Wednesday 2 November, 2016 3/
Sören Künzel (UC Berkeley) Stat 153: Lecture 2 15
Exploiting Trend and Seasonality

Trend, mt Seasonality, st
Parametric Parametric
(e.g. fit a quadratic model) (e.g fit sinusoidal functions)
Non-parametrically Non-parametrically
(linear filters) (e.g. ŝi = ave(Xi , Xi+d , . . .))
Di↵erencing Di↵erencing

Wednesday 2nd November, 2016 4/


Sören Künzel (UC Berkeley) Stat 153: Lecture 2 15
Di↵erencing

Definition:

rXt = Xt Xt 1
rd X t = X t Xt d

Properties:
Di↵erencing can be arbitrary combined, e.g.

r2 rd Xt = r2 (Xt Xt d) = r(Xt Xt d Xt 1 + Xt d 1) = ···

Di↵erencing k-times removes polinomial trend of order k,


Di↵erencing with lag d (rd ) removes seasonality with period d.

Wednesday 2nd November, 2016 5/


Sören Künzel (UC Berkeley) Stat 153: Lecture 2 15
Di↵erencing

Definition:

rXt = Xt Xt 1
rd X t = X t Xt d

Properties:
Di↵erencing can be arbitrary combined, e.g.

r2 rd Xt = r2 (Xt Xt d) = r(Xt Xt d Xt 1 + Xt d 1) = ···

Di↵erencing k-times removes polinomial trend of order k,


Di↵erencing with lag d (rd ) removes seasonality with period d.

Example 1 on black board

Wednesday 2nd November, 2016 5/


Sören Künzel (UC Berkeley) Stat 153: Lecture 2 15
Di↵erencing

Example 1

Wednesday 2nd November, 2016 6/


Sören Künzel (UC Berkeley) Stat 153: Lecture 2 15
ARIMA

ARMA(p,q)
{Xt } is said to be ARMA(p, q) with mean µ, if {Xt µ} is ARMA(p, q),
i.e., if {Xt } is stationary and

(Xt µ) 1 (Xt 1 µ) ··· p (Xt p µ) = Zt + ✓1 Zt 1 + · · · + ✓ q Zt q

Here Zt is white noise.

ARIMA(p,d,q)
{Yt } is said to be ARIMA(p, d, q) with mean µ, if Xt = rd Yt is
ARMA(p, d) with mean µ.

Wednesday 2nd November, 2016 7/


Sören Künzel (UC Berkeley) Stat 153: Lecture 2 15
ARIMA

ARMA(p,q)
{Xt } is said to be ARMA(p, q) with mean µ, if {Xt µ} is ARMA(p, q),
i.e., if {Xt } is stationary and

(Xt µ) 1 (Xt 1 µ) ··· p (Xt p µ) = Zt + ✓1 Zt 1 + · · · + ✓ q Zt q

Here Zt is white noise.

ARIMA(p,d,q)
{Yt } is said to be ARIMA(p, d, q) with mean µ, if Xt = rd Yt is
ARMA(p, d) with mean µ.

md <- arima(dataset, order = c(p, d, q))


predict(md, 10) #predicts the next 10 values

Wednesday 2nd November, 2016 7/


Sören Künzel (UC Berkeley) Stat 153: Lecture 2 15
Backshift Notation

Backshift Operator

BXt = Xt 1 (1)
n
B Xt = Xt n (2)
(1 + B + 3B 2 )Xt = Xt + Xt 1 + 3Xt 2 (3)

Wednesday 2nd November, 2016 8/


Sören Künzel (UC Berkeley) Stat 153: Lecture 2 15
Backshift Notation

Backshift Operator

BXt = Xt 1 (1)
n
B Xt = Xt n (2)
(1 + B + 3B 2 )Xt = Xt + Xt 1 + 3Xt 2 (3)

ARMA(p,q)
{Xt } is said to be ARMA(p, q) with mean µ, if {Xt µ} is ARMA(p, q),
i.e., if {Xt } is stationary and

(B)(Xt µ) = ✓(B)Zt

with (z) = 1 ··· p and ✓(z) = 1 + ✓1 z + · · · + ✓q z q


1z pz

Wednesday 2nd November, 2016 8/


Sören Künzel (UC Berkeley) Stat 153: Lecture 2 15
Seasonal ARIMA
ARMA(P, Q)d
{Xt } is said to be ARMA(P, Q)d with mean µ and period d, if {Xt } is
stationary and
(B d )(Xt µ) = ⇥(B d )Zt
with (B d ) = 1 1B
d ··· PB
Pd and
d d Qd
⇥(B ) = 1 + ✓1 B + · · · + ✓Q B .

Wednesday 2nd November, 2016 9/


Sören Künzel (UC Berkeley) Stat 153: Lecture 2 15
Seasonal ARIMA
ARMA(P, Q)d
{Xt } is said to be ARMA(P, Q)d with mean µ and period d, if {Xt } is
stationary and
(B d )(Xt µ) = ⇥(B d )Zt
with (B d ) = 1 1B
d ··· PB
Pd and
d d Qd
⇥(B ) = 1 + ✓1 B + · · · + ✓Q B .

{Xt } is said to be ARMA(P, Q)d with mean µ and period d, if {Xt } is


stationary and

(Xt µ) 1 (Xt d µ) · · · P (Xt Pd µ) = Zt +✓1 Zt d +· · ·+✓Q Zt Qd

Wednesday 2nd November, 2016 9/


Sören Künzel (UC Berkeley) Stat 153: Lecture 2 15
Seasonal ARIMA
ARMA(P, Q)d
{Xt } is said to be ARMA(P, Q)d with mean µ and period d, if {Xt } is
stationary and
(B d )(Xt µ) = ⇥(B d )Zt
with (B d ) = 1 1B
d ··· PB
Pd and
d d Qd
⇥(B ) = 1 + ✓1 B + · · · + ✓Q B .

{Xt } is said to be ARMA(P, Q)d with mean µ and period d, if {Xt } is


stationary and

(Xt µ) 1 (Xt d µ) · · · P (Xt Pd µ) = Zt +✓1 Zt d +· · ·+✓Q Zt Qd

md <- arima(Y, order = c(0,0,0),


seasonal = list(order = c(P, 0, Q), period = d))
predict(md, 10) #predicts the next 10 values
Wednesday 2nd November, 2016 9/
Sören Künzel (UC Berkeley) Stat 153: Lecture 2 15
Seasonal ARIMA
ARMA(P, Q)d
{Xt } is said to be ARMA(P, Q)d with mean µ and period d, if {Xt } is
stationary and
(B d )(Xt µ) = ⇥(B d )Zt
with (B d ) = 1 1B
d ··· PB
Pd and
d d Qd
⇥(B ) = 1 + ✓1 B + · · · + ✓Q B .

{Xt } is said to be ARMA(P, Q)d with mean µ and period d, if {Xt } is


stationary and

(Xt µ) 1 (Xt d µ) · · · P (Xt Pd µ) = Zt +✓1 Zt d +· · ·+✓Q Zt Qd

md <- arima(Y, order = c(0,0,0),


seasonal = list(order = c(P, 0, Q), period = d))
predict(md, 10) #predicts the next 10 values
Example 2 on black board nd
Wednesday 2 November, 2016 9/
Sören Künzel (UC Berkeley) Stat 153: Lecture 2 15
Multiplicative Seasonal ARIMA

ARMA(P, Q) ⇥ (P, D)d


{Xt } is said to be a multiplicative seasonal ARMA(p, q) ⇥ (P, Q)d with
mean µ and period d, if {Xt } is stationary and

(B d ) (B)(Xt µ) = ⇥(B d )✓(B)Zt

with for polinomials a polinomial of order P, a polinomial of order p,


⇥ a polinomial of order Q, ✓ a polinomial of order q.

Wednesday 2nd November, 2016 10 /


Sören Künzel (UC Berkeley) Stat 153: Lecture 2 15
Multiplicative Seasonal ARIMA

ARMA(P, Q) ⇥ (P, D)d


{Xt } is said to be a multiplicative seasonal ARMA(p, q) ⇥ (P, Q)d with
mean µ and period d, if {Xt } is stationary and

(B d ) (B)(Xt µ) = ⇥(B d )✓(B)Zt

with for polinomials a polinomial of order P, a polinomial of order p,


⇥ a polinomial of order Q, ✓ a polinomial of order q.

md <- arima(Y, order = c(p,d,q),


seasonal = list(order = c(P, D, Q), period = s))
predict(md, 10) #predicts the next 10 values

Wednesday 2nd November, 2016 10 /


Sören Künzel (UC Berkeley) Stat 153: Lecture 2 15

You might also like