2.2.3.5.2 Algorithm for Decompostion
Decompostion Model
- Multiplicative:

- Additive:

- where
is the observation,
is the trend component,
is the seasonal component, and
is the error.
Model Fitting
- Calculate smoothed time series

- If seasonal length
is an even number, compute
using
-MA. if
is an odd number, compute
using
-MA.
- Calculate the detrended series

- Calculate the seasonal component
.
- For each season, calculate the median of the detrended series for that season.And then the median is replicated in each season of
. - For multiplicative model, adjust
to average of 1. For additive model, adjust
to average of 0.
- Seasonal adjusted data
for multiplicative model,
for additive model.
- Trend component
: If model includes trend, perform linear regression on
to compute
. Otherwise calculate the mean of
as
.
- Fitted data
for multiplicative model,
for additive model.
- Detrended data
for multiplicative model,
for additive model.
- Residuals
Forecast
The forecasts are calculated by computing the trend and seasonal component separately.
- Trend component

Perform linear extrapolation on the fitted trend
.
- Seasonal component

The forecasts begin at the end of
. Replicate the values of the same season in
to get
.
- Forecasts
- Multiplicative:

- Additive:

- Multiplicative:
