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 boostrap = 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(log(mdeaths), fdeaths) ~ AR(3))) %>% forecast()
#> # A fable: 24 x 5 [1M] #> # Key: .model [1] #> .model index mdeaths fdeaths .distribution #> <chr> <mth> <dbl> <dbl> <dist> #> 1 VAR(vars(log(mdeaths), fdeaths) ~ AR(… 1980 Jan 1490. 602. t(MVN[2]) #> 2 VAR(vars(log(mdeaths), fdeaths) ~ AR(… 1980 Feb 1496. 582. t(MVN[2]) #> 3 VAR(vars(log(mdeaths), fdeaths) ~ AR(… 1980 Mar 1500. 575. t(MVN[2]) #> 4 VAR(vars(log(mdeaths), fdeaths) ~ AR(… 1980 Apr 1475. 555. t(MVN[2]) #> 5 VAR(vars(log(mdeaths), fdeaths) ~ AR(… 1980 May 1452. 543. t(MVN[2]) #> 6 VAR(vars(log(mdeaths), fdeaths) ~ AR(… 1980 Jun 1443. 538. t(MVN[2]) #> 7 VAR(vars(log(mdeaths), fdeaths) ~ AR(… 1980 Jul 1448. 539. t(MVN[2]) #> 8 VAR(vars(log(mdeaths), fdeaths) ~ AR(… 1980 Aug 1462. 545. t(MVN[2]) #> 9 VAR(vars(log(mdeaths), fdeaths) ~ AR(… 1980 Sep 1477. 552. t(MVN[2]) #> 10 VAR(vars(log(mdeaths), fdeaths) ~ AR(… 1980 Oct 1490. 557. t(MVN[2]) #> # … with 14 more rows