## 3.5 X11 decomposition

Another popular method for decomposing quarterly and monthly data is the X11 method which originated in the US Census Bureau and Statistics Canada.

This method is based on classical decomposition, but includes many extra steps and features in order to overcome the drawbacks of classical decomposition that were discussed in the previous section. In particular, trend-cycle estimates are available for all observations including the end points, and the seasonal component is allowed to vary slowly over time. X11 also has some sophisticated methods for handling trading day variation, holiday effects and the effects of known predictors. It handles both additive and multiplicative decomposition. The process is entirely automatic and tends to be highly robust to outliers and level shifts in the time series.

The details of the X11 method are described in Dagum & Bianconcini (2016). Here we will only demonstrate how to use the automatic procedure in R.

```
<- us_retail_employment %>%
x11_dcmp model(x11 = feasts:::X11(Employed, type = "additive")) %>%
components()
autoplot(x11_dcmp) + xlab("Year") +
ggtitle("Additive X11 decomposition of US retail employment in the US")
```

Compare this decomposition with the STL decomposition shown in Figure 3.4 and the classical decomposition shown in Figure 3.10. The X11 trend-cycle has captured the sudden fall in the data due to the 2007-2008 global financial crisis better than either of the other two methods. The unusual observation in 1996 is now more clearly seen in the remainder component.

Figure 3.12 shows the trend-cycle component and the seasonally adjusted data, along with the original data.

```
%>%
x11_dcmp ggplot(aes(x = Month)) +
geom_line(aes(y = Employed, colour = "Data")) +
geom_line(aes(y = season_adjust, colour = "Seasonally Adjusted")) +
geom_line(aes(y = trend, colour = "Trend")) +
xlab("Year") + ylab("Persons (thousands)") +
ggtitle("Total employment in US retail") +
scale_colour_manual(values=c("gray","blue","red"),
breaks=c("Data","Seasonally Adjusted","Trend"))
```

It can be useful to use seasonal plots and seasonal sub-series plots of the seasonal component. These help us to visualise the variation in the seasonal component over time. Figure 3.13 shows a seasonal sub-series plot of the seasonal component from Figure 3.11. In this case, there are only small changes over time.

```
%>%
x11_dcmp gg_subseries(seasonal)
```