Description Usage Arguments Value Author(s) See Also Examples
View source: R/estimate_R_plots.R
This wrapper has been created so that several estimate_R
objects can
be plotted at the same time.
1 |
... |
Arguments of
|
legend |
A boolean (TRUE by default) governing the presence / absence of legends on the plots |
a plot (if what = "incid"
, "R"
, or "SI"
) or a
grob
object (if what = "all"
).
Anne Cori, Zhian Kamvar
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | ## load data on pandemic flu in a school in 2009
data("Flu2009")
#### COMPARE THE INSTANTANEOUS AND CASE REPRODUCTION NUMBERS ####
## estimate the instantaneous reproduction number
## (method "non_parametric_si")
R_instantaneous <- 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
)
)
## estimate the case reproduction number
R_case <- 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
)
)
## visualise R estimates on the same plot
estimate_R_plots(list(R_instantaneous, R_case), what = "R",
options_R = list(col = c("blue", "red")), legend = TRUE)
#### COMPARE THE INSTANTANEOUS R ON SLIDING WEEKLY OR BIWEEKLY WINDOWS ####
R_weekly <- estimate_R(Flu2009$incidence,
method = "non_parametric_si",
config = list(t_start = seq(9, 26),
t_end = seq(15, 32),
si_distr = Flu2009$si_distr
)
)
R_biweekly <- estimate_R(Flu2009$incidence,
method = "non_parametric_si",
config = list(t_start = seq(2, 19),
t_end = seq(15, 32),
si_distr = Flu2009$si_distr
)
)
## visualise R estimates on the same plot
estimate_R_plots(list(R_weekly, R_biweekly), what = "R",
options_R = list(col = c("blue", "red")), legend = TRUE)
|
Warning message:
In wallinga_teunis(Flu2009$incidence, method = "non_parametric_si", :
setting config$n_sim to 10 as config$n_sim was not specified.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.