Learn R Programming

ggRandomForests (version 1.0.0)

gg_minimal_depth.ggRandomForests: Minimal depth data object (randomForestSRC::var.select)

Description

the randomForestSRC::var.select function implements random forest variable selection using tree minimal depth methodology. The gg_minimal_depth function takes the output from randomForestSRC::var.select and creates a data.frame formatted for the plot.gg_minimal_depth function.

Usage

gg_minimal_depth.ggRandomForests(object, ...)

Arguments

object
A randomForestSRC::rfsrc object, randomForestSRC::predict object or the list from the randomForestSRC::var.select.rfsrc function.
...
optional arguments passed to the randomForestSRC::var.select function if operating on an randomForestSRC::rfsrc object.

Value

  • Invisibly, the modified list of variables from the randomForestSRC::var.select.rfsrc function, ordered by minimal depth rank.

See Also

randomForestSRC::var.select plot.gg_minimal_depth

Examples

Run this code
## Examples from RFSRC package...
## ------------------------------------------------------------
## classification example
## ------------------------------------------------------------
## You can build a randomForest
# iris_rf <- rfsrc(Species ~ ., data = iris)
# iris_vs <- var.select(iris_rf)
# ... or load a cached randomForestSRC object
data(iris_vs, package="ggRandomForests")

# Get a data.frame containing minimaldepth measures
ggrf.obj<- gg_minimal_depth(iris_vs)

# Plot the gg_mkinimal_depth object
plot(ggrf.obj)

## ------------------------------------------------------------
## Regression example
## ------------------------------------------------------------
# airq_rf <- rfsrc(Ozone ~ ., data = airquality, na.action = "na.impute")
# airq_vs <- var.select(airq_rf)
# ... or load a cached randomForestSRC object
data(airq_vs, package="ggRandomForests")

# Get a data.frame containing error rates
ggrf.obj<- gg_minimal_depth(airq_vs)

# Plot the gg_error object
plot(ggrf.obj)

## ------------------------------------------------------------
## Survival example
## ------------------------------------------------------------
## veteran data
## randomized trial of two treatment regimens for lung cancer
# data(veteran, package = "randomForestSRC")
# veteran_rf <- rfsrc(Surv(time, status) ~ ., data = veteran, ntree = 100)
# veteran_vs <- var.select(veteran_rf)
# Load a cached randomForestSRC object
data(veteran_vs, package="ggRandomForests")

ggrf.obj <- gg_minimal_depth(veteran_vs)
plot(ggrf.obj)

Run the code above in your browser using DataLab