Measure descriptive one-versus-rest factor specificity
Source:R/program-diagnostics.R
factor_specificity.RdMeasure descriptive one-versus-rest factor specificity
Usage
factor_specificity(
fit,
metadata,
group,
groups = NULL,
factors = NULL,
direction = "positive",
threshold_method = "closest.topleft",
unit_col = NULL
)Arguments
- fit
Native fit or representation.
- metadata
Metadata matching every sample.
- group
Grouping column.
- groups
Optional target labels, including absent classes.
- factors
Optional factor IDs.
- direction
positive (higher predicts target) or negative.
- threshold_method
closest.topleft or youden.
- unit_col
Optional unit IDs for counts; no inferential p-values.
Value
AUC, finite optimal threshold, sensitivity, specificity, tie count, observation/unit counts and explicit status for every factor/group pair.
Details
A zero-factor fit returns a typed empty specificity table.
AUC, thresholds and direction are learned on the same labels they
describe: the result is an in-sample descriptive statistic, not a
predictive estimate, and no confidence intervals are attached. When
unit_col units (e.g. donors) span both the target and non-target
classes, the unique positive/negative unit counts visibly overlap
(n_positive_units + n_negative_units > n_units); the counts are
descriptive tallies, not independent-group uncertainty estimates.
Observations with NA in group or unit_col fail explicitly through
the metadata guard rather than being silently dropped.