-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
library("EpiNow2") | ||
library("here") | ||
|
||
# get example case counts | ||
reported_cases <- example_confirmed[1:60] | ||
|
||
# set up example generation time | ||
generation_time <- get_generation_time( | ||
disease = "SARS-CoV-2", source = "ganyani", fixed = TRUE | ||
) | ||
# set delays between infection and case report | ||
incubation_period <- get_incubation_period( | ||
disease = "SARS-CoV-2", source = "lauer", fixed = TRUE | ||
) | ||
# delays between infection and case report, with uncertainty | ||
incubation_period_uncertain <- get_incubation_period( | ||
disease = "SARS-CoV-2", source = "lauer" | ||
) | ||
reporting_delay <- dist_spec( | ||
mean = convert_to_logmean(2, 1), mean_sd = 0, | ||
sd = convert_to_logsd(2, 1), sd_sd = 0, max = 10 | ||
) | ||
|
||
# default settings but assuming that delays are fixed rather than uncertain | ||
example_estimate_infections <- estimate_infections(reported_cases, | ||
generation_time = generation_time_opts(generation_time), | ||
delays = delay_opts(incubation_period + reporting_delay), | ||
rt = rt_opts(prior = list(mean = 2, sd = 0.1)), | ||
stan = stan_opts(samples = 200, control = list(adapt_delta = 0.95)) | ||
) | ||
|
||
cases <- example_confirmed[1:60] | ||
cases <- data.table::rbindlist(list( | ||
data.table::copy(cases)[, region := "testland"], | ||
cases[, region := "realland"] | ||
)) | ||
|
||
example_regional_epinow <- regional_epinow( | ||
reported_cases = cases, | ||
generation_time = generation_time_opts(generation_time), | ||
delays = delay_opts(incubation_period + reporting_delay), | ||
rt = rt_opts(prior = list(mean = 2, sd = 0.2)), | ||
stan = stan_opts( samples = 200, control = list(adapt_delta = 0.95)) | ||
) | ||
|
||
usethis::use_data(example_estimate_infections, overwrite = TRUE) | ||
usethis::use_data(example_regional_epinow, overwrite = TRUE) |
Binary file not shown.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.