Produces forecasts from a trained model.

# S3 method for RW
forecast(object, new_data, specials = NULL,
  bootstrap = FALSE, times = 5000, ...)

Arguments

object

The time series model used to produce the forecasts

new_data

A tsibble containing future information used to forecast.

specials

(passed by fabletools::forecast.mdl_df()).

bootstrap

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

times

The number of sample paths to use in estimating the forecast distribution when boostrap = TRUE.

...

Additional arguments for forecast model methods.

Value

A list of forecasts.

Examples

as_tsibble(Nile) %>% model(NAIVE(value)) %>% forecast()
#> # A fable: 2 x 4 [1Y] #> # Key: .model [1] #> .model index value .distribution #> <chr> <dbl> <dbl> <dist> #> 1 NAIVE(value) 1971 740 N(740, 27998) #> 2 NAIVE(value) 1972 740 N(740, 55995)
library(tsibbledata) aus_production %>% model(snaive = SNAIVE(Beer ~ lag("year"))) %>% forecast()
#> # A fable: 8 x 4 [1Q] #> # Key: .model [1] #> .model Quarter Beer .distribution #> <chr> <qtr> <dbl> <dist> #> 1 snaive 2010 Q3 419 N(419, 373) #> 2 snaive 2010 Q4 488 N(488, 373) #> 3 snaive 2011 Q1 414 N(414, 373) #> 4 snaive 2011 Q2 374 N(374, 373) #> 5 snaive 2011 Q3 419 N(419, 747) #> 6 snaive 2011 Q4 488 N(488, 747) #> 7 snaive 2012 Q1 414 N(414, 747) #> 8 snaive 2012 Q2 374 N(374, 747)