Sei sulla pagina 1di 15

SMOOTHING METHODS

Exponential smoothing is based on averaging (smoothing)


past values of a series in an exponentially decreasing manner.
• Simple Exponential Smoothing

• Exponential smoothing provides the weighted average moving


exponentially of all previously observed values.
– Most recent observation has largest weight α, where 0 < α < 1
– Next most recent observation receives less weight α (1 - α)
– Observation two time periods in past even less weight α (1 - α)2
– Observation three time periods in past even less weight α(1 - α)3
– And so forth.

• New prediction (time t + 1) may be thought of as a weighted


sum of new observation (time t) and the old prediction (time t).

• Weight α is given to newly observed value and weight (1 - α)


is given to old forecast value.
• New prediction = [α x (new observation)] + [(1-α) x (old
prediction)]
Ŷt 1  αYt  (1  α)Ŷt
 αYt  Ŷt  αŶt
 Ŷt  α(Yt  Ŷt )

•Ŷt 1 = new smoothed value or forecast value for next period


• α = smoothing constant (0 < α < 1)
• Yt= new observation or actual value of series in period t
• Ŷt = old smoothed value or forecast for period t

• Exponential smoothing of new prediction Ŷt 1 is old prediction Ŷt


adjusted by α times error (Yt  Ŷt ) in old prediction.
• Smoothing constant α serves as the weighting factor and
determines the extent to which current observation influences
the prediction of the next observation.
– When α is close to 1, new forecast will essentially current observation.
– When α is close to 0, new forecast will very similar to old forecast and
current observation will have very little impact.

• So, new prediction will be the old prediction plus a substantial


adjustment for any error that occurred in preceding prediction.
Ŷt 1  αYt  (1  α)Ŷt
 αYt  (1  α)[αY t 1  (1  α)Ŷt 1 ]
 αYt  α(1  α)Yt 1  (1  α) 2 Ŷt 1

• Continued this process Ŷt 1  αYt  α(1  α)Yt 1  α(1  α) 2 Yt  2


 α(1  α) 3 Yt 3  ..............
• Value assigned to α is the key to the analysis.

– If it is desired that prediction to be stable and random variations


smoothed a small value of α is required.

– If a rapid response to a real change in the pattern of observations is


desired, a larger value of α is appropriate.

• One method of estimating α is an iterative procedure that


minimizes the mean squared error (MSE)

• Predictions are computed for, say, α equal to 0.1, 0.2, ... , 0.9,
and sum of the squared prediction errors is computed for each.

• Value of α producing the smallest error is chosen for use in


generating future predictions.
• Adjusted for Trend: Holt's Method

• If the observe data have trend pattern, a linear trend prediction


function is needed.

• Holt developed an exponential smoothing method for evolving


linear trends in time series data to generate predictions.

• When a trend in the time series is anticipated, an estimate of


the current slope as well as the current level is required.

• Holt's technique smooth the level and slope directly by using


different smoothing constants for each.

• These smoothing constants provide estimates of level and slope


that adapt over time as new observations become available.
• Three equations used in Holt's method are:

• Current level estimate: L t  αYt  (1  α)(L t 1  Tt 1 )

• Trend estimate: Tt  β(L t  L t 1 )  (1  β)Tt 1

• Forecast p periods into future: Ŷt  p  L t  pTt

Lt = new smoothed value (estimate of current level)


α = smoothing constant for the level (0 < α < 1)
Yt = new observation or actual value of series in period t
β = smoothing constant for trend estimate (0 < β < 1)
Tt = trend estimate
p = periods to be forecast into the future
Ŷt =p forecast for p periods into the future
• Holt's model is similar to smoothing model, except that the
term (Tt-l) has been incorporated to properly update the level
when a trend exists.

• i.e. current level (Lt) is calculated by taking a weighted


average (weights α and 1 - α ) of two estimates of level
– one estimate is given by the current observation (Yt)
– other estimate is given by adding previous trend (Tt-l) to the previously
smoothed level (Lt-1).

• If there is no trend, then there is no need for the term Tt-l in


Holt's model and is reduce to simple smoothing.

