Learn R Programming

fable (version 0.4.0)

forecast.TSLM: Forecast a model from the fable package

Description

Produces forecasts from a trained model.

Usage

# S3 method for TSLM
forecast(
  object,
  new_data,
  specials = NULL,
  bootstrap = FALSE,
  approx_normal = TRUE,
  times = 5000,
  ...
)

Value

A list of forecasts.

Arguments

object

A model for which forecasts are required.

new_data

A tsibble containing the time points and exogenous regressors to produce forecasts for.

specials

(passed by fabletools::forecast.mdl_df()).

bootstrap

If TRUE, then forecast distributions are computed using simulation with resampled errors.

approx_normal

Should the resulting forecast distributions be approximated as a Normal distribution instead of a Student's T distribution. Returning Normal distributions (the default) is a useful approximation to make it easier for using TSLM models in model combinations or reconciliation processes.

times

The number of sample paths to use in estimating the forecast distribution when bootstrap = TRUE.

...

Other arguments passed to methods

Examples

Run this code
as_tsibble(USAccDeaths) %>%
  model(lm = TSLM(log(value) ~ trend() + season())) %>%
  forecast()

Run the code above in your browser using DataLab