This is used for random sampling from the infectivity profile for times to infection, for example. There is nothing to stop you putting in a delay distribution with negative times but strange things may happen in your simulation.
Arguments
- ip
a long format empirical distribution
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.
Examples
tmp = cfg_ip_sampler_rng(ganyani_ip_2)(10000)
# This discretised ganyani distribution is based on these figures:
# mean: 5.2 (3.78-6.78) and sd: 1.72 (0.91-3.93)
format_ip(ganyani_ip_2)
#> [1] "PDF: mean: 5.12 [4.02 — 6.76]; sd: 1.91 [1.01 — 3.26]; 100 bootstraps"
mean(tmp) # Should be about 5.2
#> [1] 5.184698
stats::sd(tmp) # Should be about 1.72
#> [1] 2.164821