proportion_allowed_by_condition.Rd
Proportion of samples per scenario allowed by condition
proportion_allowed_by_condition( sims, samples = NULL, group_var = c("scenario", "event_duration", "event_size", "serial_mean", "upper_R0", "lower_R0") )
sims | A data.table from |
---|---|
samples | Numeric, the number of samples that were used. |
group_var | Character vector, the grouping variables to use to split scenarios. |
A data.table listing the proportion allowed by scenario
## Example sims <- data.table::data.table(sample = 1:10, event_duration = 1, event_size = 1:10) proportion_allowed_by_condition(sims, samples = 100, group_var = c("event_duration"))#> event_duration allowed_per #> 1: 1 0.1## Code proportion_allowed_by_condition#> function (sims, samples = NULL, group_var = c("scenario", "event_duration", #> "event_size", "serial_mean", "upper_R0", "lower_R0")) #> { #> . <- NULL #> allowed_per <- NULL #> out <- sims[, .(allowed_per = .N/samples), by = group_var] #> return(out) #> } #> <bytecode: 0x55a6b0ec9cd0> #> <environment: namespace:WuhanSeedingVsTransmission>