## Please see the "Usage" section.
## the following returns the proportion of index cases that generated at least 1 offspring cases.
p_offspringdistn(
q = 0,
epi.para = list(mean = 1, disp = 0.5, shift = 0.2),
offspring.type = 'D', lower.tail = FALSE
)
## reproducing the results in Adam, et al. (2020)
## paper doi link: https://doi.org/10.1038/s41591-020-1092-0 (see Fig 3b),
## where the number of offspring cases were fitted
## with parameter R of 0.58 and k of 0.43 under NB distribution.
data(COVID19_JanApr2020_HongKong)
hist(
COVID19_JanApr2020_HongKong$obs, breaks = c(0:100) -0.5, xlim = c(0,12),
freq = FALSE, xlab = 'secondary cases', ylab = 'rel. freq.', main = ''
)
lines(0:12, d_offspringdistn(
x = 0:12,
epi.para = list(mean = 0.58, disp = 0.43, shift = 0.2),
offspring.type = "NB"
), pch = 20, type = 'o', lty = 2)
## an example to generate 100 rv of offspring case number
table(r_offspringdistn(
n = 100,
epi.para = list(mean = 1, disp = 0.5, shift = 0.2),
offspring.type = 'D'
))
Run the code above in your browser using DataLab