Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

forecast.baggedModel

Forecasting using a bagged model


Description

Returns forecasts and other information for bagged models.

Usage

## S3 method for class 'baggedModel'
forecast(
  object,
  h = ifelse(frequency(object$y) > 1, 2 * frequency(object$y), 10),
  ...
)

Arguments

object

An object of class "baggedModel" resulting from a call to baggedModel.

h

Number of periods for forecasting.

...

Other arguments, passed on to the forecast function of the original method

Details

Intervals are calculated as min and max values over the point forecasts from the models in the ensemble. I.e., the intervals are not prediction intervals, but give an indication of how different the forecasts within the ensemble are.

Value

An object of class "forecast".

The function summary is used to obtain and print a summary of the results, while the function plot produces a plot of the forecasts and prediction intervals.

An object of class "forecast" is a list containing at least the following elements:

model

A list containing information about the fitted model

method

The name of the forecasting method as a character string

mean

Point forecasts as a time series

lower

Lower limits for prediction intervals

upper

Upper limits for prediction intervals

level

The confidence values associated with the prediction intervals

x

The original time series (either object itself or the time series used to create the model stored as object).

xreg

The external regressors used in fitting (if given).

residuals

Residuals from the fitted model. That is x minus fitted values.

fitted

Fitted values (one-step forecasts)

Author(s)

Christoph Bergmeir, Fotios Petropoulos

References

Bergmeir, C., R. J. Hyndman, and J. M. Benitez (2016). Bagging Exponential Smoothing Methods using STL Decomposition and Box-Cox Transformation. International Journal of Forecasting 32, 303-312.

See Also

Examples

fit <- baggedModel(WWWusage)
fcast <- forecast(fit)
plot(fcast)

## Not run: 
fit2 <- baggedModel(WWWusage, fn="auto.arima")
fcast2 <- forecast(fit2)
plot(fcast2)
accuracy(fcast2)
## End(Not run)

forecast

Forecasting Functions for Time Series and Linear Models

v8.14
GPL-3
Authors
Rob Hyndman [aut, cre, cph] (<https://orcid.org/0000-0002-2140-5352>), George Athanasopoulos [aut], Christoph Bergmeir [aut] (<https://orcid.org/0000-0002-3665-9021>), Gabriel Caceres [aut], Leanne Chhay [aut], Mitchell O'Hara-Wild [aut] (<https://orcid.org/0000-0001-6729-7695>), Fotios Petropoulos [aut] (<https://orcid.org/0000-0003-3039-4955>), Slava Razbash [aut], Earo Wang [aut], Farah Yasmeen [aut] (<https://orcid.org/0000-0002-1479-5401>), R Core Team [ctb, cph], Ross Ihaka [ctb, cph], Daniel Reid [ctb], David Shaub [ctb], Yuan Tang [ctb] (<https://orcid.org/0000-0001-5243-233X>), Zhenyu Zhou [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.