Accelerating the pace of engineering and science

# Documentation

## Seasonal Filters

### What Is a Seasonal Filter?

You can use a seasonal filter (moving average) to estimate the seasonal component of a time series. For example, seasonal moving averages play a large role in the X-11-ARIMA seasonal adjustment program of Statistics Canada [1] and the X-12-ARIMA seasonal adjustment program of the U.S. Census Bureau [2].

For observations made during period k, k = 1,...,s (where s is the known periodicity of the seasonality), a seasonal filter is a convolution of weights and observations made during past and future periods k. For example, given monthly data (s = 12), a smoothed January observation is a symmetric, weighted average of January data.

In general, for a time series xt, t = 1,...,N, the seasonally smoothed observation at time k + js, j = 1, ...,N/s – 1, is

 ${\stackrel{˜}{s}}_{k+js}=\sum _{l=-r}^{r}{a}_{l}{x}_{k+\left(j+l\right)s},$ (2-1)

with weights ${a}_{l}$ such that ${\sum }_{l=-r}^{r}{a}_{l}=1.$

The two most commonly used seasonal filters are the stable seasonal filter and the Sn × m seasonal filter.

### Stable Seasonal Filter

Use a stable seasonal filter if the seasonal level does not change over time, or if you have a short time series (under 5 years).

Let nk be the total number of observations made in period k. A stable seasonal filter is given by

${\stackrel{˜}{s}}_{k}=\frac{1}{{n}_{k}}\sum _{j=1}^{\left(N/s\right)-1}{x}_{k+js},$

for k = 1,...,s, and ${\stackrel{˜}{s}}_{k}={\stackrel{˜}{s}}_{k-s}$ for k > s.

Define$\overline{s}=\left(1/s\right){\sum }_{k=1}^{s}{\stackrel{˜}{s}}_{k}.$ For identifiability from the trend component,

• Use ${\stackrel{^}{s}}_{k}={\stackrel{˜}{s}}_{k}-\overline{s}$ to estimate the seasonal component for an additive decomposition model (that is, constrain the component to fluctuate around zero).

• Use ${\stackrel{^}{s}}_{k}={\stackrel{˜}{s}}_{k}/\overline{s}$ to estimate the seasonal component for a multiplicative decomposition model (that is, constrain the component to fluctuate around one).

### Sn × m seasonal filter

To apply an Sn × m seasonal filter, take a symmetric n-term moving average of m-term averages. This is equivalent to taking a symmetric, unequally weighted moving average with n + m – 1 terms (that is, use $r=\left(n+m-1\right)/2$ in Equation 2-1).

An S3×3 filter has five terms with weights

$\left(1/9,2/9,1/3,2/9,1/9\right).$

To illustrate, suppose you have monthly data over 10 years. Let Janyy denote the value observed in January, 20yy. The S3×3-filtered value for January 2005 is

$\stackrel{^}{J}a{n}_{05}=\frac{1}{3}\left[\frac{1}{3}\left(Ja{n}_{03}+Ja{n}_{04}+Ja{n}_{05}\right)+\frac{1}{3}\left(Ja{n}_{04}+Ja{n}_{05}+Ja{n}_{06}\right)+\text{\hspace{0.17em}}\frac{1}{3}\left(Ja{n}_{05}+Ja{n}_{06}+Ja{n}_{07}\right)\right].$

Similarly, an S3×5 filter has seven terms with weights

$\left(1/15,2/15,1/5,1/5,1/5,2/15,1/15\right).$

When using a symmetric filter, observations are lost at the beginning and end of the series. You can apply asymmetric weights at the ends of the series to prevent observation loss.

To center the seasonal estimate, define a moving average of the seasonally filtered series, ${\overline{s}}_{t}={\sum }_{j=-q}^{q}{b}_{j}{\stackrel{˜}{s}}_{t+j}.$ A reasonable choice for the weights are${b}_{j}=1/4q$ for j = ±q and ${b}_{j}=1/2q$ otherwise. Here, q = 2 for quarterly data (a 5-term average), or q = 6 for monthly data (a 13-term average).

For identifiability from the trend component,

• Use ${\stackrel{^}{s}}_{t}={\stackrel{˜}{s}}_{t}-{\overline{s}}_{t}$ to estimate the seasonal component of an additive model (that is, constrain the component to fluctuate approximately around zero).

• Use ${\stackrel{^}{s}}_{t}={\stackrel{˜}{s}}_{t}/{\overline{s}}_{t}$ to estimate the seasonal component of a multiplicative model (that is, constrain the component to fluctuate approximately around one).

## References

[1] Dagum, E. B. The X-11-ARIMA Seasonal Adjustment Method. Number 12–564E. Statistics Canada, Ottawa, 1980.

[2] Findley, D. F., B. C. Monsell, W. R. Bell, M. C. Otto, and B.-C. Chen. "New Capabilities and Methods of the X-12-ARIMA Seasonal-Adjustment Program." Journal of Business & Economic Statistics. Vol. 16, Number 2, 1998, pp. 127–152.