I currently have hourly electricity demand data last for 5 years, where I used:

demand <- msts(mydata$DEMAND,seasonal.period=c(24,182.5*24,365*24),start=2012)

The plot of stl shows the data have a clear decreasing trend and seasonality, the data is also not normally distributed.

Stl plot of original time series

I tried:

  1. take seasonal difference, then take first difference
  2. log transform
  3. Box-Cox transform

All of them do not work, I still have a time series with seasonality and trend. (Do you know how to deal with this?). e.g. the plot of 40 days data after seasonal and first difference: the plot of 40 days data after seasonal and first difference:

Then I use following code to fit the above three times series.

fit <- auto.arima(demand, seasonal=FALSE, xreg=fourier(demand, K=4))

I get ACF plot with clearly seasonal, and significant PACF plot until lag>200.

I also tried:

fit <- tbats(demand)

No improvement in residuals.

Can any one help me with this? Many thanks.


1 Answer 1


A couple of things.

First, you are doing a good job by including multiple seasonalities. However:

demand <- msts(mydata$DEMAND,seasonal.period=c(24,182.5*24,365*24),start=2012)

Why do you include a seasonal cycle of length 182.5*24 for hourly data, i.e., half a year? Your seasonal cycles of length 24 already match daily cycles (day vs. night), and the ones of length 365*24 match yearly ones (summer vs. winter). I do not see a need for a cycle that repeats every six months.

However, there often is a difference between weekday and weekend electricity consumption, so it would be a good idea to include a cycle of length 7*24.

Next, don't misread the stl plot. Note the grey rectangles on the right. The height is the same across all four panels in terms of y values. That is, what looks like a clear decreasing trend is a far weaker signal than the other components. Imagine rescaling the trend panel by squeezing it vertically until its grey rectangle is the same height as the grey rectangle in, say, the seasonal panel.

Finally, I would typically recommend a tbats model to model electricity demand and/or load, which is exactly what you already did. If your tbats model is not satisfactory, you will need to go farther to the frontiers of electricity load forecasting. For instance, I recommend Hong & Fan (2016). "Probabilistic electric load forecasting: A tutorial review". International Journal of Forecasting, 32(3): 914-938. You could also search for other articles on "load forecasting" in the IJF or elsewhere.

Finally, I took the liberty of adding the tag to your question. Previous posts in this tag may be helpful.

  • $\begingroup$ Thanks a lot. Does it mean I do not need to bother with box-cox transformation as 'tbats' will do it automatically? I fitted 'tbats' , and got TBATS(1, {0,0}, 0.8, {<24,5>, <168,6>, <8760,8>}), which seems weird as the (p,q) for ARMA are all 0. $\endgroup$
    – Jeannie
    Jun 30, 2016 at 13:50
  • $\begingroup$ Yes, TBATS will automatically transform. (That's what one of the letters stands for, either "T" for "transform", or "B" for "Box-Cox", I forgot which.) I'm not overly familiar with the way tbats formats its output, but I don't think a comparison with an ARMA model which does not model all the (important!) seasonalities would be very enlightening. $\endgroup$ Jun 30, 2016 at 14:20
  • $\begingroup$ Thanks @Stephan I am also wondering that if I would like to take temperature and electricity price into account, does TBATS still work? I found on @Rob J Hyndman that it may not cope with regressor. Which one do you think would be better ? 1. Fit whatever model to temperature and price, then use fourier and auto.arima model to forecast electricity demand. 2. Fit tbats model on demand directly and forecast it ignoring other factors. $\endgroup$
    – Jeannie
    Jul 2, 2016 at 14:40
  • $\begingroup$ Option 1 is a possibility. Alternatively, you could regress your observations on your regressors, then fit a TBATS model to the residuals. This is how regression with ARIMA errors works, see here. $\endgroup$ Jul 3, 2016 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.