# NOT RUN {
## load data on pandemic flu in a school in 2009
data("Flu2009")
## estimate the instantaneous reproduction number
## (method "non_parametric_si")
R_i <- estimate_R(Flu2009$incidence,
method = "non_parametric_si",
config = list(t_start = seq(2, 26),
t_end = seq(8, 32),
si_distr = Flu2009$si_distr
)
)
## visualise results
plot(R_i, legend = FALSE)
## estimate the instantaneous reproduction number
## (method "non_parametric_si")
R_c <- wallinga_teunis(Flu2009$incidence,
method = "non_parametric_si",
config = list(t_start = seq(2, 26),
t_end = seq(8, 32),
si_distr = Flu2009$si_distr
)
)
## produce plot of the incidence
## (with, on top of total incidence, the incidence of imported cases),
## estimated instantaneous and case reproduction numbers
## and serial interval distribution used
p_I <- plot(R_i, "incid", add_imported_cases=TRUE) # plots the incidence
p_SI <- plot(R_i, "SI") # plots the serial interval distribution
p_Ri <- plot(R_i, "R",
options_R = list(ylim = c(0, 4)))
# plots the estimated instantaneous reproduction number
p_Rc <- plot(R_c, "R",
options_R = list(ylim = c(0, 4)))
# plots the estimated case reproduction number
gridExtra::grid.arrange(p_I, p_SI, p_Ri, p_Rc, ncol = 2)
# }
Run the code above in your browser using DataLab