This function calculates a confusion matrix from predicted probabilities, true outcomes, a threshold for classification, and a designated positive label. It calculates true positives, false negatives, true negatives, false positives, and several other useful metrics.
Arguments
- predprob
Numeric vector of prediction probabilities.
- truth
Numeric vector of true binary class outcomes.
- threshold
Numeric value to determine the cutoff for classifying predictions as positive.
- poslabel
The label of the positive class in the truth data.
Value
A dataframe object of class "dx_cm" containing the components of the confusion matrix and additional metrics:
tp
: True Positivesfn
: False Negativestn
: True Negativesfp
: False Positivesdispos
: Number of Actual Positivesdisneg
: Number of Actual Negativesn
: Total Number of Observationscorrect
: Number of Correct Predictionstestpos
: Number of Predicted Positivestestneg
: Number of Predicted Negatives