
Calculate the reproduction number from a growth rate estimate and an infectivity profile
Source:R/estimator-rt-wallinga.R
wallinga_lipsitch.Rd
This function uses a single empirical distribution for the infectivity profile / generation time. If multiple are provided then the average central value is chosen (i.e. this does not propagate uncertainty in infectivity profile)
Arguments
- r
a growth rate (may be a vector)
- y
an empirical infectivity profile either as a probability vector or as a dataframe of format: 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)
Minimally grouped by: boot (and other groupings allowed). A default value is defined.
- a1
the end time of the infectivity profile probability estimate (defaults to 0.5,1.5,2.5,...).
- a0
the start time of the infectivity profile probability estimate (defaults to 0,0.5,1.5,...).
Examples
# using a probability vector.
wallinga_lipsitch(r=seq(-0.1,0.1,length.out=9), y=stats::dgamma(1:50, 5,2))
#> [1] 0.8524904 0.8882735 0.9247920 0.9620371 1.0000000 1.0386712 1.0780412
#> [8] 1.1181002 1.1588382
# using an infectivity profile
wallinga_lipsitch(r=seq(-0.1,0.1,length.out=9), y=test_ip)
#> [1] 0.5921890 0.6783048 0.7743792 0.8812971 1.0000000 1.1314881 1.2768221
#> [8] 1.4371252 1.6135852