• Second smoothing constant β, in second equation is used to


create the trend estimate.
• i.e. current trend (Tt) is a weighted average (weights β and 1 - β)
of two trend estimates
– one estimate is given by the change in level from time t - 1 to t (Lt - Lt-1)
– other estimate is the previously smoothed trend (Tt-1).

• Second equation is similar to the first equation, except that the


smoothing is done for the trend rather than the actual data.

• Third equation shows the forecast for p periods into the future.

• For a forecast made at time t, the current trend estimate (Tt) is


multiplied by the number of periods to be forecast (p) then
added to the current level (Lt).

• Note that the forecasts for future periods lie along a straight line
with slope Tt and intercept Lt.
• Smoothing constants α and β can be selected subjectively or by
minimizing a measure of prediction error such as the MSE.

• Large weights result in more rapid changes in the component;


small weights result in less rapid changes.

• Take the values of α and β from 0 to 1 (e.g. 0, 0.1, 0.2, .. , 0.9,


1.0), then select the combination that provides lowest MSE.

• To fit Holt model, first to determine the initial value of L and T.

• One approach is to set first estimate of the smoothed level equal


to the first observation.

• The trend is then estimated to be zero.


• Adjusted for Trend and Seasonality: Winter’s Method

• Winters' three-parameter linear and seasonal smoothing


method as an extension of Holt's method, where one additional
equation is used to estimate seasonality.

• Seasonality estimate ‘St’ is given as γ times an estimate of the


seasonal index given by Yt / Lt added to (1 - γ) times the
previous seasonal component St-s.

• To smooth current and previous values of actual data, Yt is


divided by current level estimate Lt is to create an index (Yt /
Lt) which is adjust the forecast for seasonal peaks and valleys.

• Four equations used in Winters' smoothing are:


Yt
• Current level estimate: L t  α  (1  α)(L t 1  Tt 1 )
S t s
• Trend estimate: Tt  β(L t L t 1 )  (1  β)Tt 1
Yt
• Seasonal estimate: S t  γ  (1  γ)S t s
Lt
• Forecast p periods into the future: Ŷt  p  (L t  pTt )S t s p

– Lt = new smoothed value or current level estimate


– α = smooth the data to create a level estimate
– Yt = new observation or actual value in period t
– β = smooth the data to create a trend
– Tt = trend estimate
– γ = smooth the data to create a seasonal component
– St = seasonal estimate
– p = periods to be forecast into the future
– s = length of seasonality
– Yˆt  p = forecast for p periods into the future
• First equation updates the smoothed series.
– Here Yt is divided by St-s, which adjusts Yt for seasonality, thus
removing the seasonal effects that might exist in the original data Yt.

• Then the trend and seasonal estimate will smooth by second


and third equation. Finally, the prediction is obtained.

• Weights α, β and γ can be selected subjectively or by


minimizing a measure of forecast error such as MSE.

• To begin the Winters’ model:


– Initial values for the smoothed series Lt, trend Tt, and seasonal
indices St must be set.
– Set the initial values for the smoothed series Lt equal to the first
observation.
– Trend is then estimated to equal 0
– Seasonal indices are each set to 1.0 or Yt / Lt
R Code for Holts and Winter
1. install. Packages(“forecast”)
2. library (forecast)
3. Import dataset and convert it into time series data
• data ˂- ts (Filename$VariableName, start=c(year,1),
end=c(year,4),
frequency=monthly(1)/annually(12)/quarterly(4))
4. To View data
• data
5. To plot data
• plot (data)
6. Simple Exponential Smoothing
• se˂-HoltWinters (data, beta=FALSE, gamma=FALSE)
• se
7. To check accuracy
• accuracy (forecast(se))
8. To predict for 2 values.
• pd˂-forecast(se,2)
9. For double exponential smoothing
• de˂-HoltWinters (data, gamma=FALSE)
• de
• Pd1<-forecast(de,2)
• accuracy (forecast(de))
10. For triple exponential smoothing
• te˂-HoltWinters (data)
• te
• accuracy (forecast(te))

Potrebbero piacerti anche