combinef

0th

Percentile

Optimally combine forecasts from a hierarchical or grouped time series

Using the method of Hyndman et al. (2011), this function optimally combines the forecasts at all levels of a hierarchical time series. The forecast.gts calls this function when the comb method is selected.

Keywords
ts
Usage
combinef(fcasts, nodes, groups, weights = NULL, keep = c("gts", "bottom"))
Arguments
fcasts
Matrix of forecasts for all levels of the hierarchical time series. Each row represents one forecast horizon and each column represents one time series from the hierarchy.
nodes
If the object class is hts, a list contains the number of child nodes referring to hts.
groups
If the object class is gts, a gmatrix is required, which is the same as groups in the function gts.
weights
A numeric vector. The default is NULL that means the ordinary least squares is implemented.
keep
Return a gts object or the the reconciled forecasts at the bottom level.
Value

  • Return the reconciled gts object or forecasts at the bottom level.

References

R. J. Hyndman, R. A. Ahmed, G. Athanasopoulos and H.L. Shang (2011) Optimal combination forecasts for hierarchical time series. Computational Statistics and Data Analysis, 55(9), 2579--2589. http://robjhyndman.com/papers/hierarchical/

See Also

hts, forecast.gts

Aliases
  • combinef
Examples
# hts example
h <- 12 
ally <- aggts(htseg1)
allf <- matrix(NA, nrow = h, ncol = ncol(ally))
for(i in 1:ncol(ally))
	allf[,i] <- forecast(auto.arima(ally[,i]), h = h, PI = FALSE)$mean
allf <- ts(allf, start = 51)
y.f <- combinef(allf, htseg1$nodes, weights = NULL, keep = "gts")
plot(y.f)

# gts example
abc <- ts(5 + matrix(sort(rnorm(200)), ncol = 4, nrow = 50))
g <- rbind(c(1,1,2,2), c(1,2,1,2))
y <- gts(abc, groups = g)
h <- 12
ally <- aggts(y)
allf <- matrix(NA,nrow = h,ncol = ncol(ally))
for(i in 1:ncol(ally))
  allf[,i] <- forecast(auto.arima(ally[,i]),h = h, PI = FALSE)$mean
allf <- ts(allf, start = 51)
y.f <- combinef(allf, groups = g, keep ="gts")
plot(y.f)
Documentation reproduced from package hts, version 4.0, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.