Get Started

TBATS models

1. TBATS models

A TBATS models combines many of the components of models we have already used into one single automated framework.

2. TBATS model

It includes trigonometric terms for seasonality. These are similar to the Fourier terms we used in harmonic regression, except that here the seasonality can change over time. It includes a Box-Cox transformation. It has ARMA errors like a dynamic regression. It has level and trend terms, similar to an ETS model. And everything is automated. The number of Fourier-like terms, the Box-Cox transformation, the ARMA error. Everything. This makes them very convenient, but also somewhat dangerous as sometimes the automatic choices are not so good. Let's look at some examples.

3. US Gasoline data

This time series is the weekly total of US motor gasoline supplied. See how easy the tbats function is to use. Just pass the time series to the tbats function, and the result to the forecast function. The title on the graph shows what choices have been made. The first 1 is the Box-Cox parameter meaning no transformation was required. The next part is the ARMA error - 0,0 means p equals 0 and q equals 0, so a simple white noise error was used. The third part is the damping parameter for the trend. A dash means no damping. So this is pretty simple so far - no transformation, no ARMA error and no damping. The last part tells you about the Fourier terms. The seasonal period is 52-point-18, the number of weeks in a year, and there were 14 Fourier-like terms selected. The forecasts look ok, although perhaps they are a little low.

4. Call center data

This example is the call volume every 5-minutes to a North American bank. The tbats function is slow for very long time series, so I am only using the last few months of data. More data wouldn't make much difference to the forecasts anyway. Here, the Box-Cox transformation parameter is 0-point-57, so close to a square root. There is no ARMA term and no damping parameter. The Fourier-like terms are in two groups because there are two types of seasonality. There are 169 5-minute periods in a working day, and 845 periods in a 5-day working week. 6 pairs of terms are included for daily seasonality, and 4 pairs of terms are included for weekly seasonality. In this case, the prediction intervals seem a little wide, but the forecasts look ok.

5. TBATS model

To summarize, a TBATS model is very general and handles a large range of time series. It is especially useful for data with large seasonal periods, and multiple seasonal periods. As I said earlier, tbats is conveniently automatic, but sometimes the automation is not perfect. I've used it on a lot of different time series and it seems that the prediction intervals are often too wide, even though the point forecasts might look ok. The automation also makes everything rather slow, especially on very long time series, because it needs to test lots of different possible ways of putting the model together.

6. Let's practice!

OK, over to you to try tbats on another time series.