# How to treat holidays when working with time series data?

I am analysing hourly demand data for electricity. To make my forecasts more accurate, how should I treat the national holidays in the data?

In particular, how should I treat them in R?

-
Can you do a head() output of your current data. What methods are you currently using for the forecasts? –  Max Gordon Nov 23 '11 at 7:52
Thanks for the replies. I was considering discarding away the data for the national holidays. How will this be treated by R? Suppose I discard the data for 15 June. Do I have to join the series readings of 16 June at the end of 14 June and then apply my analysis? I am analysing 6 months of data. Will discarding two or three days like this make any difference? regards Leo –  user7567 Nov 23 '11 at 15:31
Rather than discarding that data, include a dummy variable in your model that is 0 during normal days and 1 during national holidays. This will add a "holiday effect" to your model, and you can discard those days AFTER modeling. This will help you avoid dealing with an irregular time series. –  Zach Nov 23 '11 at 20:16
I thank you for your patience and input. I am getting nearer to the solution after reading your suggestions. How can I smooth over the national holidays or treat them as missing values in R? regards Leo –  user7567 Nov 24 '11 at 3:19
I have removed the holidays data and replaced it with NA. Then used Amelia to fill the data. –  user7606 Nov 25 '11 at 14:53

There is a little detail here, so a generic answer.

First of all, check if this problem exists; look at the residuals during holidays and test whether there is any significant problem with accuracy there. Your model might have already take holidays into account (for instance through some other predictors), or they are just irrelevant to what you trying to predict on your current accuracy level.

If the difference exists, try adding information about the holidays to the variables in the model; you can start with binary isHoliday, then think how to extend this to something more complex (i.e. add some adjacent days where it is handy to get a leave to enlarge the break, think of some continuous measure of "holidayness").

If your model is too dumb to use such variables, consider making two -- for normal days and for holidays.

Finally, if it happens you won't have to deal with predictions during holidays or it is a lesser problem to generate junk then, you may just throw this part of data.

-

I've always found it tough to handle the multiple (annual, weekly, daily) seasonality of electricity load/price data using time series methods. I use an approach (very) similar to IrishStat's except that I forecast the daily peak (MW) and total energy (MW/h) using machine learning methods (as opposed to time series), and then construct a linear regression model for each hour (1-24) of the day. The forecasted peak/total energy are features in each of the hourly models. The rest of the features are basically the same for all 26 models, with day of week, holiday and season represented as dummy variables. Obviously weather and lagged dependent variable values are also important features.

As an aside, six months of data is really not ideal regardless of your approach because this is clearly a process with an element of annual seasonality. Normally I'd say you need three years to properly train and test your model. With less than a year, you can't even fully assess those annual seasonality effects.

If you do go the time series route, just dumping the holidays will be a problem if you have a weekly seasonality term, e.g. if you try to explain the following Thursday's load as a function of the load on Thanksgiving.

-