Skip to contents

Scores a supplied list of combinations against the full DSM-5-TR PCL-5 diagnosis, using the same collapsed-pattern matrix path as bootstrap_stability. Where score_all_combinations enumerates and scores an entire candidate space, this scores exactly the combinations it is given – which is what a validation site needs when it receives a plateau derived elsewhere.

Usage

evaluate_sets(data, sets, n_required, clusters = NULL, chunk_size = 1000L)

Arguments

data

A data frame with symptom_1 ... symptom_20.

sets

A combination specification, see as_set_matrix.

n_required

Endorsements required for a positive decision.

clusters

NULL for the non-hierarchical rule, or a named list of integer vectors to additionally require an endorsed symptom in every cluster.

chunk_size

Combinations per matrix block. Affects memory, not results.

Value

A data frame with one row per combination: set_id, tp, fn, fp, tn, n, sensitivity, specificity, ba.

Details

Respondents are collapsed to unique binarized response patterns first, so cost scales with the number of distinct patterns rather than the sample size.

The result carries one row per combination. That is the right granularity for local analysis and the wrong granularity to share: per-combination two-by-two counts across a large candidate space are invertible back towards the response-pattern distribution. Use transport_plateau to produce something releasable.

See also

transport_plateau for the shareable summary, score_all_combinations for an exhaustive search.

Examples

# \donttest{
data(simulated_ptsd_genpop)
prepared <- rename_ptsd_columns(
  simulated_ptsd_genpop[, c("patient_id", paste0("S", 1:20))],
  id_col = "patient_id")
evaluate_sets(prepared, c("2_3_6_7_17_18", "1_2_3_4_5_6"), n_required = 4)
#>          set_id  tp fn fp  tn    n sensitivity specificity        ba
#> 1 2_3_6_7_17_18 199 53 18 930 1200   0.7896825   0.9810127 0.8853476
#> 2   1_2_3_4_5_6 192 60 22 926 1200   0.7619048   0.9767932 0.8693490
# }