Description Usage Arguments Value Author(s) References See Also Examples
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.
1 2 3 |
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 |
groups |
If the object class is |
weights |
A numeric vector. The default is |
algorithms |
An algorithm to be used for computing reconciled forecasts. See details. |
keep |
Return a |
Return the reconciled gts
object or forecasts at the bottom level.
Alan Lee, Rob J Hyndman and Earo Wang
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/
Hyndman, R. J., Lee, A., & Wang, E. (2014). Fast computation of reconciled forecasts for hierarchical and grouped time series. Working paper 17/14, Department of Econometrics & Business Statistics, Monash University. http://robjhyndman.com/working-papers/hgts/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # hts example
## Not run: 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", algorithms = "lu")
plot(y.f)
## End(Not run)
# gts example
## Not run: 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", algorithms = "lu")
plot(y.f)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.