GeomRoc | R Documentation |
Display the empirical ROC curve. Useful for characterizing the classification accuracy of continuous measurements for predicting binary states
GeomRoc
geom_roc(
mapping = NULL,
data = NULL,
stat = "roc",
n.cuts = 10,
arrow = NULL,
lineend = "butt",
linejoin = "round",
linemitre = 1,
linealpha = 1,
pointalpha = 1,
pointsize = 0.5,
labels = TRUE,
labelsize = 3.88,
labelround = 1,
na.rm = TRUE,
cutoffs.at = NULL,
cutoff.labels = NULL,
position = "identity",
show.legend = NA,
inherit.aes = TRUE,
...
)
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
Use to override the default connection between
|
n.cuts |
Number of cutpoints to display along each curve |
arrow |
Arrow specification, as created by |
lineend |
Line end style (round, butt, square) |
linejoin |
Line join style (round, mitre, bevel) |
linemitre |
Line mitre limit (number greater than 1) |
linealpha |
Alpha level for the lines, alpha.line is deprecated |
pointalpha |
Alpha level for the cutoff points, alpha.point is deprecated |
pointsize |
Size of cutoff points, size.point is deprecated |
labels |
Logical, display cutoff text labels |
labelsize |
Size of cutoff text labels |
labelround |
Integer, number of significant digits to round cutoff labels |
na.rm |
Remove missing values from curve |
cutoffs.at |
Vector of user supplied cutoffs to plot as points. If non-NULL, it will override the values of n.cuts and plot the observed cutoffs closest to the user-supplied ones. |
cutoff.labels |
vector of user-supplied labels for the cutoffs. Must be a character vector of the same length as cutoffs.at. |
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
... |
Other arguments passed on to |
An object of class GeomRoc
(inherits from Geom
, ggproto
, gg
) of length 6.
estimate of false positive fraction
estimate of true positive fraction
values of m at which estimates are calculated
geom_roc
understands the following aesthetics (required aesthetics
are in bold):
x
The FPF estimate. This is automatically mapped by stat_roc
y
The TPF estimate. This is automatically mapped by stat_roc
smallest level in sort order is assumed to be 0, with a warning
alpha
color
fill
linetype
size
See geom_rocci
for
displaying rectangular confidence regions for the empirical ROC curve, style_roc
for
adding guidelines and labels, and direct_label
for adding direct labels to the
curves. Also export_interactive_roc for creating interactive ROC curve plots for use in a web browser.
D.ex <- rbinom(50, 1, .5)
rocdata <- data.frame(D = c(D.ex, D.ex),
M = c(rnorm(50, mean = D.ex, sd = .4), rnorm(50, mean = D.ex, sd = 1)),
Z = c(rep("A", 50), rep("B", 50)))
ggplot(rocdata, aes(m = M, d = D)) + geom_roc()
ggplot(rocdata, aes(m = M, d = D, color = Z)) + geom_roc()
ggplot(rocdata, aes(m = M, d = D)) + geom_roc() + facet_wrap(~ Z)
ggplot(rocdata, aes(m = M, d = D)) + geom_roc(n.cuts = 20)
ggplot(rocdata, aes(m = M, d = D)) + geom_roc(cutoffs.at = c(1.5, 1, .5, 0, -.5))
ggplot(rocdata, aes(m = M, d = D)) + geom_roc(labels = FALSE)
ggplot(rocdata, aes(m = M, d = D)) + geom_roc(size = 1.25)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.