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 ETS
generate(x, new_data, specials, bootstrap = FALSE, ...)
A fitted model.
A tsibble containing the time points and exogenous regressors to produce forecasts for.
(passed by fabletools::forecast.mdl_df()
).
If TRUE
, then forecast distributions are computed using simulation with resampled errors.
Other arguments passed to methods
as_tsibble(USAccDeaths) %>%
model(ETS(log(value) ~ season("A"))) %>%
generate(times = 100)
#> # A tsibble: 2,400 x 4 [1M]
#> # Key: .model, .rep [100]
#> .model .rep index .sim
#> <chr> <chr> <mth> <dbl>
#> 1 "ETS(log(value) ~ season(\"A\"))" 1 1979 Jan 8540.
#> 2 "ETS(log(value) ~ season(\"A\"))" 1 1979 Feb 7699.
#> 3 "ETS(log(value) ~ season(\"A\"))" 1 1979 Mar 8701.
#> 4 "ETS(log(value) ~ season(\"A\"))" 1 1979 Apr 8844.
#> 5 "ETS(log(value) ~ season(\"A\"))" 1 1979 May 10054.
#> 6 "ETS(log(value) ~ season(\"A\"))" 1 1979 Jun 10151.
#> 7 "ETS(log(value) ~ season(\"A\"))" 1 1979 Jul 10225.
#> 8 "ETS(log(value) ~ season(\"A\"))" 1 1979 Aug 10220.
#> 9 "ETS(log(value) ~ season(\"A\"))" 1 1979 Sep 8826.
#> 10 "ETS(log(value) ~ season(\"A\"))" 1 1979 Oct 8670.
#> # ℹ 2,390 more rows