This is an interesting article written by Majid Khattak. The full article can be read here. The reason I mention this article is because the chart at the bottom (eletricity consumption over several days  - observed values in black, predicted ones in blue) looks very similar to the top chart in our article Challenge of the week: detecting multiple periodicity in time series. It makes you think you are dealing with multiple periodicity.

For more articles about R, click here. For more articles about electricity trading or forecasts, click here.

Here are some extracts of Majid's article:

Methods and Data

In this blog I will use a modified exponential smoothing method called TBATS (which is an acronym for Trigonometric, Box-Cox Transformation, ARMA Errors, Trend and Seasonality) model for short-term electricity demand forecasting. It’s an innovation state space modeling framework for forecasting complex time series containing more than one or complex seasonal periods. This is a new approach published by De Livera et al. in the Journal of American Statistical Association. The article contains intricate mathematical details. The method has been implemented by Slava Razbash and Rob J. Hyndman in R’s “forecast” package.

The data for the analysis is available from the website of Independent Electricity System Operator which is responsible for power distribution in Ontario Canada. The original dataset comprised hourly demand time series from 2002 until 2014.

R Code

electricity.data <- read.csv("HourlyDemands_2002-2014.csv") 


electricity.train <- electricity.data[102433:103800,]

#Test Set: 4 weeks of data containing 672 hourly data points from
# 04 March 2014 uptill 31 March 2014.
electricity.test <- electricity.data[103801:104492,]

Fitting the TBATS model:

#The output below has been modified to avoid large amount of data from
#printing on the screen.
## This is forecast 6.1
electricity.tbats <- tbats(electricity.train[,4],seasonal.periods = c(24,168))
## TBATS(0, {3,1}, 0.95, {<24,8>, <168,4>})
## Call: tbats(y = electricity.train[, 4], seasonal.periods = c(24, 168))
## Parameters
## Lambda: 5.3e-05
## Alpha: 0.02193652
## Beta: 0.003105538
## Damping Parameter: 0.949609
## Gamma-1 Values: -9.47268e-06 -1.780174e-05
## Gamma-2 Values: -4.117514e-05 2.1836e-06
## AR coefficients: 0.715125 0.30404 -0.2388
## MA coefficients: 0.591792
## Sigma: 0.01059258
## AIC: 24332.95
#Plot showing the decomposition of the time series.



DSC Resources

Additional Reading

Follow us on Twitter: @DataScienceCtrl | @AnalyticBridge

Views: 3723

Reply to This

© 2021   TechTarget, Inc.   Powered by

Badges  |  Report an Issue  |  Privacy Policy  |  Terms of Service