Produces a reproducible synthetic cohort, one row per casualty, with the
fields expected by sdt_scenario(). Marginals default to the published
reference distributions returned by sdt_reference(), and can be
overridden.
Usage
sdt_synthetic_cohort(
n = 20L,
triage_prob = NULL,
seed = NULL,
backend = c("base", "simstudy")
)Arguments
- n
Number of casualties to generate (positive whole number).
- triage_prob
Named numeric vector of sighting-category probabilities. Defaults to the published triage mix. Need not sum to 1; it is normalised.
- seed
Optional integer seed. Applied with
withr::local_seed(), so the caller's random stream is restored on exit.- backend
Either
"base"(always available, frozen behaviour) or"simstudy", which draws correlated age, injury severity and life points through a simstudy definition table. If simstudy is not installed,"simstudy"warns and falls back to"base".
Value
A cohort object (a tibble::tibble() subclass) with columns id,
age, sex, life_points, ventilated, injury_region, triage,
therapy, arrival_order. The "simstudy" backend additionally carries
iss, an injury-severity proxy.
See also
sdt_synthesise() to synthesise from a real seed cohort instead.
Examples
sdt_synthetic_cohort(n = 10, seed = 42)
#> # A cohort: 10 casualties
#> # Triage: red: 2 yellow: 3 green: 5
#> id age sex life_points ventilated injury_region triage therapy
#> <chr> <int> <chr> <int> <lgl> <chr> <chr> <chr>
#> 1 P001 52 m 3 FALSE thorax yellow none
#> 2 P002 38 m 4 FALSE thorax yellow TASC
#> 3 P003 2 m 1 FALSE thorax red DCS
#> 4 P004 5 f 4 FALSE multiple yellow none
#> 5 P005 62 m 5 FALSE head green none
#> 6 P006 37 f 5 FALSE head green none
#> 7 P007 15 f 6 FALSE extremity green none
#> 8 P008 39 m 2 FALSE multiple red DCS
#> 9 P009 60 m 6 FALSE thorax green none
#> 10 P010 70 m 6 FALSE head green TASC
#> # ℹ 1 more variable: arrival_order <int>
# Override the mix to stress the red pathway.
sdt_synthetic_cohort(
n = 10, triage_prob = c(red = 0.8, yellow = 0.2), seed = 1
)
#> # A cohort: 10 casualties
#> # Triage: red: 7 yellow: 3 green: 0
#> id age sex life_points ventilated injury_region triage therapy
#> <chr> <int> <chr> <int> <lgl> <chr> <chr> <chr>
#> 1 P001 41 m 1 FALSE head red DCS
#> 2 P002 42 f 1 TRUE abdomen red TASC
#> 3 P003 56 m 1 TRUE abdomen red TASC
#> 4 P004 54 m 3 FALSE extremity yellow TASC
#> 5 P005 51 m 1 FALSE abdomen red TASC
#> 6 P006 56 m 4 FALSE head yellow TASC
#> 7 P007 54 m 4 FALSE extremity yellow TASC
#> 8 P008 43 m 2 FALSE multiple red TASC
#> 9 P009 12 f 2 TRUE head red DCS
#> 10 P010 51 m 1 FALSE head red TASC
#> # ℹ 1 more variable: arrival_order <int>