forecast_secondary {EpiNow2} | R Documentation |
Forecast Secondary Observations Given a Fit from estimate_secondary
Description
This function forecasts secondary observations using the output of
estimate_secondary()
and either observed primary data or a forecast of
primary observations. See the examples of estimate_secondary()
for one use case. It can also be combined with estimate_infections()
t
produce a forecast for a secondary observation from a forecast of a primary
observation. See the examples of estimate_secondary()
for
example use cases on synthetic data. See
here
for an example of forecasting Covid-19 deaths from Covid-19 cases.
Usage
forecast_secondary(
estimate,
primary,
primary_variable = "reported_cases",
model = NULL,
samples = NULL,
all_dates = FALSE,
CrIs = c(0.2, 0.5, 0.9)
)
Arguments
estimate |
An object of class "estimate_secondary" as produced by
|
primary |
A data.frame containing at least |
primary_variable |
A character string indicating the primary variable, defaulting to "reported_cases". Only used when primary is of class "estimate_infections". |
model |
A compiled stan model as returned by |
samples |
Numeric, number of posterior samples to simulate from. The
default is to use all samples in the |
all_dates |
Logical, defaults to FALSE. Should a forecast for all dates and not just those in the forecast horizon be returned. |
CrIs |
Numeric vector of credible intervals to calculate. |
Value
A list containing: predictions
(a data frame ordered by date with
the primary, and secondary observations, and a summary of the forecast
secondary observations. For primary observations in the forecast horizon
when uncertainty is present the median is used), samples
a data frame of
forecast secondary observation posterior samples, and forecast
a summary
of the forecast secondary observation posterior.
Author(s)
Sam Abbott
See Also
estimate_secondary