Identifies every symptom combination whose balanced accuracy falls within
delta percentage points of the best combination in the same search.
The best-performing subset of PCL-5 items is rarely alone: typically a large
set of alternatives performs indistinguishably well. Reporting the size of
that plateau, rather than only the winner, is what separates "these six
items are the right ones" from "any of these hundreds of six-item sets would
do".
Arguments
- fit
A fitted exhaustive search from
score_all_combinations.- delta
Numeric. Plateau width in percentage points of balanced accuracy:
delta = 1(the default) keeps every combination within one percentage point of the best. A vector is allowed, e.g.delta = c(1, 5)to report a primary and a secondary plateau in one call.
Value
An object of class ptsdiag_plateau: a list of two data
frames.
summary: one row perdelta, withdelta,ba_best(the best balanced accuracy),ba_threshold(the lowest balanced accuracy still on the plateau),plateau_size(number of combinations),n_candidates(size of this rule form's candidate space) andplateau_proportion.sets: one row per plateau member, withdelta,rank,combination_id,balanced_accuracyandba_gap(how far below the best it falls, in percentage points).
Details
The plateau is always computed within one rule form, because the
candidate spaces differ in size. A six-item hierarchical search evaluates
13,685 combinations while the non-hierarchical search evaluates 38,760, so
the same plateau count means very different things; plateau_proportion
divides by the right denominator for the search that produced fit.
Comparisons use exact integer arithmetic rather than the rounded balanced
accuracies. Writing N1 for the number of reference cases and N0
for the number of non-cases, the quantity
tp * N0 + tn * N1 is an integer proportional to balanced accuracy, so
combinations that genuinely tie are never separated by floating-point noise.
Examples
# \donttest{
# A compact 4-symptom search on a 120-row subset keeps the example fast
ptsd_data <- rename_ptsd_columns(simulated_ptsd[1:120, ],
id_col = c("patient_id", "age", "sex"))
fit <- score_all_combinations(ptsd_data, n_symptoms = 4, n_required = 3,
show_progress = FALSE)
plateau <- compute_plateau(fit, delta = c(1, 5))
plateau$summary
#> delta ba_best ba_threshold plateau_size n_candidates plateau_proportion
#> 1 1 1 0.9909910 8 4845 0.001651187
#> 2 5 1 0.9684685 39 4845 0.008049536
head(plateau$sets)
#> delta rank combination_id balanced_accuracy ba_gap
#> 1 1 1 6_7_11_12 1.0000000 0.0000000
#> 2 1 2 4_6_7_12 0.9954955 0.4504505
#> 3 1 3 4_6_7_11 0.9909910 0.9009009
#> 4 1 4 6_7_11_13 0.9909910 0.9009009
#> 5 1 5 6_7_11_17 0.9909910 0.9009009
#> 6 1 6 6_7_11_19 0.9909910 0.9009009
# }
