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 4 [1M] #> # Key: .model, .rep [1] #> .model .rep index .sim #> <chr> <int> <mth> <dbl> #> 1 lm 1 1979 Jan 7619. #> 2 lm 1 1979 Feb 6889. #> 3 lm 1 1979 Mar 7688. #> 4 lm 1 1979 Apr 7777. #> 5 lm 1 1979 May 8675. #> 6 lm 1 1979 Jun 9043. #> 7 lm 1 1979 Jul 10005. #> 8 lm 1 1979 Aug 9283. #> 9 lm 1 1979 Sep 8165. #> 10 lm 1 1979 Oct 8469. #> # … with 14 more rows