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 'model_mean'
generate(x, new_data, bootstrap = FALSE, ...)

Arguments

x

A fitted model.

new_data

A tsibble containing the time points and exogenous regressors to produce forecasts for.

bootstrap

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

...

Other arguments passed to methods

Examples

library(tsibbledata)
vic_elec %>%
  model(avg = MEAN(Demand)) %>%
  generate()
#> # A tsibble: 4 x 4 [30m] <Australia/Melbourne>
#> # Key:       .model, .rep [1]
#>   .model Time                .rep   .sim
#>   <chr>  <dttm>              <chr> <dbl>
#> 1 avg    2015-01-01 00:00:00 1     4397.
#> 2 avg    2015-01-01 00:30:00 1     4478.
#> 3 avg    2015-01-01 01:00:00 1     4591.
#> 4 avg    2015-01-01 01:30:00 1     4514.