Function to compute and draw ROCcurves.
Description
Computes sensitivity, specificity and positive and negative predictive
values for a test based on dichotomizing along the variable
test
, for prediction of stat
. Plots curves of these and a ROCcurve.
Usage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 
Arguments
test 
Numerical variable used for prediction. 
stat 
Logical variable of true status. 
form 
Formula used in a logistic regression. If this is given,

plot 
Character variable. If "sp", the a plot of sensitivity, specificity and predictive values against test is produced, if "ROC" a ROCcurve is plotted. Both may be given. 
PS 
logical, if TRUE the xaxis in the
plot "ps"plot is the the predicted probability for

PV 
Should sensitivity, specificity and predictive values at the optimal cutpoint be given on the ROC plot? 
MX 
Should the “optimal cutpoint” (i.e. where sens+spec is maximal) be indicated on the ROC curve? 
MI 
Should model summary from the logistic regression model be printed in the plot? 
AUC 
Should the area under the curve (AUC) be printed in the ROC plot? 
grid 
Numeric or logical. If FALSE no background grid is
drawn. Otherwise a grid is drawn on both axes at 
col.grid 
Colour of the grid lines drawn. 
cuts 
Points on the testscale to be annotated on the ROCcurve. 
lwd 
Thickness of the curves 
data 
Data frame in which to interpret the variables. 
... 
Additional arguments for the plotting of the
ROCcurve. Passed on to 
Details
As an alternative to a test
and a status
variable, a
model formula may given, in which case the the linear predictor is the
test variable and the response is taken as the true status variable.
The test used to derive sensitivity, specificity, PV+ and PV as a
function of x is test
>=x as a predictor of
stat
=TRUE.
Value
A list with two components:
res 
dataframe with variables 
lr 
glm object with the logistic regression result used for construction of the ROC curve 
0, 1 or 2 plots are produced according to the setting of plot
.
Author(s)
Bendix Carstensen, Steno Diabetes Center \& University of Copenhagen, http://BendixCarstensen.com
Examples
1 2 3 4 5 6 
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.