Skip to contents

Quantifies how consistently the same casualty is routed across replications. Two measures are offered, both returning a score in [0, 1] where 1 is perfectly consistent.

Usage

sdt_decision_consistency(run, method = c("om", "entropy"))

Arguments

run

A game_run from sdt_simulate().

method

"om" (default) or "entropy".

Value

A tibble::tibble() with one row per casualty: id, n_paths (how many replication paths contributed), n_distinct (how many of them differ), and consistency. With method = "om" and a single replication there is nothing to compare, so consistency is NA.

Details

"om" compares each casualty's paths with one another by optimal matching: the mean pairwise edit distance between its replication paths, normalised by the longer of each pair. This is the measure that answers "does this casualty get handled the same way twice?".

"entropy" scores each path on its own, as the normalised Shannon entropy of the time it spent in each area. A casualty that sat in one area all game scores 1; one moved through many areas scores lower. That describes the shape of a single trajectory rather than agreement between trajectories, so it is meaningful even with a single replication.

Examples

co <- sdt_synthetic_cohort(n = 12, seed = 1)
run <- sdt_simulate(sdt_scenario(co), replications = 4, seed = 1,
                    verbose = FALSE)
sdt_decision_consistency(run)
#> # A tibble: 12 × 4
#>    id    n_paths n_distinct consistency
#>    <chr>   <int>      <int>       <dbl>
#>  1 P001        4          2       0.833
#>  2 P002        4          3       0.783
#>  3 P003        4          1       1    
#>  4 P004        4          2       0.867
#>  5 P005        4          2       0.8  
#>  6 P006        4          2       0.9  
#>  7 P007        4          3       0.833
#>  8 P008        4          1       1    
#>  9 P009        4          1       1    
#> 10 P010        4          3       0.694
#> 11 P011        4          3       0.717
#> 12 P012        4          2       0.833
sdt_decision_consistency(run, method = "entropy")
#> # A tibble: 12 × 4
#>    id    n_paths n_distinct consistency
#>    <chr>   <int>      <int>       <dbl>
#>  1 P001        4          2       0.557
#>  2 P002        4          3       0.552
#>  3 P003        4          1       0.771
#>  4 P004        4          2       0.767
#>  5 P005        4          2       0.677
#>  6 P006        4          2       0.739
#>  7 P007        4          3       0.645
#>  8 P008        4          1       0.746
#>  9 P009        4          1       0.763
#> 10 P010        4          3       0.561
#> 11 P011        4          3       0.560
#> 12 P012        4          2       0.645