Learn R Programming

ggRandomForests (version 1.0.0)

gg_roc.ggRandomForests: ROC (Recievor 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
## ------------------------------------------------------------
#iris_rf <- rfsrc(Species ~ ., data = iris)
data(iris_rf, package="ggRandomForests")

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

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

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

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

Run the code above in your browser using DataLab