Reconcile temporal hierarchical forecasts
Description
Takes forecasts of time series at all levels of temporal aggregation and combines them using the temporal hierarchical approach of Athanasopoulos et al (2016).
Usage
1 2 
Arguments
forecasts 
List of forecasts. Each element must be a time series of forecasts, or a forecast object. The number of forecasts should be equal to k times the seasonal period for each series, where k is the same across all series. 
comb 
Combination method of temporal hierarchies, taking one of the following values:

mse 
A vector of onestep MSE values corresponding to each of the forecast series. 
residuals 
List of residuals corresponding to each of the forecast models.
Each element must be a time series of residuals. If 
returnall 
If 
Value
List of reconciled forecasts in the same format as forecast
.
If returnall==FALSE
, only the most disaggregated series is returned.
Author(s)
Rob J Hyndman
See Also
thief
, tsaggregates
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  # Construct aggregates
aggts < tsaggregates(USAccDeaths)
# Compute forecasts
fc < list()
for(i in seq_along(aggts))
fc[[i]] < forecast(auto.arima(aggts[[i]]), h=2*frequency(aggts[[i]]))
# Reconcile forecasts
reconciled < reconcilethief(fc)
# Plot forecasts before and after reconcilation
par(mfrow=c(2,3))
for(i in seq_along(fc))
{
plot(reconciled[[i]], main=names(aggts)[i])
lines(fc[[i]]$mean, col='red')
}
