Learn R Programming

ggRandomForests (version 1.1.2)

gg_roc.ggRandomForests: ROC (Receiver operator curve) data from a classification random forest.

Description

The sensitivity and specificity of a randomForests classification object.

Usage

gg_roc.ggRandomForests(object, which.outcome, oob = TRUE)

Arguments

object
an randomForestSRC::rfsrc classification object
which.outcome
select the classification outcome of interest.
oob
use oob estimates (default TRUE)

Value

  • gg_roc data.frame for plotting ROC curves.

See Also

plot.gg_roc randomForestSRC::rfsrc

Examples

Run this code
## ------------------------------------------------------------
## classification example
## ------------------------------------------------------------
#rfsrc_iris <- rfsrc(Species ~ ., data = iris)
data(rfsrc_iris, package="ggRandomForests")

# ROC for setosa
gg_dta <- gg_roc(rfsrc_iris, which.outcome=1)
plot.gg_roc(gg_dta)

# ROC for versicolor
gg_dta <- gg_roc(rfsrc_iris, which.outcome=2)
plot.gg_roc(gg_dta)

# ROC for virginica
gg_dta <- gg_roc(rfsrc_iris, which.outcome=3)
plot.gg_roc(gg_dta)

# Alternatively, you can plot all three outcomes in one go
# by calling the plot function on the forest object.
plot.gg_roc(rfsrc_iris)

Run the code above in your browser using DataLab