## an example to generate 1000 rv of final outbreak size
table(r_outbreakdistn(
n = 1000,
seed.size = 1,
epi.para = list(mean = 1, disp = 0.5, shift = 0.2),
offspring.type = "D",
upr.limit = 10
))
# \donttest{
## an attempt to reproduce the results in Guo, et al. (2022)
## paper doi link: https://doi.org/10.1016/j.jinf.2022.05.041 (see Fig 1B),
## where the probability of one seed case generating an outbreak with final size >= a given number,
## with parameter R of 0.78 and k of 0.10 under NB distribution.
plot(1:100, 1 - c(0,cumsum(d_outbreakdistn(
x = 1:99,
seed.size = 1,
epi.para = list(mean = 0.78, disp = 0.10, shift = 0.2),
offspring.type = "NB",
))), log = 'y', type = 'l', xlab = 'outbreak size', ylab = 'probability')
plot(1:100, c(1,p_outbreakdistn(
q = 1:99,
seed.size = 1,
epi.para = list(mean = 0.78, disp = 0.10, shift = 0.2),
offspring.type = "NB",
lower.tail = FALSE
)), log = 'y', type = 'l', xlab = 'outbreak size', ylab = 'probability')
# }
Run the code above in your browser using DataLab