2.2.3.5.2 Algorithm for Decompostion

Decompostion Model

  • Multiplicative: y_t = T_t \times S_t \times E_t
  • Additive: y_t = T_t + S_t + E_t
where y_t is the observation, T_t is the trend component, S_t is the seasonal component, and E_t is the error.

Model Fitting

  • Calculate smoothed time series\bar{T_t}
If seasonal length m is an even number, compute \bar{T_t} using 2 \times m-MA. if m is an odd number, compute \bar{T_t} using m-MA.
  • Calculate the detrended series  y_t - \bar{T_t}
  • Calculate the seasonal component S_t.
For each season, calculate the median of the detrended series for that season.And then the median is replicated in each season of S_t.
For multiplicative model, adjust S_t to average of 1. For additive model, adjust S_t to average of 0.
  • Seasonal adjusted data S_{adj} = y_t / S_t for multiplicative model, S_{adj} = y_t - S_t for additive model.
  • Trend component T_t: If model includes trend, perform linear regression on S_{adj} to compute T_t. Otherwise calculate the mean of S_{adj} as T_t.
  • Fitted data \hat{y_t} = T_t \times S_t for multiplicative model, \hat{y_t}= T_t + S_t for additive model.
  • Detrended data D_t = y_t / T_t for multiplicative model, D_t = y_t - T_t for additive model.
  • Residuals
Residuals = \hat{y_t}- y_t

Forecast

The forecasts are calculated by computing the trend and seasonal component separately.

  • Trend component t_t'

Perform linear extrapolation on the fitted trend T_t.

  • Seasonal component s_t'

The forecasts begin at the end of S_t. Replicate the values of the same season in S_t to get s_t'.

  • Forecasts y_t'
    • Multiplicative: y_t' = t_t' \times s_t'
    • Additive: y_t' = t_t' + s_t'