Calculate a reproduction number estimate from modelled incidence using the
methods described in the vignette "Estimating the reproduction number from
modelled incidence" and using a set of empirical generation time
distributions. This assumes that modelled incidence has the same time unit as
the ip
distribution, and that this is daily, if this is not the case then
rescale_model()
may be able to fix it.
Arguments
- df
modelled incidence estimate
A dataframe containing the following columns:
time (ggoutbreak::time_period + group_unique) - A (usually complete) set of singular observations per unit time as a `time_period`
incidence.fit (double) - an estimate of the incidence rate on a log scale
incidence.se.fit (positive_double) - the standard error of the incidence rate estimate on a log scale
incidence.0.025 (positive_double) - lower confidence limit of the incidence rate (true scale)
incidence.0.5 (positive_double) - median estimate of the incidence rate (true scale)
incidence.0.975 (positive_double) - upper confidence limit of the incidence rate (true scale)
Any grouping allowed.
- ip
an infectivity profile (aka generation time distribution)
A dataframe containing the following columns:
boot (anything + default(1)) - a bootstrap identifier
probability (proportion) - the probability of new event during this period.
tau (integer + complete) - the days since the index event.
Must be grouped by: boot (exactly).
A default value is defined.
- approx
use a faster, but approximate, estimate of quantiles
Value
A dataframe containing the following columns:
time (ggoutbreak::time_period + group_unique) - A (usually complete) set of singular observations per unit time as a
time_period
rt.fit (double) - an estimate of the reproduction number
rt.se.fit (positive_double) - the standard error of the reproduction number
rt.0.025 (double) - lower confidence limit of the reproduction number
rt.0.5 (double) - median estimate of the reproduction number
rt.0.975 (double) - upper confidence limit of the reproduction number
Any grouping allowed.
Examples
df = ggoutbreak::england_covid %>%
dplyr::filter(date < "2021-01-01") %>%
time_aggregate(count=sum(count)) %>%
poisson_locfit_model()
if (interactive()) {
# not run
withr::with_options(list("ggoutbreak.keep_cdf"=TRUE),{
tmp3 = df %>% rt_from_incidence(ganyani_ip)
})
}
tmp = df %>% rt_from_incidence(du_serial_interval_ip)