I have a monthly time series (for 2009-2012 non-stationary, with seasonality). I can use ARIMA (or ETS) to obtain point and interval forecasts for each month of 2013, but I am interested in forecasting the total for the whole year, including prediction intervals. Is there an easy way in R to obtain interval forecasts for the total for 2013?
Yearly Forecast – Forecast Total for a Year Given Monthly Time Series
aggregationforecastingrtime series
Related Solutions
This is a very frequent happening. The series data shows spikes due to the difference in the number of days.
So, there is a technique called Calender Adjustment, where instead of plotting the net value against the time, the average value per time stamp is considered.
Example: Average value per month.
So, when the time series is adjusted accordingly (by considering the average value per time stamp; instead of the net overall value), the problem of complexity is solved.
And on your question about: Do we even need to worry about this when forecasting using a time series model or does the model account for this? As you can see that this difference in the number of days per month increases the complexity of the series, so by the calender adjustment technique, one can simplify the model without losing on the features and details of the data.
So, now we take into account the number of days, and do not need to consider the number of business days in a month and also do not need to worry about this when forecasting using a time series model.
So, that would smoothen the plot and effectively remove the variation due to the different month lengths; thus making the pattern simpler.
This is excellently explained here.
The R code:
library("fpp")
monthdays <- rep(c(31,28,31,30,31,30,31,31,30,31,30,31),14)
monthdays[26 + (4*12)*(0:2)] <- 29
par(mfrow=c(2,1))
plot(milk, main="Monthly milk production per cow",
ylab="Pounds",xlab="Years")
plot(milk/monthdays, main="Average milk production per cow per day",
ylab="Pounds", xlab="Years")
You might want to look at http://www.autobox.com/pdfs/capable.pdf starting with slide 43 for an example and any number of my responses to this list as this subject has come up many times.
The issue is that DAILY DATA can be largely dependent on deterministic variables like day-of-the-week, week-of-the-year, month of-the-year, week-of-the-month, long-weekends, Fridays-before-a-Monday-Holiday or Mondays-after-a-Friday-Holiday and/or particular days-of-the-month effects.
A major hurdle for you is that holidays (before, on and after) are important and heuristics (i.e. not simply done!) are required to identify many of these structures. Furthermore there may be changes in daily patterns over time and different volatilities (uncertainties/variability) for different days of the week.
To determine these factors requires searching for patterns, not just fitting coefficients. Detecting level shifts and local time trends along with one-time unusual values is also critical beside correctly forming an appropriate structure (i.e. ARIMA model identification) is also critical as one needs to craft together a number of competing model possibilities. Finally changing error variance and/or changing model parameters over time need to be considered as they can come into play quite frequently.
In closing one needs to possibly bring user-specified predictor series and their lead and lag structure which may be needed to explain the series of interest.
Best Answer
Here is a trick I've used before, although I don't think I've ever published it. If
x
is your monthly time series, then you can construct annual totals as follows.To get the forecasts of the annual totals:
The last forecast is for the total of the next year.
An extended version of this answer is at http://robjhyndman.com/hyndsight/forecasting-annual-totals/