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 class 'AR'
generate(x, new_data = NULL, specials = NULL, bootstrap = FALSE, ...)

Arguments

x

A fitted model.

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.

...

Other arguments passed to methods

Examples

as_tsibble(lh) %>%
  model(AR(value ~ order(3))) %>%
  generate()
#> # A tsibble: 2 x 4 [1]
#> # Key:       .model, .rep [1]
#>   .model               index .rep   .sim
#>   <chr>                <dbl> <chr> <dbl>
#> 1 AR(value ~ order(3))    49 1      2.46
#> 2 AR(value ~ order(3))    50 1      2.15