Produces forecasts from a trained model.

# S3 method for VAR
forecast(
  object,
  new_data = NULL,
  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 bootstrap = TRUE.

...

Additional arguments for forecast model methods.

Value

A list of forecasts.

Examples

lung_deaths <- cbind(mdeaths, fdeaths) %>% as_tsibble(pivot_longer = FALSE) lung_deaths %>% model(VAR(vars(mdeaths, fdeaths) ~ AR(3))) %>% forecast()
#> # A fable: 24 x 5 [1M] #> # Key: .model [1] #> .model index .distribution .mean_mdeaths .mean_fdeaths #> <chr> <mth> <dist> <dbl> <dbl> #> 1 VAR(vars(mdeaths, fdeaths… 1980 Jan MVN[2] 1486. 575. #> 2 VAR(vars(mdeaths, fdeaths… 1980 Feb MVN[2] 1445. 558. #> 3 VAR(vars(mdeaths, fdeaths… 1980 Mar MVN[2] 1369. 528. #> 4 VAR(vars(mdeaths, fdeaths… 1980 Apr MVN[2] 1340. 505. #> 5 VAR(vars(mdeaths, fdeaths… 1980 May MVN[2] 1327. 497. #> 6 VAR(vars(mdeaths, fdeaths… 1980 Jun MVN[2] 1349. 505. #> 7 VAR(vars(mdeaths, fdeaths… 1980 Jul MVN[2] 1395. 522. #> 8 VAR(vars(mdeaths, fdeaths… 1980 Aug MVN[2] 1442. 540. #> 9 VAR(vars(mdeaths, fdeaths… 1980 Sep MVN[2] 1477. 554. #> 10 VAR(vars(mdeaths, fdeaths… 1980 Oct MVN[2] 1495. 561. #> # … with 14 more rows