Turn a discrete-event game run into a (group, card) behaviour frame
Source:R/fidelity.R
sdt_run_behaviour.RdReshapes the event log of a sdt_simulate() run into the same one-row-per
(group, card) frame that sdt_fidelity() scores, so the discrete-event
engine can be held to exactly the same statistics as a fitted behaviour
model. Each replication is one group and each casualty id is one card,
which is what makes the comparison legitimate: groups within a real course
session play the same fixed deck, and so do replications.
Arguments
- run
A
game_runfromsdt_simulate().- group
Name for the group column in the result.
- card
Name for the card column in the result.
Value
A tibble with one row per (replication,
casualty), the two key columns named by group and card, the cohort's
triage and therapy, the casualty's end_area, and one logical column
per behaviour described above.
What each column means, and what it cannot mean
red,yellow,green,ETC,DCS,TASCandventilatedare read off the cohort. The engine routes on them, it does not choose them, so they are identical in every replication and their between-group SD is exactly zero. That is not a bug in this function; it is the engine's structure made visible, andsdt_fidelity()will report it as an infinite dispersion ratio.surgery,diagnostics,icu,ward,recovery,green_arearecord whether the casualty ever entered that board area. These can vary between replications, through queueing and the horizon.diedisend_area == "morgue", andnot_seenis a casualty the game ended before. The engine has no branch to the morgue, sodiedis alwaysFALSE.
The observed counterparts, for a course export, are therapy == "TASC"
and so on for the therapy concepts, called_triage == "red" for the
sighting categories, therapy != "none" for surgery, and the reported
end location for icu. There is deliberately no eFAST or CT column:
the engine has a single radiology area and no modality, so inventing one
would be inventing a comparison.
Examples
co <- sdt_synthetic_cohort(n = 12, seed = 1)
run <- sdt_simulate(sdt_scenario(co), replications = 3, seed = 1,
verbose = FALSE)
sdt_run_behaviour(run)
#> # A tibble: 36 × 20
#> group_id card triage therapy ventilated red yellow green ETC DCS TASC
#> <chr> <chr> <chr> <chr> <lgl> <lgl> <lgl> <lgl> <lgl> <lgl> <lgl>
#> 1 rep001 P001 red TASC TRUE TRUE FALSE FALSE FALSE FALSE TRUE
#> 2 rep001 P002 red TASC TRUE TRUE FALSE FALSE FALSE FALSE TRUE
#> 3 rep001 P003 green none FALSE FALSE FALSE TRUE FALSE FALSE FALSE
#> 4 rep001 P004 yellow TASC FALSE FALSE TRUE FALSE FALSE FALSE TRUE
#> 5 rep001 P005 red DCS FALSE TRUE FALSE FALSE FALSE TRUE FALSE
#> 6 rep001 P006 yellow TASC FALSE FALSE TRUE FALSE FALSE FALSE TRUE
#> 7 rep001 P007 yellow TASC FALSE FALSE TRUE FALSE FALSE FALSE TRUE
#> 8 rep001 P008 green none FALSE FALSE FALSE TRUE FALSE FALSE FALSE
#> 9 rep001 P009 green none FALSE FALSE FALSE TRUE FALSE FALSE FALSE
#> 10 rep001 P010 red TASC FALSE TRUE FALSE FALSE FALSE FALSE TRUE
#> # ℹ 26 more rows
#> # ℹ 9 more variables: surgery <lgl>, diagnostics <lgl>, icu <lgl>, ward <lgl>,
#> # recovery <lgl>, green_area <lgl>, end_area <chr>, died <lgl>,
#> # not_seen <lgl>