
Symptom selection across the plateau, against chance
Source:R/symptom_selection.R
symptom_selection.RdReports how often each PCL-5 item appears among the near-optimal symptom combinations, alongside the frequency expected by chance alone. Raw selection counts cannot be read on their own: every combination contains the same number of items, so the counts are zero-sum and an item can only gain at another's expense. The chance baseline turns "item 6 appears in 55 plateau combinations" into a statement about whether item 6 is actually being preferred.
Arguments
- fit
A fitted exhaustive search from
score_all_combinations.- delta
Numeric. Plateau width in percentage points of balanced accuracy (default 1). A single value.
- stability
Optional
bootstrap_stabilityresult for the same search, used for the stability weighted columns.- clusters
Named list of item indices used only to label items by cluster in the output. Defaults to the clusters of
fit, or to the standard DSM-5-TR PCL-5 clusters whenfitwas non-hierarchical.- symptom_labels
Optional character vector of length 20 giving readable item names.
Value
A data.frame with one row per item:
symptom,label,cluster: item identity.baseline: proportion of this rule form's candidate space containing the item.plateau_count,plateau_n,plateau_freq: how often the item appears among the plateau combinations.enrichment:plateau_freq / baseline. Values above 1 mean the item is selected more often than chance would produce.excess_pp:plateau_freq - baselinein percentage points.pi_freq,pi_enrichment: the stability weighted equivalents, orNAwhenstabilityis not supplied.
Details
The baseline is the proportion of the rule form's own candidate space that
contains each item, computed by enumeration rather than assumed. Under the
non-hierarchical rule it is the same for every item
(n_symptoms / 20, so 30
hierarchical rule it varies substantially by cluster, because a combination
must draw at least one item from each: with the default PCL-5 clusters, each
of the two avoidance items appears in 55.8
each of the seven cognition-and-mood items appears in only 25.2
hierarchical selection frequencies against a flat 30
avoidance items look preferred when they are merely unavoidable.
Supplying a bootstrap_stability result adds a stability
weighted version of the same quantity, in which each combination counts in
proportion to how often it stayed on the plateau across bootstrap replicates
rather than counting once if it happened to make the plateau in the original
sample.
Examples
# \donttest{
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)
selection <- symptom_selection(fit, delta = 1)
head(selection[order(-selection$enrichment), ])
#> symptom label cluster baseline plateau_count plateau_n plateau_freq
#> 6 6 <NA> C 0.2 8 8 1.000
#> 7 7 <NA> C 0.2 8 8 1.000
#> 11 11 <NA> D 0.2 5 8 0.625
#> 12 12 <NA> D 0.2 4 8 0.500
#> 4 4 <NA> B 0.2 2 8 0.250
#> 17 17 <NA> E 0.2 2 8 0.250
#> enrichment excess_pp pi_freq pi_enrichment
#> 6 5.000 80.0 NA NA
#> 7 5.000 80.0 NA NA
#> 11 3.125 42.5 NA NA
#> 12 2.500 30.0 NA NA
#> 4 1.250 5.0 NA NA
#> 17 1.250 5.0 NA NA
# }