Time-Series Forecasting using TBATS model

- Pentaho


Time-series forecasting refers to the use of a model to predict future values based on previously observed values. Many researchers are familiar with time-series forecasting yet they struggle with specific types of time-series data. One such type of data is data with seasonality. There can be many types of seasonalities present (e.g., time of day, daily, weekly, monthly, yearly).

TBATS is a forecasting method to model time series data.The main aim of this is to forecast time series with complex seasonal patterns using exponential smoothing.


Many time series exhibit complex and multiple seasonal patterns (e.g., hourly data that contains a daily pattern, weekly pattern and an annual pattern). The most popular models (e.g. ARIMA and exponential smoothing) can only account for one seasonality.

TBATS model has the capability to deal with complex seasonalities (e.g., non-integer seasonality, non-nested seasonality and large-period seasonality) with no seasonality constraints, making it possible to create detailed, long-term forecasts.


TBATS is an acronym for key features of the model:

T: Trigonometric seasonality
B: Box-Cox transformation
A: ARIMA errors
T: Trend
S: Seasonal components

In order to start forecasting we need to first install tbats package. The following steps should be implemented to create the model:

  • Partition the data into two parts(say, train_data and test_data). Train_data is used to train the model and fit model to data.The trained model is evaluated using test_data.
  • Provide information about season lengths to the model (e.g., if hourly data is present, the model can be plotted weekly for all 24*7 hrs in a week).
  • Fit the model to train_data by passing train_data to model.
  • Forecast the model ahead by certain period of time for which you want to predict.

Example: Forecast of sales for next 365 days


The above model is plotted for data-set with daily observation of sales. The graph is plotted for yearly (365 days) season length for all weeks in a year. The above model depicts yearly seasonal effect of sales.


TBATS makes it easy for users to handle data with multiple seasonal patterns. This model is preferable when the seasonality changes over time.