Calculates a risk model's deviance, accuracy, sensitivity, and specificity given a set of data and a threshold value.
get_metrics_internal(
mod,
X = NULL,
y = NULL,
weights = NULL,
threshold = 0.5,
threshold_type = c("response", "score")
)List with deviance (dev), accuracy (acc), sensitivity (sens), specificity (spec), and auc.
An object of class risk_mod, usually a result of a call to
risk_mod().
Input covariate matrix with dimension \(n \times p\); every row is an observation.
Numeric vector for the (binomial) response variable.
Numeric vector of length \(n\) with weights for each observation. Unless otherwise specified, default will give equal weight to each observation.
Numeric vector of classification threshold values used to calculate the accuracy, sensitivity, and specificity of the model. Defaults to a range of risk probability thresholds from 0.1 to 0.9 by 0.1.
Defines whether the threshold vector contains
risk probability values ("response") or threshold values expressed as scores
from the risk score model ("score"). Default: "response".