LOGAN THOMSON
September 26, 2017
Review:
Forecasting: Principles and Practice
Hyndman & Athanasopoulos
Forecasting is an important aid to effective and efficient planning
Predictability of a quantity/event depends on:
Whether forecasts affect the target of what is being forecast
Good forecasts capture genuine patterns and relationships which exist in historical data
Do not replicate past events that will not occur again
Depending on the application, organizations require forecasts of different lengths:
A forecasting task generally involves five basic steps:
Graphics enable features of the data to be visualized, including:
The type of data determines both the forecasting method, and the appropriate graph
Average Method:
\( \hat y_{T+h|T}=\bar{y}=(y_1 + ... + y_t) / T \)
Naive Method:
All future values set to \( y_T \), where \( y_T \) is the last observed value
Seasonal Method:
\( y_{T+h-km} \) where \( m= \) the seasonal period, and \( k=(h-1)/m + 1 \)
Drift Method:
\( y_T + \frac{h}{T-1} \displaystyle\sum_{t=2}^{T} (y_t - y_{t-1}) = y_t + h (\frac{y_T - y_1}{T-1}) \)
Time Series Patterns
Time series can be thought to comprise three components:
Additive Model: \( y_t = S_t + T_t + E_t \)
Mulitplicative Model: \( y_t = S_t \times T_t \times E_t \)
Moving average of order \( m \) can be written as:
\( \hat{T_t}=\frac{1}{m} \sum_{j = -k}^{k} y_{t+j} \), where \( m=2k+1 \)
43 Years of Copper Prices:
Moving Average of Order 3, 5, 7 & 9
Moving Average of Moving Averages:
Weighted Moving Averages:
Additive Decomposition:
1. Obtain \( \hat{T_t} \). If \( m \) is even, use \( 2\times m \)-MA, and \( m \)-MA for odd \( m \) values.
2. Calculate detrended series: \( y_t - \hat{T_t} \)
3. Obtain \( \hat{S_t} \) by stringing together seasonal indicies
4. Calculate the remainder by subtracting estimated seasonal and trend-cycle components:
\( \hat{E_t} = y_t - \hat{T_t} - \hat{S_t} \)
Multiplicative Decomposition:
1. Obtain \( \hat{T_t} \) using same rules as additive decomposition
2. Calculate detrended series: \( y_t/\hat{T_t} \)
3. Obtain \( \hat{S_t} \)
4. Calculate the remainder by dividing out the estimated seasonal and trend-cycle components:
\( \hat{E_t} = y_t/(\hat{T_t}\hat{S_t}) \)
X-12-ARIMA:
x12
packageDecomposition can be used for forecasting, as well as studying time series
Additive Decomposition:
Multiplicative Decomposition:
The seasonal component (\( \hat{S_t} \)) and the seasonally adjusted component (\( \hat{A_t} \)) are forecasted separately to forecast a decomposed time series
\[ \hat{y}_{T+1|T} = \alpha y_T + \alpha(1-\alpha)y_{T-1} + \alpha(1-\alpha)^2y_{T-2} + \alpha(1-\alpha)^3y_{T-3} \dots \]
Observation | \( \alpha = 0.2 \) | \( \alpha = 0.4 \) | \( \alpha = 0.6 \) | \( \alpha = 0.8 \) |
---|---|---|---|---|
\( y_T \) | 0.2 | 0.4 | 0.6 | 0.8 |
\( y_T-1 \) | 0.16 | 0.24 | 0.24 | 0.16 |
\( y_T-2 \) | 0.128 | 0.144 | 0.096 | 0.032 |
\( Y_T-3 \) | 0.1024 | 0.0864 | 0.0384 | 0.0064 |
ses
function contains a parameter initial
to calculate this value.ses(oilprice, alpha=0.2, initial='simple', h=3) # use 'simple' or 'optimal'
Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
1998 21.80368 11.02002 32.58733 5.311500 38.29586
1999 21.80368 10.80646 32.80089 4.984891 38.62247
2000 21.80368 10.59697 33.01038 4.664504 38.94285
Forecast: \( \hat{y}_{t+h|t} = \ell_t + hb_t \)
Level: \( \ell_t = \alpha y_t + (1 - \alpha)(\ell_{t-1} + b_{t-1}) \)
Trend: \( b_t = \beta^*(\ell_t - \ell_{t-1}) + (1 - \beta^*)b_{t-1} \)
Forecast: \( \hat{y}_{t+h|t} = \ell_t + hb_t \)
Level: \( \ell_t = \alpha y_t + (1 - \alpha)(\ell_{t-1}b_{t-1}) \)
Trend: \( b_t = \beta^* \frac{\ell_t}{\ell_{t-1}} + (1 - \beta^*)b_{t-1} \)
hw
function available in forecast
package
Additive Method:
\( \hat{y_{t+h|t}} = \ell_t + hb_t + s_{t-m+h_{m}^+} \)
\( \ell_t = \alpha(y_t - s_{t-m}) + (1 - \alpha)(\ell_{t-1} + b_{t-1}) \)
\( b_t = \beta^*(\ell_t - \ell{t-1}) + (1-\beta^*)b_{t-1} \)
\( s_t = \gamma(y_t - \ell_{t-1} - b_{t-1}) + (1 - \gamma)s_{t-m} \)
Multiplicative Method:
\( \hat{y_{t+h|t}} = (\ell_t + hb_t)s_{t-m+h_{m}^+} \)
\( \ell_t = \alpha\frac{y_t}{s_{t-m}} + (1 - \alpha)(\ell_{t-1} + b_{t-1}) \)
\( b_t = \beta^*(\ell_t - \ell{t-1}) + (1-\beta^*)b_{t-1} \)
\( s_t = \gamma\frac{y_t}{(\ell_{t-1} + b_{t-1})} + (1 - \gamma)s_{t-m} \)
Trend Component | Seasonal: None | Seasonal Additive | Seasonal Mulitplicative |
---|---|---|---|
N (None) | (N, N) | (N, A) | (N, M) |
A (Additive) | (A, N) | (A, A) | (A, M) |
\( A_d \) (Additive Damped) | (\( A_d \), N) | (\( A_d \), A) | (\( A_d \), M) |
M (Multiplicative) | (M, N) | (M, A) | (M, M) |
\( M_d \) (Mult. Damped) | (\( M_d \), N) | (\( M_d \), A) | (\( M_d \), M) |
Simple Exponential Smoothing = (N,N)
Holts Linear Method = (A,N)
Exponential Trend Method = (M,N)
Additive Damped Trend Method = (Ad,N)
Multiplicative Damped Trend Method = (Md,N)
Additive Holt-Winters Method = (A,A)
Multiplicative Holt-Winters Method = (A,M)
Holt-Winters Damped Method = (Ad,M)
State Space Models:
Models which consist of:
Two models for each method:
Third letter added to the classification, labeled ETS (Error, Trend, & Seasonal)
Possibilities for each component are:
Error = {A,M}, Trend ={N,A,Ad,M,Md} and Seasonal ={N,A,M}.
Total of 30 such state space models:
ETS models can be selected using information criteria (AIC, \( AIC_c \), & BIC)
ets
function from the forecast
package can be used to estimate the models
- Leave blank or enter parameters
Questions?