## 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("sd", "none", "nseries"),
parallel = FALSE, num.cores = 2, FUN = NULL,
xreg = NULL, newxreg = NULL, ...)
{gts}
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.method="mo"
)parallel
package to allow parallel processingforecast
function. It is applied to all series in order to generate base forecasts.
When FUN
is not NULL
, fmethod
, po
fmethod = "arima"
, a vector or matrix of external regressors used for modelling, which must have the same number of rows as the original univariate time seriesfmethod = "arima"
, a vector or matrix of external regressors used for forecasting, which must have the same number of rows as the h
forecast horizonets
,
auto.arima
or FUN
.gts
.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.
When xreg
and newxreg
are passed, the same covariates are applied to every series in the hierarchy.
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.
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.
Gross, C. and Sohl, J. (1990) Dissagregation methods to expedite product line forecasting, Journal of Forecasting, 9, 233-254.
hts
, gts
, plot.gts
, accuracy.gts
forecast(htseg1, h = 10, method = "bu", fmethod = "arima")
forecast(htseg2, h = 10, method = "comb",
FUN = function(x) tbats(x, use.parallel = FALSE))
Run the code above in your browser using DataLab