Skip to content

Commit

Permalink
Count deaths in outcomes_averted() if present
Browse files Browse the repository at this point in the history
Rm extra code
  • Loading branch information
pratikunterwegs committed Apr 29, 2024
1 parent 9743df2 commit fb4a70c
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions R/scenario_comparison.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,14 @@ outcomes_averted <- function(baseline,
# NOTE: make copy of data.table as assignment by reference will modify
# original data.table
baseline_outcomes <- data.table::copy(baseline)
baseline_outcomes[, "outcome" := lapply(
baseline_outcomes$data, epidemic_size,
simplify = FALSE, by_group = by_group
)]
# suppressed as most models do not track deaths
suppressWarnings(
baseline_outcomes[, "outcome" := lapply(
baseline_outcomes$data, epidemic_size,
simplify = FALSE, by_group = by_group, include_deaths = TRUE
)]
)

baseline_outcomes <- baseline_outcomes[, unlist(outcome, recursive = FALSE),
by = c("scenario", "param_set"),
]
Expand All @@ -197,10 +201,12 @@ outcomes_averted <- function(baseline,
# get epidemic sizes for response scenarios; some code repetition here
# NOTE: work with a copy
scenario_outcomes <- data.table::copy(scenarios)
scenario_outcomes[, "outcome" := lapply(
scenario_outcomes$data, epidemic_size,
simplify = FALSE, by_group = by_group
)]
suppressWarnings(
scenario_outcomes[, "outcome" := lapply(
scenario_outcomes$data, epidemic_size,
simplify = FALSE, by_group = by_group, include_deaths = TRUE
)]
)

scenario_outcomes <- scenario_outcomes[, unlist(outcome, recursive = FALSE),
by = c("scenario", "param_set")
Expand Down

0 comments on commit fb4a70c

Please sign in to comment.