
Wallinga-Lipsitch reproduction number from growth rates
Source:R/estimator-rt-wallinga.R
rt_from_growth_rate.Rd
Calculate a reproduction number estimate from growth rate using the Wallinga 2007 estimation using empirical generation time distribution. This uses resampling to transmit uncertainty in growth rate estimates. This also handles time-series that are not on a daily cadence (although this is experimental). The reproduction number estimate is neither a instantaneous (backward looking) nor case (forward looking) reproduction number but somewhere between the two.
Usage
rt_from_growth_rate(
df = i_growth_rate,
ip = i_empirical_ip,
bootstraps = 1000,
seed = Sys.time()
)
Arguments
- df
Growth rate estimates
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`
growth.fit (double) - an estimate of the growth rate
growth.se.fit (positive_double) - the standard error the growth rate
growth.0.025 (double) - lower confidence limit of the growth rate
growth.0.5 (double) - median estimate of the growth rate
growth.0.975 (double) - upper confidence limit of the growth rate
Any grouping allowed.
- ip
Infectivity profile
A dataframe containing the following columns:
boot (anything + default(1)) - a bootstrap identifier
probability (proportion) - the probability of new event during this period.
a0 (double) - the beginning of the time period (in days)
a1 (double) - the end of the time period (in days)
Must be grouped by: boot (exactly).
A default value is defined.
- bootstraps
the number of bootstraps to take to calculate for each point.
- seed
a random number generator seed
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
tmp = ggoutbreak::england_covid %>%
time_aggregate(count=sum(count))
if (interactive()) {
# not run
withr::with_options(list("ggoutbreak.keep_cdf"=TRUE),{
tmp2 = tmp %>%
poisson_locfit_model() %>%
rt_from_growth_rate()
})
}