Learn R Programming

qwraps2 (version 0.5.2)

qroc: Receiver Operator Curves

Description

Construction of ROC curves.

Usage

qroc(x, ...)

qroc_build_data_frame(fit, n_threshold = 200, ...)

auc(.data)

Arguments

x

a glm fit or data.frame generated by qroc_build_data_frame.

...

passed to stats::predict

fit

a glm fit with family = binomial().

n_threshold

number of thresholds to test against.

.data

a data.frame generated by qroc_build_data_frame.

Value

a ggplot. Minimal aesthetics have been used so that the user may modify the graphic as desired with ease.

AUC for the data set generated by

Details

Given a glm fit with family = "binomial" (either a log-link or logit-link should be fine, a data set will be constructed and ROC plots generated.

The area under the curve (AUC) is determined by a trapezoid approximation.

See Also

vignette("qwraps2-graphics", package = "qwraps2") for more examples.

Examples

Run this code
# NOT RUN {
# load ggplot2 and the diamonds data set
data(diamonds, package = "ggplot2")

# Create a logistic regression models
fit <- glm(I(price > 2800) ~ cut * color, data = diamonds, family = binomial())

qroc(fit)

# }

Run the code above in your browser using DataLab