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 boostrap = 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 .distribution #> <chr> <mth> <dbl> <dist> #> 1 lm 1979 Jan 7620. t(N(8.9, 0.003)) #> 2 lm 1979 Feb 6899. t(N(8.8, 0.003)) #> 3 lm 1979 Mar 7639. t(N(8.9, 0.003)) #> 4 lm 1979 Apr 7841. t(N(9.0, 0.003)) #> 5 lm 1979 May 8645. t(N(9.1, 0.003)) #> 6 lm 1979 Jun 9087. t(N(9.1, 0.003)) #> 7 lm 1979 Jul 9908. t(N(9.2, 0.003)) #> 8 lm 1979 Aug 9237. t(N(9.1, 0.003)) #> 9 lm 1979 Sep 8237. t(N(9.0, 0.003)) #> 10 lm 1979 Oct 8516. t(N(9.0, 0.003)) #> # … with 14 more rows