Produces forecasts from a trained model.

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

Arguments

object

The time series model used to produce the forecasts

new_data

A tsibble containing future information used to forecast.

specials

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

bootstrap

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

times

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

...

Additional arguments for forecast model methods.

Value

A list of forecasts.

Examples

as_tsibble(USAccDeaths) %>% model(lm = TSLM(log(value) ~ trend() + season())) %>% forecast()
#> # A fable: 24 x 4 [1M] #> # Key: .model [1] #> .model index value .mean #> <chr> <mth> <dist> <dbl> #> 1 lm 1979 Jan t(N(8.9, 0.003)) 7620. #> 2 lm 1979 Feb t(N(8.8, 0.003)) 6899. #> 3 lm 1979 Mar t(N(8.9, 0.003)) 7639. #> 4 lm 1979 Apr t(N(9, 0.003)) 7841. #> 5 lm 1979 May t(N(9.1, 0.003)) 8645. #> 6 lm 1979 Jun t(N(9.1, 0.003)) 9087. #> 7 lm 1979 Jul t(N(9.2, 0.003)) 9908. #> 8 lm 1979 Aug t(N(9.1, 0.003)) 9237. #> 9 lm 1979 Sep t(N(9, 0.003)) 8237. #> 10 lm 1979 Oct t(N(9, 0.003)) 8516. #> # … with 14 more rows