plot method for class "fv_forecast". The type of plot
produced can be controlled using the target and type arguments with the
latter only being functional when target is set to "posterior" or
"forecast".
Usage
# S3 method for fv_forecast
plot(x, obs = NULL, target = "posterior", type = "cases", ...)Arguments
- x
A
data.tableof output as produced byforecast()of class "fv_forecast".- obs
A data frame of observed data as produced by
latest_obs().- target
A character string indicating the target object within the
forecast()to produce plots for. Current options are: posterior predictions ("posterior"), posterior forecasts ("forecast"), and the model fit ("fit"). When "posterior" or "forecast" are used thenplot.fv_posterior()is called whereas when "fit" is usedplot_pairs()is used.- type
A character string indicating the type of plot required, defaulting to "cases". Current options are: "cases" which calls
plot_cases(), "voc_frac" which callsplot_voc_frac(), "voc_advantage" which callsplot_voc_advantage(), "growth" which callsplot_growth(), "rt" which callsplot_rt(), and "all" which produces a list of all plots by callplot_posterior().- ...
Pass additional arguments to lower level plot functions.
See also
plot.fv_posterior
Functions used for forecasting across models, dates, and scenarios
forecast_across_dates(),
forecast_across_scenarios(),
forecast_n_strain(),
forecast(),
summary.fv_forecast(),
unnest_posterior()
Plotting functions
add_forecast_dates(),
plot.fv_posterior(),
plot_cases(),
plot_default(),
plot_growth(),
plot_pairs(),
plot_posterior(),
plot_rt(),
plot_theme(),
plot_voc_advantage(),
plot_voc_frac(),
save_plots()
Examples
if (FALSE) { # interactive()
options(mc.cores = 4)
forecasts <- forecast(
germany_covid19_delta_obs,
forecast_date = as.Date("2021-06-12"),
horizon = 4,
strains = c(1, 2),
adapt_delta = 0.99,
max_treedepth = 15,
variant_relationship = "scaled"
)
# inspect forecasts
forecasts
# plot case posterior predictions
plot(forecasts, log = TRUE)
# plot case posterior predictions with central estimates
plot(forecasts, log = TRUE, central = TRUE)
# plot voc posterior predictions
plot(forecasts, type = "voc_frac")
}