Professional Documents
Culture Documents
Rob J Hyndman
1 Stationarity
2 Differencing
4 Lab session 10
5 Backshift notation
Definition
If {yt } is a stationary time series, then for all s, the
distribution of (yt , . . . , yt+s ) does not depend on t.
roughly horizontal
constant variance
no patterns predictable in the long-term
Definition
If {yt } is a stationary time series, then for all s, the
distribution of (yt , . . . , yt+s ) does not depend on t.
roughly horizontal
constant variance
no patterns predictable in the long-term
3900
Dow Jones Index
3800
3700
3600
50
Change in Dow Jones Index
−50
−100
0 50 100 150 200 250 300
Day
5000
4000
80
Total sales
60
40
300
$
200
100
110
100
thousands
90
80
6000
Number trapped
4000
2000
500
megalitres
450
400
Definition
If {yt } is a stationary time series, then for all s, the
distribution of (yt , . . . , yt+s ) does not depend on t.
Definition
If {yt } is a stationary time series, then for all s, the
distribution of (yt , . . . , yt+s ) does not depend on t.
time plot.
The ACF of stationary data drops to zero relatively
quickly
The ACF of non-stationary data decreases slowly.
For non-stationary data, the value of r1 is often large
and positive.
3900
Dow Jones Index
3800
3700
3600
0.75
0.50
ACF
0.25
0.00
0 5 10 15 20 25
Lag
50
Change in Dow Jones Index
−50
−100
0 50 100 150 200 250 300
Day
0.10
0.05
ACF
0.00
−0.05
−0.10
0 5 10 15 20 25
Lag
1 Stationarity
2 Differencing
4 Lab session 10
5 Backshift notation
400
usmelec
300
200
6.0
5.7
log(usmelec)
5.4
5.1
0.1
diff(log(usmelec), 12)
0.0
0.10
diff(diff(log(usmelec), 12), 1)
0.05
0.00
−0.05
−0.10
−0.15
1980 1990 2000 2010
Time
Forecasting using R Differencing 25
Electricity production
Seasonally differenced series is closer to being
stationary.
Remaining non-stationarity can be removed with
further first difference.
If yt0 = yt − yt−12 denotes seasonally differenced series,
then twice-differenced series is
yt∗ = yt0 − yt−1
0
1 Stationarity
2 Differencing
4 Lab session 10
5 Backshift notation
k = bT − 1c1/3
Set alternative = stationary.
adf.test(dj)
##
## Augmented Dickey-Fuller Test
##
## data: dj
## Dickey-Fuller = -1.9872, Lag order = 6, p-value = 0.5816
## alternative hypothesis: stationary
Forecasting using R Unit root tests 32
Dickey-Fuller test in R
adf.test(x,
alternative = c("stationary", "explosive"),
k = trunc((length(x)-1)^(1/3)))
k = bT − 1c1/3
Set alternative = stationary.
adf.test(dj)
##
## Augmented Dickey-Fuller Test
##
## data: dj
## Dickey-Fuller = -1.9872, Lag order = 6, p-value = 0.5816
## alternative hypothesis: stationary
Forecasting using R Unit root tests 32
Dickey-Fuller test in R
adf.test(x,
alternative = c("stationary", "explosive"),
k = trunc((length(x)-1)^(1/3)))
k = bT − 1c1/3
Set alternative = stationary.
adf.test(dj)
##
## Augmented Dickey-Fuller Test
##
## data: dj
## Dickey-Fuller = -1.9872, Lag order = 6, p-value = 0.5816
## alternative hypothesis: stationary
Forecasting using R Unit root tests 32
How many differences?
ndiffs(x)
nsdiffs(x)
ndiffs(dj)
## [1] 1
nsdiffs(hsales)
## [1] 0
Forecasting using R Unit root tests 33
Outline
1 Stationarity
2 Differencing
4 Lab session 10
5 Backshift notation
1 Stationarity
2 Differencing
4 Lab session 10
5 Backshift notation
Byt = yt−1 .
B(Byt ) = B2 yt = yt−2 .
Byt = yt−1 .
B(Byt ) = B2 yt = yt−2 .
Byt = yt−1 .
B(Byt ) = B2 yt = yt−2 .
Byt = yt−1 .
B(Byt ) = B2 yt = yt−2 .
(1 − B)d yt .
(1 − B)(1 − Bm )yt .