Learn R Programming

ggRandomForests (version 1.1.2)

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

  • gg_minimal_depth object, A modified list of variables from the randomForestSRC::var.select 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
# rfsrc_iris <- rfsrc(Species ~ ., data = iris)
# varsel_iris <- var.select(rfsrc_iris)
# ... or load a cached randomForestSRC object
data(varsel_iris, package="ggRandomForests")

# Get a data.frame containing minimaldepth measures
gg_dta<- gg_minimal_depth(varsel_iris)

# Plot the gg_mkinimal_depth object
plot(gg_dta)

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

# Get a data.frame containing error rates
gg_dta<- gg_minimal_depth(varsel_airq)

# Plot the gg_error object
plot(gg_dta)

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

gg_dta <- gg_minimal_depth(varsel_veteran)
plot(gg_dta)

Run the code above in your browser using DataLab