Unnest posterior estimates from a forecast data.frame
Source:R/forecast-tools.R
unnest_posterior.RdUnnest posterior predictions and forecasts from output
produced by forecast() (or multiple combined calls) dropping diagnostic
and fitting variables in the process.
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
if (FALSE) { # interactive()
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
}