Description Usage Arguments Value Author(s) References See Also Examples
Method for creating grouped time series.
1 2 3 4 5 6 7 8 9 
y 
A matrix or multivariate time series contains the bottom level series. 
groups 
Group matrix indicates the group structure, with one column
for each series when completely disaggregated, and one row for each grouping
of the time series. It allows either a numerical matrix or a matrix
consisting of strings that can be used for labelling. If the argument

gnames 
Specify the group names. 
characters 
A vector of integers, or a list containing vectors of
integers, indicating the segments in which bottom level names can be read in
order to construct the corresponding grouping matrix and its labels. A

xts 

x 

... 
Extra arguments passed to 
object 

bts 
Multivariate time series contains the bottom level series 
groups 
Information about the groups of a grouped time series 
labels 
Information about the labels that are used for plotting. 
Earo Wang and Rob J Hyndman
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/
hts
, accuracy.gts
,
forecast.gts
, plot.gts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25  # Example 1 illustrating the usage of the "groups" argument
abc < ts(5 + matrix(sort(rnorm(1600)), ncol = 16, nrow = 100))
sex < rep(c("female", "male"), each = 8)
state < rep(c("NSW", "VIC", "QLD", "SA", "WA", "NT", "ACT", "TAS"), 2)
gc < rbind(sex, state) # a matrix consists of strings.
gn < rbind(rep(1:2, each = 8), rep(1:8, 2)) # a numerical matrix
rownames(gc) < rownames(gn) < c("Sex", "State")
x < gts(abc, groups = gc)
y < gts(abc, groups = gn)
# Example 2 with two simple hierarchies (geography and product) to show the argument "characters"
bnames1 < c("VICMelbAA", "VICMelbAB", "VICGeelAA", "VICGeelAB",
"VICMelbBA", "VICMelbBB", "VICGeelBA", "VICGeelBB",
"NSWSyndAA", "NSWSyndAB", "NSWWollAA", "NSWWollAB",
"NSWSyndBA", "NSWSyndBB", "NSWWollBA", "NSWWollBB")
bts1 < matrix(ts(rnorm(160)), ncol = 16)
colnames(bts1) < bnames1
x1 < gts(bts1, characters = list(c(3, 4), c(1, 1)))
# Example 3 with a nonhierarchical grouped time series of 3 grouping variables (state, age and sex)
bnames2 < c("VIC1F", "VIC1M", "VIC2F", "VIC2M", "VIC3F", "VIC3M",
"NSW1F", "NSW1M", "NSW2F", "NSW2M", "NSW3F", "NSW3M")
bts2 < matrix(ts(rnorm(120)), ncol = 12)
colnames(bts2) < bnames2
x2 < gts(bts2, characters = c(3, 1, 1))

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.