Simulates future paths from a dataset using a fitted model. Innovations are sampled by the model's assumed error distribution. If bootstrap is TRUE, innovations will be sampled from the model's residuals. If new_data contains the .innov column, those values will be treated as innovations.

# S3 method for TSLM
generate(x, new_data, specials, bootstrap = FALSE, ...)

Arguments

x

A fitted model.

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.

...

Additional arguments for forecast model methods.

See also

Examples

as_tsibble(USAccDeaths) %>% model(lm = TSLM(log(value) ~ trend() + season())) %>% generate()
#> # A tsibble: 24 x 3 [1M] #> # Key: .model [1] #> .model index .sim #> <chr> <mth> <dbl> #> 1 lm 1979 Jan 7608. #> 2 lm 1979 Feb 6856. #> 3 lm 1979 Mar 7650. #> 4 lm 1979 Apr 7832. #> 5 lm 1979 May 8562. #> 6 lm 1979 Jun 9106. #> 7 lm 1979 Jul 9912. #> 8 lm 1979 Aug 9198. #> 9 lm 1979 Sep 8138. #> 10 lm 1979 Oct 8520. #> # … with 14 more rows