Last chance! 50% off unlimited learning
Sale ends in
This function estimates the Receiver Operating Characteristic curve and returns a 'groc' object. This object can be printed
or plotted
. It is the main function of the package and it includes the ROC curve generalization for non-monotone relationships (see References below).
gROC(X, D, ...)
# S3 method for default
gROC(X, D, side=c("right", "left", "both", "both2", "auto"),
Ni = NULL, plot.roc = FALSE, plot.density = FALSE,
pval.auc = FALSE, B = 500, ...)
vector of (bio)marker values.
vector of response values.
type of ROC curve. One of "right", "left", "both", "both2" or "auto". If the user does not specify the method, "right" is considered, i.e., the right-sided ROC curve is estimated. If "auto", one of "right" or "left" is assigned automatically according to the Wilcoxon statistic. If the estimate is lower than
number of subintervals of the unit interval (FPR values) considered to calculate the curve. Default: NULL (in this case the fast algorithm considering as many FPR values as number of controls is considered).
if TRUE, ROC curve estimate considered is displayed.
if TRUE, density estimates for the (bio)marker in the positive and negative subjects are displayed in the same plot.
if TRUE, a permutation test to test if the AUC differs from $0.5$ is performed. Available if Ni is NULL. Default: FALSE.
number of permutations used for testing. Default: 500.
additional arguments for gROC
. Ignored.
A list of class "groc" with the following content:
levels in D
. The two first ones are the labels of D
considered controls and cases, respectively.
marker values for controls.
marker values for cases.
direction of the comparison between controls and cases. One of "right", "left", "both" or "both2". If side
is auto
in input arguments, the output will be the one considered by the function (according to the comparison specified above).
p-value of Wilcoxon test performed to compare cases and controls. Alternative hypothesis:
vector of values of t: {0, 1/Ni
, 2/Ni
, ..., 1}.
vector of values of
area under the ROC curve estimate by trapezoidal rule.
p-value of the permutation test over the AUC.
different permutation AUCs displayed if the hypothesis test is performed.
coordinates of the points (FPR, TPR) where the ROC curve estimate has a step in case of right or left-sided curves. The first column corresponds to the values of the points
vector providing these coordinates.
coordinates of the points (FPR, TPR) where the ROC curve estimate has a step in case of general curves. The first and second columns correspond to the values of the pairpoints
matrix providing these coordinates.
a logical value indicating if the estimation procedure whether parametric or not.
number of subintervals of the unit interval considered to build the curve.
if Ni
!= NULL
, vector of cut-off points of the (bio)marker considered to estimate left or right-sided ROC curves. It corresponds to the sorted marker-values, including
if Ni
!= NULL
, matrix whose rows correspond to each pair of cut-off points (xl,xu) such that xl<xu of the (bio)marker considered to estimate general ROC curves.
if Ni
!= NULL
, vector of specificities associated to points
if left or right-sided ROC curves are considered and those ones corresponding to pairpoints
in case of general ROC curves. It could contain repeated values in both cases.
if Ni
!= NULL
, vector of sensitivities associated to points
if left or right-sided ROC curves are considered and those ones corresponding to pairpoints
in case of general ROC curves. It could contain repeated values in both cases.
if Ni
!= NULL
, matrix whose first column is constituted by the unique values of FPR (1-specificities
) and its second column is formed by the corresponding values of TPR (sensitivities
). In the case of general ROC curves, several TPR values could be associated with the same FPR value.
if Ni
!= NULL
, in general ROC curves, a vector displaying which row(s) of the pairpoints
matrix correspond(s) to pairpoints.coordinates
.
First of all, the data introduced is checked by the ROCcheck
function.
If side
is not specified, one of "right" or "left" options is considered according to the comparison of the Wilcoxon test estimate and
If Ni
is NULL
, the general ROC curve,
If both plot.density
and plot.roc
are TRUE
they are displayed in the same window.
Martinez-Camblor P., Corral N., Rey C., Pascual J., Cernuda-Morollon E., 2014, ROC curve generalization for non-monotone relationships, Statistical Methods in Medical Research, 26(1), 113-123.
# NOT RUN {
# Basic example (side="auto") -> Output side is "right"
set.seed(123)
X <- c(rnorm(45), rnorm(30,2,1.5))
D <- c(rep(0,45), rep(1,30))
gROC(X,D)
# Basic example (side="auto") -> Output side is "left"
X <- c(rnorm(45), rnorm(30,-2,1.5))
D <- c(rep(0,45), rep(1,30))
gROC(X,D)
# General ROC curve example
X <- c(rnorm(45), rnorm(30,1,4))
D <- c(rep(0,45), rep(1,30))
gROC(X, D, side="both")
# Plot density estimates and ROC curve in the same plot
X <- c(rnorm(45), rnorm(30,2,1.5))
D <- c(rep(0,45), rep(1,30))
gROC(X, D, plot.roc=TRUE, plot.density=TRUE)
# }
Run the code above in your browser using DataLab