Receiver Operating Characteristic (ROC) curve

Description Usage Arguments Details Value

View source: R/LogisticRegression.R


A method of judging the predictive performance of a model by plotting and/or averaging the probability of predicting the positive class correctly, over multiple thresholds. See 'Details'.


1, newdata = NULL, plot = TRUE, len = 50)



an object of class "lr", the output from lr


an optional data frame to predict from. If ignored, the default data frame is that used to fit the original model.


logical; if TRUE, then the ROC curve is plotted


optional; number of different thresholds to use.


A positive prediction from a logistic regression model is made when

f(x; β) := X β ≥ t.

where t is some threshold. See for details. A different threshold t_0 will yield a different set of predictions. For a given sequence t_j in [min(t), max(t)], for j=1,…,J, the True Positive Rate (TPR) and False Positive Rate (FPR) can be calculated as

TPR(j) = ∑ I(f(x_i;β) ≥q t_j)/∑ I(y_i = 1),

FPR(j) = \frac{∑ I(f(x_i;β) < t_j)}{∑ I(y_i = 1)}.

The ROC curve is plotted from the pairs (FPR(j), TPR(j)), and the AUC is calculated as the area under this curve, i.e.

AUC = \int_{j=1}^J TPR(FPR(j))dj.


the AUC value, and a plot of the ROC curve if plot=TRUE

dannyjameswilliams/danielR documentation built on Feb. 1, 2021, 6:39 p.m.