Forecast for a single model and summarise
Usage
forecast_n_strain(
data,
model = NULL,
inits = forecast.vocs::fv_inits,
fit = forecast.vocs::fv_sample,
posterior = forecast.vocs::fv_tidy_posterior,
extract_forecast = forecast.vocs::fv_extract_forecast,
strains = 2,
voc_label = "VOC",
probs = c(0.05, 0.2, 0.8, 0.95),
digits = 3,
scale_r = 1,
timespan = 7,
...
)
Arguments
- data
A list of data as produced by
fv_as_data_list()
.- model
A
cmdstanr
model object as loaded byfv_model()
.- inits
A function that returns a function to samples initial conditions with the same arguments as
fv_inits()
. If not supplied the package defaultfv_inits()
is used.- fit
A function that fits the supplied model with the same arguments and return values as
fv_sample()
. If not supplied the package defaultfv_sample()
is used which performs MCMC sampling using cmdstanr.- posterior
A function that summarises the output from the supplied fitting function with the same arguments and return values (depending on the requirement for downstream package functionality to function) as
fv_tidy_posterior()
. If not supplied the package defaultfv_tidy_posterior()
is used.- extract_forecast
A function that extracts the forecast from the summarised
posterior
. If not supplied the package defaultfv_extract_forecast()
is used.- strains
Integer number of strains. Defaults to 2. Current maximum is 2.
- voc_label
A character string, default to "VOC". Defines the label to assign to variant of concern specific parameters. Example usage is to rename parameters to use variant specific terminology.
- probs
A vector of numeric probabilities to produce quantile summaries for. By default these are the 5%, 20%, 80%, and 95% quantiles which are also the minimum set required for plotting functions to work (such as
plot_cases()
,plot_rt()
, andplot_voc_frac()
).- digits
Numeric, defaults to 3. Number of digits to round summary statistics to.
- scale_r
Numeric, defaults to 1. Rescale the timespan over which the growth rate and reproduction number is calculated. An example use case is rescaling the growth rate from weekly to be scaled by the mean of the generation time (for COVID-19 for example this would be 5.5 / 7.
- timespan
Integer, defaults to 7. Indicates the number of days between each observation. Defaults to a week.
- ...
Additional parameters passed to
fv_sample()
.
See also
Functions used for forecasting across models, dates, and scenarios
forecast_across_dates()
,
forecast_across_scenarios()
,
forecast()
,
plot.fv_forecast()
,
summary.fv_forecast()
,
unnest_posterior()