Skip to content

Commit

Permalink
instead of manually setting disp_subclin to disp_com in scenario_sim,…
Browse files Browse the repository at this point in the history
… set argument default in scenario_sim, outbreak_model and outbreak_step
  • Loading branch information
joshwlambert committed Aug 20, 2024
1 parent 664d70e commit 5dd95c6
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
6 changes: 4 additions & 2 deletions R/outbreak_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
#' @param disp_com numeric dispersion parameter for non-isolated cases
#' (must be >0)
#' @param disp_subclin numeric dispersion parameter for sub-clincial
#' non-isolated cases (must be >0)
#' non-isolated cases (must be >0). Default of `disp_subclin` is to be equal to
#' clinical cases (`disp_com`), this unless specified dispersion for
#' sub-clinical cases will be equal to non-isolated cases.
#' @param k numeric skew parameter for sampling the serial interval from the
#' incubation period
#' @param delay_shape numeric shape parameter of delay distribution
Expand Down Expand Up @@ -70,7 +72,7 @@ outbreak_model <- function(num_initial_cases,
r0subclin = r0community,
disp_iso,
disp_com,
disp_subclin,
disp_subclin = disp_com,
k,
delay_shape,
delay_scale,
Expand Down
2 changes: 1 addition & 1 deletion R/outbreak_step.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ outbreak_step <- function(case_data,
r0subclin = r0community,
disp_iso,
disp_com,
disp_subclin,
disp_subclin = disp_com,
k,
prop_asym,
quarantine,
Expand Down
8 changes: 1 addition & 7 deletions R/scenario_sim.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,8 @@ scenario_sim <- function(n_sim,
prop_asym,
quarantine,
r0subclin = r0community,
disp_subclin = NULL) {
disp_subclin = disp_com) {




if (is.null(disp_subclin)) {
disp_subclin <- disp_com
}
# Run n_sim number of model runs and put them all together in a big data.frame
res <- purrr::map(
.x = 1:n_sim, ~ outbreak_model(
Expand Down
6 changes: 4 additions & 2 deletions man/outbreak_model.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions man/outbreak_step.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions man/scenario_sim.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5dd95c6

Please sign in to comment.