Академический Документы
Профессиональный Документы
Культура Документы
Univariate Forecasting
Conclusions
Nate Derby
1 / 43
Introduction
Univariate Forecasting
Conclusions
Outline
1
Introduction
Objectives
Strategies
Univariate Forecasting
Seasonal Moving Average
Exponential Smoothing
ARIMA
Conclusions
Which Method?
Are Our Results Better?
Whats Next?
Nate Derby
2 / 43
Introduction
Univariate Forecasting
Conclusions
Objectives
Strategies
Objectives
Nate Derby
3 / 43
Introduction
Univariate Forecasting
Conclusions
Objectives
Strategies
Nate Derby
4 / 43
Introduction
Univariate Forecasting
Conclusions
Objectives
Strategies
600
510
500
110
100
410
400
310
300
210
200
/10
/00
0/748 0/710 0/71/ 0/712 0/713 0/714 0/711 0/715 0/716 0/719 0/718 0/750 0/75/ 0/752
Nate Derby
5 / 43
Introduction
Univariate Forecasting
Conclusions
Objectives
Strategies
Nate Derby
6 / 43
Introduction
Univariate Forecasting
Conclusions
Objectives
Strategies
Different categories?
Two strategies for forecasting A, B and C:
1
Nate Derby
7 / 43
Introduction
Univariate Forecasting
Conclusions
Objectives
Strategies
Nate Derby
8 / 43
Introduction
Univariate Forecasting
Conclusions
Objectives
Strategies
Nate Derby
9 / 43
Introduction
Univariate Forecasting
Conclusions
Objectives
Strategies
Strategies
Two stages:
Univariate (one variable) forecasting:
Forecasts Y from trend alone.
Gives us a basic setup.
Nate Derby
10 / 43
Introduction
Univariate Forecasting
Conclusions
(very simple)
(simple)
(complex)
State space
Bayesian
Wavelets?
Nate Derby
11 / 43
Introduction
Univariate Forecasting
Conclusions
Nate Derby
12 / 43
Introduction
Univariate Forecasting
Conclusions
Nate Derby
13 / 43
Introduction
Univariate Forecasting
Conclusions
SAS Code
Making lags in a DATA step (to make the averages) is not fun:
Making 4 lags
DATA movingaverage;
...
RETAIN date pass1-pass4;
OUTPUT;
pass4=pass3;
pass3=pass2;
pass2=pass1;
pass1=pass;
RUN;
Nate Derby
14 / 43
Introduction
Univariate Forecasting
Conclusions
SAS Code
Much easier with a trick with PROC ARIMA.
Seasonal = averaging over past 5 years on that same month:
Yt =
1
(Yt12 + Yt24 + Yt36 + Yt48 + Yt60 )
5
Nate Derby
15 / 43
Introduction
Univariate Forecasting
Conclusions
600
510
500
110
100
410
400
310
300
210
200
/10
/00
0/748 0/710 0/71/ 0/712 0/713 0/714 0/711 0/715 0/716 0/719 0/718 0/750 0/75/ 0/752
Nate Derby
16 / 43
Introduction
Univariate Forecasting
Conclusions
600
510
500
110
100
410
400
310
300
210
200
/10
/00
0/748 0/710 0/71/ 0/712 0/713 0/714 0/711 0/715 0/716 0/719 0/718 0/750 0/75/ 0/752
Nate Derby
17 / 43
Introduction
Univariate Forecasting
Conclusions
Exponential Smoothing I
Notation: yt (h) = forecast of Y at horizon h, given at time t.
Idea 1: Predict Yt+h by taking weighted sum of past
observations:
yt (h) = 0 yt + 1 yt1 +
Assumes yt (h) is constant for all horizons h.
Idea 2: Weight recent observations heavier than older ones:
i = ci , 0 < < 1 yt (h) = c yt + yt1 + 2 yt2 +
where c is a constant so that weights sum to 1.
Nate Derby
18 / 43
Introduction
Univariate Forecasting
Conclusions
Exponential Smoothing II
yt (h) = c yt + yt1 + 2 yt2 +
Weights are exponentially decaying (hence the name).
Choose by minimizing squared one-step prediction error.
Overall:
Just a weighted moving average.
Can be extended to include trend and seasonality.
Prediction intervals? Sort of ...
Nate Derby
19 / 43
Introduction
Univariate Forecasting
Conclusions
SAS Code
All done with PROC FORECAST:
method=expo trend=1 for simple.
method=expo trend=2 for trend.
method=winters seasons=( 12 ) for seasonal.
Nate Derby
20 / 43
Introduction
Univariate Forecasting
Conclusions
600
510
500
110
100
410
400
310
300
210
200
/10
/00
0/748 0/710 0/71/ 0/712 0/713 0/714 0/711 0/715 0/716 0/719 0/718 0/750 0/75/ 0/752
Nate Derby
21 / 43
Introduction
Univariate Forecasting
Conclusions
600
510
500
110
100
410
400
310
300
210
200
/10
/00
0/748 0/710 0/71/ 0/712 0/713 0/714 0/711 0/715 0/716 0/719 0/718 0/750 0/75/ 0/752
Nate Derby
22 / 43
Introduction
Univariate Forecasting
Conclusions
600
510
500
110
100
410
400
310
300
210
200
/10
/00
0/748 0/710 0/71/ 0/712 0/713 0/714 0/711 0/715 0/716 0/719 0/718 0/750 0/75/ 0/752
Nate Derby
23 / 43
Introduction
Univariate Forecasting
Conclusions
600
510
500
110
100
410
400
310
300
210
200
/10
/00
0/748 0/710 0/71/ 0/712 0/713 0/714 0/711 0/715 0/716 0/719 0/718 0/750 0/75/ 0/752
Nate Derby
24 / 43
Introduction
Univariate Forecasting
Conclusions
Exponential Smoothing VI
Advantages:
Gives interpretable results (trend + seasonality).
Gives more weight to recent observations.
Disadvantages:
Not a model (in the statistical sense).
Prediction intervals not (really) possible.
Nate Derby
25 / 43
Introduction
Univariate Forecasting
Conclusions
ARIMA I
Disadvantages:
More complex.
Not intuitive at all.
Nate Derby
26 / 43
Introduction
Univariate Forecasting
Conclusions
ARIMA II
Assume nonseasonality for now.
First, transform, then difference the data {Yt } d times until it
is stationary (constant mean, variance), denoted {Yt }.
Guesstimate orders p, q through the sample autocorrelation,
partial autocorrelation functions.
Fit an autoregressive moving average (ARMA) process,
orders p and q:
p Ytp
= Zt + 1 Zt1 + + q Ztq
Yt 1 Yt1
(Yt ) = (Zt )
iid
27 / 43
Introduction
Univariate Forecasting
Conclusions
Confused Yet?
Q: How do we account for seasonality, period s?
A: We do almost the exact same thing, except for period s:
,Y
Look at {Yt , Yt+s
t+2s , . . .}. Are they stationary? If not,
difference D times until they are.
Y
Yt 1 Yts
P tPs (Yt ) =
(Zt + 1 Zts + + Q ZtQs ) (Zt )
Repeat above 2 steps until all looks good.
Above is an ARIMA(p, d, q)(P, D, Q)s process.
Nate Derby
28 / 43
Introduction
Univariate Forecasting
Conclusions
SAS Code
If youre still with me ...
Yt = log(passt ) ARIMA(0, 1, 1) (0, 1, 1)12 :
(Yt Yt1 )(Yt Yt12 ) = (Zt 1 Zt1 )(Zt 1 Zt12 )
data=airline;
var=lpass( 1, 12 ) noprint;
q=( 1 )( 12 ) noint method=ML noprint;
lead=12 out=forearima id=date interval=month noprint;
Nate Derby
29 / 43
Introduction
Univariate Forecasting
Conclusions
600
510
500
110
100
410
400
310
300
210
200
/10
/00
0/748 0/710 0/71/ 0/712 0/713 0/714 0/711 0/715 0/716 0/719 0/718 0/750 0/75/ 0/752
Nate Derby
30 / 43
Introduction
Univariate Forecasting
Conclusions
600
510
500
110
100
410
400
310
300
210
200
/10
/00
0/748 0/710 0/71/ 0/712 0/713 0/714 0/711 0/715 0/716 0/719 0/718 0/750 0/75/ 0/752
Nate Derby
31 / 43
Introduction
Univariate Forecasting
Conclusions
600
510
500
110
100
410
400
310
300
210
200
/10
/00
0/748 0/710 0/71/ 0/712 0/713 0/714 0/711 0/715 0/716 0/719 0/718 0/750 0/75/ 0/752
Nate Derby
32 / 43
Introduction
Univariate Forecasting
Conclusions
600
510
500
110
100
410
400
310
300
210
200
/10
/00
0/748 0/710 0/71/ 0/712 0/713 0/714 0/711 0/715 0/716 0/719 0/718 0/750 0/75/ 0/752
Nate Derby
33 / 43
Introduction
Univariate Forecasting
Conclusions
SAS Code
symbol1 i=join c=red mode=include;
symbol2 i=join c=blue mode=include;
symbol3 i=join c=blue l=20 mode=include;
proc gplot data=forearima;
plot pass*date=1
forecast*date=2
l95*date=3
u95*date=3 / overlay ...;
run;
quit;
Nate Derby
34 / 43
Introduction
Univariate Forecasting
Conclusions
Which Method?
Are Our Results Better?
Whats Next?
Nate Derby
35 / 43
Introduction
Univariate Forecasting
Conclusions
Which Method?
Are Our Results Better?
Whats Next?
Nate Derby
36 / 43
Introduction
Univariate Forecasting
Conclusions
Which Method?
Are Our Results Better?
Whats Next?
Nate Derby
37 / 43
Introduction
Univariate Forecasting
Conclusions
Which Method?
Are Our Results Better?
Whats Next?
Nate Derby
38 / 43
Introduction
Univariate Forecasting
Conclusions
Which Method?
Are Our Results Better?
Whats Next?
Nate Derby
39 / 43
Introduction
Univariate Forecasting
Conclusions
Which Method?
Are Our Results Better?
Whats Next?
Whats Next?
Multivariate Models!
Takes account of holidays/other irregularities.
Allows for scenario forecasting!
How will we do this?
Nate Derby
40 / 43
Introduction
Univariate Forecasting
Conclusions
Which Method?
Are Our Results Better?
Whats Next?
I
X
i Xti + Zt ,
Zt = ARIMA process
i=0
41 / 43
Introduction
Univariate Forecasting
Conclusions
Which Method?
Are Our Results Better?
Whats Next?
I
X
it Xti + Zt ,
Zt = Normal process
i=0
42 / 43
Appendix
Further Resources
Nate Derby
43 / 43