# Forecasting energy consumption with ARIMA and regressors

Known data, 4 years of daily energy consumption correlated with temperature, seasonal calendar and holidays.
Required forecasting for next days depending on known variables like temperature and holidays.
My approach is:

#(variables :Year;Month;Day;CD;Temperature;Holiday) // CD= Consumption

prevCD<-auto.arima(ts(trainCD$CD,frequency =365),d=1,D=1,xreg=trainCD$Temp)

#where trainCD$Temp represents history of daily temperatures ProgCD <- forecast(prevCD,xreg = temper$Tprog)

#forecast using future temperatures from external system

The daily forecast is OK, it gives good results; but I would like also to improve it by adding the holiday variable, on the history and on the future variables.
My question is: Can I use something like this?

prevCD7 <- auto.arima(ts(trainCD$CD,frequency=365),d=1,D=1, xreg=cbind(trainCD$Temp,trainCD$Holiday)) ProgCD7 <- forecast(prevCD7, xreg=cbind(temper$Tprog,temper\$Holiday2))
• – Rob Hyndman Dec 5 '16 at 21:51
• Holiday effects are quite common both before and after the holiday thus you need to consider the window of response per holiday. Temperature should be converted to heating and cooling degree days to incorporate the "bathtub effect " . Your series may have a number of level shifts and/or a number of time trends , Unusual values need to be identified for you to have robust model where unusual values don't distort model identification or estimated parameters. Non-constant error variance (if any) needs to be identified and remedied either with GLS or appropriate Box-Cox adjustments. – IrishStat Dec 5 '16 at 22:14