Produces new data with the same structure by resampling the residuals using a block bootstrap procedure. This method can only generate within sample, and any generated data out of the trained sample will produce NA simulations.

# S3 method for class 'stl_decomposition'
generate(x, new_data, specials = NULL, ...)

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()).

...

Other arguments passed to methods

References

Bergmeir, C., R. J. Hyndman, and J. M. Benitez (2016). Bagging Exponential Smoothing Methods using STL Decomposition and Box-Cox Transformation. International Journal of Forecasting 32, 303-312.

Examples

as_tsibble(USAccDeaths) %>%
  model(STL(log(value))) %>%
  generate(as_tsibble(USAccDeaths), times = 3)
#> # A tsibble: 216 x 5 [1M]
#> # Key:       .model, .rep [3]
#>    .model          .rep     index value   .sim
#>    <chr>           <chr>    <mth> <dbl>  <dbl>
#>  1 STL(log(value)) 1     1973 Jan  9007  9250.
#>  2 STL(log(value)) 1     1973 Feb  8106  8585.
#>  3 STL(log(value)) 1     1973 Mar  8928  9401.
#>  4 STL(log(value)) 1     1973 Apr  9137  9426.
#>  5 STL(log(value)) 1     1973 May 10017  9950.
#>  6 STL(log(value)) 1     1973 Jun 10826 10023.
#>  7 STL(log(value)) 1     1973 Jul 11317 10720.
#>  8 STL(log(value)) 1     1973 Aug 10744 10441.
#>  9 STL(log(value)) 1     1973 Sep  9713  9466.
#> 10 STL(log(value)) 1     1973 Oct  9938  9148.
#> # ℹ 206 more rows