Learn R Programming

hts (version 3.03)

hts: Create a hierarchical or grouped time series

Description

Method for creating hierarchical or grouped time series. For a grouped time series, there is no need for a hierarchical structure.

Usage

hts(y, g)
gts(y, g, hierarchical=FALSE)

Arguments

y
Multivariate time series containing the bottom level series
g
Group matrix indicating the group structure, with one column for each series when completely disaggregated, and one row for each grouping of the time series.
hierarchical
Indicates if the grouping matrix should be treated as hierarchical.

Value

  • yMultivariate time series containing the bottom level series
  • gInformation about the groups of a grouped time series
  • mNumber of groups within each grouping
  • gmaTop level series equal to the rowsums of y

Details

hts is simply a wrapper for gts(y,g,TRUE).

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

accuracy.gts, forecast.gts, plot.gts

Examples

Run this code
abc <- ts(5 + matrix(sort(rnorm(200)), ncol = 4, nrow = 100))
x <- hts(abc, c(1,1,2,2))
y <- gts(abc, rbind(c(1,1,2,2), c(1,2,1,2)))

Run the code above in your browser using DataLab