View source: R/LogisticRegression.R
roc.lr | R Documentation |
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'.
roc.lr(lrfit, newdata = NULL, plot = TRUE, len = 50)
lrfit |
an object of class " |
newdata |
an optional data frame to predict from. If ignored, the default data frame is that used to fit the original model. |
plot |
logical; if |
len |
optional; number of different thresholds to use. |
A positive prediction from a logistic regression model is made when
f(x; \beta) := X \beta \ge t.
where t
is some threshold. See predict.lr
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,\dots,J
, the True Positive Rate (TPR) and False Positive Rate (FPR) can be calculated as
TPR(j) = \sum I(f(x_i;\beta) \geq t_j)/\sum I(y_i = 1),
FPR(j) = \frac{\sum I(f(x_i;\beta) < t_j)}{\sum 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.