# 6.4 X-12-ARIMA decomposition

One of the most popular methods for decomposing quarterly and monthly data is X-12-ARIMA, which has its origins in methods developed by the US Bureau of the Census. It is now widely used by the Bureau and government agencies around the world. Earlier versions of the method included X-11 and X-11-ARIMA. An X-13-ARIMA method is currently under development at the US Bureau of the Census.

The X-12-ARIMA method is based on classical decomposition, but with many extra steps and features to overcome the drawbacks of classical decomposition that were discussed in the previous section. In particular, the trend estimate is available for all observations including the end points, and the seasonal component is allowed to vary slowly over time. It is also relatively robust to occasional unusual observations. X-12-ARIMA handles both additive and multiplicative decomposition, but only allows for quarterly and monthly data.

The “ARIMA” part of X-12-ARIMA refers to the use of an ARIMA model (see Chapter 7) that provides forecasts of the series forward in time, as well as backwards in time. Then, when a moving average is applied to obtain an estimate of the trend-cycle, there is no loss of observations at the start and end of the series.

The algorithm begins in a similar way to classical decomposition, and then the components are refined through several iterations. The following outline of the method describes a multiplicative decomposition applied to monthly data. Similar algorithms are used for additive decompositions and quarterly data.

- Compute a $2\times12$ moving average applied to the original data to obtain a rough estimate of the trend-cycle $\hat{T}_t$ for all periods.
- Calculate ratios of the data to trend (called “centered ratios”): $y_t/\hat{T}_t$.
- Apply separate $3\times3$ MAs to each month of the centered ratios to form a rough estimate of $\hat{S}_t$.
- Divide the centered ratios by $\hat{S}_t$ to get an estimate of the remainder, $\hat{E}_t$.
- Reduce extreme values of $E_t$ to get modified $\hat{E}_t$.
- Multiply modified $\hat{E}_t$ by $\hat{S}_t$ to get modified centered ratios.
- Repeat Step 3 to obtain revised $\hat{S}_t$.
- Divide original data by the new estimate of $\hat{S}_t$ to give the preliminary seasonally adjusted series, $y_t/\hat{S}_t$.
- The trend-cycle $\hat{T}_t$ is estimated by applying a weighted Henderson MA to the preliminary seasonally adjusted values. (The greater the randomness, the longer the length of the moving average used.) For monthly series: either a 9-, 13-, or 23-term Henderson moving average is used.
- Repeat Step 2. New ratios are obtained by dividing the original data by the new estimate of $\hat{T}_t$.
- Repeat Steps 3–6 using the new ratios and applying a $3\times5$ MA instead of a $3\times3$ MA.
- Repeat Step 7 but using a $3\times5$ MA instead of a $3\times3$ MA.
- Repeat Step 8.
- The remainder component is obtained by dividing the seasonally adjusted data from Step 13 by the trend-cycle obtained in Step 9.
- Extreme values of the remainder component are replaced as in Step 5.
- A series of modified data is obtained by multiplying the trend-cycle, seasonal component, and adjusted remainder component together.

The whole process is repeated two more times using the data obtained in the Step 16 each time. On the final iteration, the $3\times5$ MA of Steps 11 and 12 is replaced by either a $3\times3$, $3\times5$, or $3\times9$ moving average, depending on the variability in the data.

X-12-ARIMA also has some sophisticated methods to handle trading day variation, holiday effects and the effects of known predictors, which are not covered here.

A complete discussion of the method is available in Ladiray and Quenneville (2001).

There is currently no R package for X-12-ARIMA decomposition. However, free software that implements the method is available from the US Census Bureau and an R interface to that software is provided by the x12 package.