generate.RW: Generate new data from a fable model

View source: R/lagwalk.R

generate.RWR Documentation

Generate new data from a fable model

Description

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.

Usage

## S3 method for class 'RW'
generate(x, new_data, bootstrap = FALSE, ...)

Arguments

x

A fitted model.

new_data

A tsibble containing future information used to forecast.

bootstrap

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

...

Additional arguments for forecast model methods.

See Also

fabletools::generate.mdl_df

Examples

as_tsibble(Nile) %>%
  model(NAIVE(value)) %>%
  generate()

library(tsibbledata)
aus_production %>%
  model(snaive = SNAIVE(Beer ~ lag("year"))) %>%
  generate()

fable documentation built on Sept. 2, 2022, 1:07 a.m.