Get startedGet started for free

TBATS models for electricity demand

As you saw in the video, a TBATS model is a special kind of time series model. It can be very slow to estimate, especially with multiple seasonal time series, so in this exercise you will try it on a simpler series to save time. Let's break down elements of a TBATS model in TBATS(1, {0,0}, -, {<51.18,14>}), one of the graph titles from the video:

Component Meaning
1 Box-Cox transformation parameter
{0,0} ARMA error
- Damping parameter
{\<51.18,14>} Seasonal period, Fourier terms


The gas data contains Australian monthly gas production. A plot of the data shows the variance has changed a lot over time, so it needs a transformation. The seasonality has also changed shape over time, and there is a strong trend. This makes it an ideal series to test the tbats() function which is designed to handle these features.

gas is available to use in your workspace.

This exercise is part of the course

Forecasting in R

View Course

Exercise instructions

  • Plot gas using the standard plotting function.
  • Fit a TBATS model using the newly introduced method to the gas data as fit.
  • Forecast the series for the next 5 years as fc.
  • Plot the forecasts of fc. Inspect the graph title by reviewing the table above.
  • Save the Box-Cox parameter to 3 decimal places and order of Fourier terms to lambda and K, respectively.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Plot the gas data
___(___)

# Fit a TBATS model to the gas data
fit <- ___(___)

# Forecast the series for the next 5 years
fc <- ___(___)

# Plot the forecasts
___(___)

# Record the Box-Cox parameter and the order of the Fourier terms
lambda <- ___
K <- ___
Edit and Run Code