Produces forecasts from a trained model.
# S3 method for class 'RW'
forecast(
object,
new_data,
specials = NULL,
simulate = FALSE,
bootstrap = FALSE,
times = 5000,
...
)
A model for which forecasts are required.
A tsibble containing the time points and exogenous regressors to produce forecasts for.
(passed by fabletools::forecast.mdl_df()
).
If TRUE
, prediction intervals are produced by simulation rather than using analytic formulae.
If TRUE
, then forecast distributions are computed using simulation with resampled errors.
The number of sample paths to use in estimating the forecast distribution when bootstrap = TRUE
.
Other arguments passed to methods
A list of forecasts.
as_tsibble(Nile) %>%
model(NAIVE(value)) %>%
forecast()
#> # A fable: 2 x 4 [1Y]
#> # Key: .model [1]
#> .model index value
#> <chr> <dbl> <dist>
#> 1 NAIVE… 1971 N(740, 27998)
#> 2 NAIVE… 1972 N(740, 55995)
#> # ℹ 1 more variable: .mean <dbl>
library(tsibbledata)
aus_production %>%
model(snaive = SNAIVE(Beer ~ lag("year"))) %>%
forecast()
#> # A fable: 8 x 4 [1Q]
#> # Key: .model [1]
#> .model Quarter
#> <chr> <qtr>
#> 1 snaive 2010 Q3
#> 2 snaive 2010 Q4
#> 3 snaive 2011 Q1
#> 4 snaive 2011 Q2
#> 5 snaive 2011 Q3
#> 6 snaive 2011 Q4
#> 7 snaive 2012 Q1
#> 8 snaive 2012 Q2
#> # ℹ 2 more variables: Beer <dist>, .mean <dbl>