Learn R Programming

ggRandomForests (version 1.0.0)

plot.gg_roc: ROC plot generic function for a gg_roc object.

Description

ROC plot generic function for a gg_roc object.

Usage

## S3 method for class 'gg_roc':
plot(x, which.outcome = NULL, ...)

Arguments

x
gg_roc object created from a classification forest
which.outcome
for multiclass problems, choose the class for plotting
...
arguments passed to the gg_roc function

Value

  • ggplot object of the ROC curve

References

Breiman L. (2001). Random forests, Machine Learning, 45:5-32.

Ishwaran H. and Kogalur U.B. (2007). Random survival forests for R, Rnews, 7(2):25-31.

Ishwaran H. and Kogalur U.B. (2013). Random Forests for Survival, Regression and Classification (RF-SRC), R package version 1.4.

See Also

gg_roc 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