# \donttest{
# example 1: for offspring observations #
## reproducing the parameter estimation results in Adam, et al. (2020)
## paper doi link: https://doi.org/10.1038/s41591-020-1092-0,
## (see the first row in Supplementary Table 4),
## where R of 0.58 (95% CI: 0.45, 0.72), and k of 0.43 (95% CI: 0.29, 0.67).
data(COVID19_JanApr2020_HongKong)
set.seed(2023)
MCMC.output = paraest.MCMC(
#can.epi.para.start = list(mean = 0.60, disp = 0.50, shift = 0.20),
offspring.type = "NB", para.comb.num = 10000,
data = COVID19_JanApr2020_HongKong$obs,
obs.type.lab = 'offspring'
)
print(MCMC.output$epi.para.est.output)
## Then, plot the posterior fitting results using 100 randomly-selected MCMC samples.
hist(
COVID19_JanApr2020_HongKong$obs, breaks = c(0:100) -0.5, xlim = c(0,12),
freq = FALSE, xlab = 'secondary cases', ylab = 'rel. freq.', main = ''
)
for(jj in 1:100){
temp.random.col.index = sample.int(n = nrow(MCMC.output$est.record.mat), size = 1)
est.record.array = MCMC.output$est.record.mat[temp.random.col.index,]
lines(0:12, d_offspringdistn(
x = 0:12,
epi.para = list(
mean = est.record.array$epi.para.mean,
disp = est.record.array$epi.para.disp, shift = 0.1
),
offspring.type = "NB"
), col = '#0066FF33', type = 'l', lty = 3)
}
# example 2: for offspring observations #
## reproducing the parameter estimation results in Zhao, et al. (2020)
## paper doi link: https://doi.org/10.1371/journal.pcbi.1010281,
## (see the results of dataset #3 using Delaporte distribution in Table 1), where
## R of 0.59 (95% CI: 0.46, 0.78),
## k of 0.16 (95% CI: 0.06, 0.40), and
## shift of 0.17 (95% CI: 0.04, 0.30).
data(COVID19_JanApr2020_HongKong)
set.seed(2023)
paraest.MCMC(
can.epi.para.start = list(mean = 1, disp = 0.5, shift = 0.2),
offspring.type = "D",
data = COVID19_JanApr2020_HongKong$obs,
obs.type.lab = 'offspring'
)$epi.para.est.output
# example 3: for next-generation cluster size observations #
## reproducing the parameter estimation results in Blumberg, et al, (2014)
## paper doi link: https://doi.org/10.1371/journal.ppat.1004452,
## (see the last row in Table 3, and Fig 4A),
## where R of 3.14 (95% CI: 2, >6), and k of 0.37 (95% CI: not reported).
data(smallpox_19581973_Europe)
set.seed(2023)
paraest.MCMC(
can.epi.para.start = list(mean = 1, disp = 0.5, shift = 0.2),
offspring.type = "NB",
data = smallpox_19581973_Europe,
var.name = list(obssize = 'obs.clustersize', seedsize = 'obs.seed'),
obs.type.lab = 'nextgen'
)$epi.para.est.output
# example 4: final outbreak size observations #
## reproducing the parameter estimation results in Kucharski, Althaus. (2015)
## paper doi link: https://doi.org/10.2807/1560-7917.ES2015.20.25.21167,
## (see Fig 1, and Finding section),
## where R of 0.47 (95% CI: 0.29, 0.80), and k of 0.26 (95% CI: 0.09, 1.24).
data(MERS_2013_MEregion)
set.seed(2023)
paraest.MCMC(
can.epi.para.start = list(mean = 1, disp = 0.5, shift = 0.2),
offspring.type = "NB",
data = MERS_2013_MEregion,
var.name = list(obssize = 'obs.finalsize', seedsize = 'obs.seed'),
obs.type.lab = 'outbreak'
)$epi.para.est.output
# example 5: for more than one types of observations #
## reproducing the parameter estimation results in Blumberg, et al, (2014)
## paper doi link: https://doi.org/10.1371/journal.ppat.1004452,
## (see the last row in Table 5, and Fig 6A),
## where R of 0.3 (95% CI: 0.2, 0.5), and k of 0.4 (95% CI: not reported).
data(mpox_19801984_DRC)
set.seed(2023)
paraest.MCMC(
can.epi.para.start = list(mean = 1, disp = 0.5, shift = 0.2),
offspring.type = "NB", para.comb.num = 30000,
data = mpox_19801984_DRC,
var.name = list(obssize = 'obs.size', seedsize = 'obs.seed', typelab = 'type'),
obs.type.lab = list(offspring = 'offspring', nextgen = 'nextgen', outbreak = 'outbreak')
)$epi.para.est.output
# }
Run the code above in your browser using DataLab