Learn R Programming

ggRandomForests (version 3.1.2)

autoplot.gg: autoplot methods for ggRandomForests data objects

Description

These let you call ggplot2::autoplot() on any gg_* object ggRandomForests returns. Each is a thin wrapper around the matching plot.gg_*() S3 method, and ... passes straight through, so every argument those plot methods take is still available here.

Usage

# S3 method for gg_error
autoplot(object, ...)

# S3 method for gg_vimp autoplot(object, ...)

# S3 method for gg_rfsrc autoplot(object, ...)

# S3 method for gg_variable autoplot(object, ...)

# S3 method for gg_partial autoplot(object, ...)

# S3 method for gg_partial_rfsrc autoplot(object, ...)

# S3 method for gg_partialpro autoplot(object, ...)

# S3 method for gg_partial_varpro autoplot(object, ...)

# S3 method for gg_roc autoplot(object, ...)

# S3 method for gg_survival autoplot(object, ...)

# S3 method for gg_brier autoplot(object, ...)

# S3 method for gg_varpro autoplot(object, ...)

# S3 method for gg_udependent autoplot(object, ...)

# S3 method for gg_isopro autoplot(object, ...)

Value

A ggplot object.

Arguments

object

A gg_* data object (see Details).

...

Additional arguments passed to the underlying plot.gg_*() method.

Details

The following gg_* classes are supported:

gg_error

OOB error vs. number of trees

gg_vimp

Variable importance ranking

gg_rfsrc

Predicted vs. observed values

gg_variable

Marginal dependence

gg_partial

Partial dependence (via plot.variable)

gg_partial_rfsrc

Partial dependence (via partial.rfsrc)

gg_partial_varpro

Partial dependence (via varPro)

gg_partialpro

Partial dependence via varPro (deprecated alias)

gg_varpro

Variable importance from varPro

gg_roc

ROC curve

gg_survival

Survival / cumulative hazard curves

gg_brier

Time-resolved Brier score and CRPS

Examples

Run this code
# \donttest{
library(ggplot2)
set.seed(42)
rf <- randomForestSRC::rfsrc(Ozone ~ ., data = na.omit(airquality),
                              ntree = 50, importance = TRUE,
                              tree.err = TRUE)
autoplot(gg_error(rf))
autoplot(gg_vimp(rf))
# }

Run the code above in your browser using DataLab