Notes2 - Quiz 2
Notes2 - Quiz 2
Notes2 - Quiz 2
• In an autoregression model, we forecast the variable of interest using a linear combination of past values
of the variable. If the model uses last p values it is called AR(p) model.
• Rather than using past values of the forecast variable in a regression, a moving average model uses past
forecast errors in a regression-like model. If the model uses last q errors for forecasting we call it MA(q).
• Notice that each value of Yt can be thought of as a weighted moving average of the past few forecast
errors. However, moving average models should not be confused with the moving average smoothing.
• A moving average model is used for irregular component.
• while moving average smoothing is used for estimating the trend-cycle of past values.
PACF
Note: If both the plots (ACF & PACF) shows gradual decline, the series might be non-
stationary and a difference is required.
Autoregressive Moving Average Model: ARMA(p,q)
Non-stationary time series
• Seasonal component
• Trend
• Random Fluctuations.
• Natural conditions.
• Higher water consumption during summer.
• Higher production of milk during winter.
Remainder of
SMA(3)
Simple Moving Average: SMA(k)
Remainder of
SMA(8)
Seasonality Adjustments
time year month passenger
For example, the data AirPassanger 1 1 1 112
2 1 2 118
3 1 3 132
• Find the period of seasonality. 4 1 4 129
5 1 5 121
• Take average for that period. 6 1 6 135
7 1 7 148
8 1 8 148
• Subtract the periodic average from each time period. 9 1 9 136
10 1 10 119
11 1 11 104
• Take (weighted) average, to find the seasonal effect. 12 1 12 118
13 2 1 115
14 2 2 126
OR 15 2 3 141
16 2 4 135
decompose_air<-decompose(AirPassengers,type="additive") 17 2 5 125
decompose_air$seasonal 18 2 6 149
19 2 7 170
20 2 8 170
stl_air<-stl(AirPassengers,s.window = "periodic")
21 2 9 158
stl_air$time.series[,1] 22 2 10 133
23 2 11 114
24 2 12 140
25 3 1 145
Exponential Moving Average: EMA(k)
• If you have a time series with constant level and no • Total annual rainfall in inches for London, from 1813-1912.
seasonality, you can use simple exponential smoothing
for short term forecasts.
• EMA(3) • EMA(8)
Holts Exponential Moving Average
• Holt (1957) extended simple exponential smoothing to allow the forecasting of data with a trend.
• It uses two different smoothening.
## [1] 16954.18
Holts Exponential Moving Average
# Forecast into the future
• Data with trend, no seasonality skirtsF19 <- forecast(skirtsF, h=19)
plot(skirtsF19)
Holt-Winters Exponential Moving Average
• Holt (1957) and Winters (1960) extended Holt’s method to capture seasonality.
• The Holt-Winters seasonal method comprises the forecast equation and three smoothing equations
## [1] 0.2030765
Holt-Winters Exponential Moving Average
airF10<-forecast(hw_air, h= 10)
plot(airF10)
How to measure Goodness of Fit