unnest_posterior: Unnest posterior estimates from a forecast data.frame

View source: R/forecast-tools.R

unnest_posteriorR Documentation

Unnest posterior estimates from a forecast data.frame

Description

Unnest posterior predictions and forecasts from output produced by forecast() (or multiple combined calls) dropping diagnostic and fitting variables in the process.

Usage

unnest_posterior(forecasts, target = "posterior")

Arguments

forecasts

A data frame of forecasts as produced by forecast().

target

A character string indicating the list of outputs to unnest.

Value

An unnested data.frame of posterior estimates and other variables produced by forecast().

See Also

Functions used for forecasting across models, dates, and scenarios forecast_across_dates(), forecast_across_scenarios(), forecast_n_strain(), forecast(), plot.fv_forecast(), summary.fv_forecast()

Examples


library(data.table)
options(mc.cores = 4)
dt <- forecast(
  germany_covid19_delta_obs,
  forecast_date = as.Date("2021-06-12"),
  max_treedepth = 15, adapt_delta = 0.99
)

# unnest posterior predictions
posterior <- unnest_posterior(dt)
posterior

# unnest forecasts
forecasts <- unnest_posterior(dt, target = "forecast")
forecasts


epiforecasts/forecast.vocs documentation built on May 14, 2023, 2 p.m.