# forecast.gts

##### Forecast a hierarchical or grouped time series

Methods for forecasting hierarchical or grouped time series.

- Keywords
- ts

##### Usage

```
## S3 method for class 'gts':
forecast(object, h = ifelse(frequency(object) > 1L,
2L * frequency(object), 10L),
method = c("comb", "bu", "mo",
"tdgsa", "tdgsf", "tdfp"),
fmethod = c("ets", "arima", "rw"),
keep.fitted = FALSE, keep.resid = FALSE,
positive = FALSE, lambda = NULL, level,
weights = c("none", "sd", "nseries"),
parallel = FALSE, num.cores = NULL,
xreg = NULL, newxreg = NULL, ...)
```

##### Arguments

- object
- Hierarchical or grouped time series object of class
`{gts}`

- h
- Forecast horizon
- method
- Method for distributing forecasts within the hierarchy. See details
- fmethod
- Forecasting method to use
- keep.fitted
- If TRUE, keep fitted values at the bottom level.
- keep.resid
- If TRUE, keep residuals at the bottom level.
- positive
- If TRUE, forecasts are forced to be strictly positive
- lambda
- Box-Cox transformation parameter
- weights
- Weights used for "optimal combination" method. When
`weights = "sd"`

, it takes account of the standard deviation of forecasts; when`weights`

= "nseries", weights are equal to the inverse of row sums of the summing matrix. - level
- Level used for "middle-out" method (only used when
`method="mo"`

) - parallel
- If TRUE, import
`parallel`

package to allow parallel processing - num.cores
- If parallel = TRUE, specify how many cores are going to be used
- xreg
- When
`fmethod = "arima"`

, a vector or matrix of external regressors, which must have the same number of rows as the original univariate time series - newxreg
- When
`fmethod = "arima"`

, a vector or matrix of external regressors, which must have the same number of rows as the original univariate time series - ...
- Other arguments passing to
`ets`

or`auto.arima`

##### Details

Base methods implemented include ETS, ARIMA and the naive (random walk) models.
Forecasts are distributed in the hierarchy using bottom-up, top-down, middle-out and
optimal combination methods. Three top-down methods are available: the two Gross-Sohl
methods and the forecast-proportion approach of Hyndman, Ahmed, and Athanasopoulos (2011).
The "middle-out" method `"mo"`

uses bottom-up (`"bu"`

) for levels higher than `level`

and top-down forecast proportions (`"tdfp"`

) for levels lower than `level`

. For non-hierarchical grouped data, only bottom-up and combination methods are possible, as any method involving top-down disaggregation requires a hierarchical ordering of groups.

##### Value

- A forecasted hierarchical/grouped time series of class
`gts`

.

##### References

G. Athanasopoulos, R. A. Ahmed and R. J. Hyndman (2009) Hierarchical forecasts for Australian domestic tourism,
*International Journal of Forecasting*, **25**, 146-166.

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.

Gross, C. and Sohl, J. (1990) Dissagregation methods to expedite product line forecasting,
*Journal of Forecasting*, **9**, 233-254.

##### See Also

##### Examples

`forecast(htseg1, h = 10, method = "bu", fmethod = "arima")`

*Documentation reproduced from package hts, version 4.0, License: GPL (>= 2)*