Groups casualties by how similar their board pathways are: an optimal matching dissimilarity between state sequences, then partitioning around medoids. What comes out is a small number of characteristic ways through the board, which is usually more useful than a per-casualty path listing.
Arguments
- run
A
game_runfromsdt_simulate().- k
Number of clusters.
- method
Dissimilarity passed to
TraMineR::seqdist()."OM"is optimal matching.- indel
Insertion/deletion cost for optimal matching.
- sm
Substitution-cost matrix or method.
"CONSTANT"applies a flat cost, the right default when no substitution is more plausible than another.
Value
A tibble::tibble() with one row per sequence: replication,
id, cluster, and medoid, which flags the sequence representing its
cluster.
Examples
co <- sdt_synthetic_cohort(n = 30, seed = 1)
run <- sdt_simulate(sdt_scenario(co), replications = 2, seed = 1,
verbose = FALSE)
if (requireNamespace("TraMineR", quietly = TRUE) &&
requireNamespace("WeightedCluster", quietly = TRUE)) {
sdt_seq_cluster(run, k = 3)
}
#> Registered S3 method overwritten by 'vegan':
#> method from
#> print.nullmodel parsnip
#> # A tibble: 60 × 4
#> replication id cluster medoid
#> <int> <chr> <int> <lgl>
#> 1 1 P001 2 FALSE
#> 2 1 P002 2 FALSE
#> 3 1 P003 3 FALSE
#> 4 1 P004 1 FALSE
#> 5 1 P005 2 FALSE
#> 6 1 P006 1 FALSE
#> 7 1 P007 1 FALSE
#> 8 1 P008 3 FALSE
#> 9 1 P009 3 FALSE
#> 10 1 P010 2 FALSE
#> # ℹ 50 more rows