epinow | R Documentation |
This function wraps the functionality of estimate_infections()
and
forecast_infections()
in order to estimate Rt and cases by date of
infection, forecast into these infections into the future. It also contains
additional functionality to convert forecasts to date of report and produce
summary output useful for reporting results and interpreting them. See
here for
an example of using epinow
to estimate Rt for Covid-19 in a country from
the ECDC data source.
epinow(
reported_cases,
generation_time = NULL,
delays = delay_opts(),
truncation = trunc_opts(),
rt = rt_opts(),
backcalc = backcalc_opts(),
gp = gp_opts(),
obs = obs_opts(),
stan = stan_opts(),
horizon = 7,
CrIs = c(0.2, 0.5, 0.9),
filter_leading_zeros = TRUE,
zero_threshold = Inf,
return_output = FALSE,
output = c("samples", "plots", "latest", "fit", "timing"),
plot_args = list(),
target_folder = NULL,
target_date,
logs = tempdir(),
id = "epinow",
verbose = interactive()
)
A list of output from estimate_infections, forecast_infections, report_cases, and report_summary.
Sam Abbott
estimate_infections simulate_infections forecast_infections
regional_epinow
# set number of cores to use
old_opts <- options()
options(mc.cores = ifelse(interactive(), 4, 1))
# construct example distributions
generation_time <- get_generation_time(
disease = "SARS-CoV-2", source = "ganyani"
)
incubation_period <- get_incubation_period(
disease = "SARS-CoV-2", source = "lauer"
)
reporting_delay <- dist_spec(
mean = convert_to_logmean(2, 1),
mean_sd = 0.1,
sd = convert_to_logsd(2, 1),
sd_sd = 0.1,
max = 10
)
# example case data
reported_cases <- example_confirmed[1:40]
# estimate Rt and nowcast/forecast cases by date of infection
out <- epinow(
reported_cases = reported_cases,
generation_time = generation_time_opts(generation_time),
rt = rt_opts(prior = list(mean = 2, sd = 0.1)),
delays = delay_opts(incubation_period + reporting_delay)
)
# summary of the latest estimates
summary(out)
# plot estimates
plot(out)
# summary of R estimates
summary(out, type = "parameters", params = "R")
options(old_opts)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.