Learn R Programming

ggRandomForests (version 2.0.1)

gg_error: randomForestSRC error rate data object

Description

Extract the cumulative (OOB) randomForestSRC error rate as a function of number of trees.

Usage

gg_error(object, ...)

Arguments

object
rfsrc object.
...
optional arguments (not used).

Value

gg_error data.frame with one column indicating the tree number, and the remaining columns from the rfsrc$err.rate return value.

Details

The gg_error function simply returns the rfsrc$err.rate object as a data.frame, and assigns the class for connecting to the S3 plot.gg_error function.

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

plot.gg_error rfsrc plot.rfsrc

Examples

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

# Get a data.frame containing error rates
gg_dta<- gg_error(rfsrc_iris)

# Plot the gg_error object
plot(gg_dta)

## ------------------------------------------------------------
## Regression example
## ------------------------------------------------------------
## Not run: 
# ## ------------- airq data
# rfsrc_airq <- rfsrc(Ozone ~ ., data = airquality, na.action = "na.impute")
# 
# # Get a data.frame containing error rates
# gg_dta<- gg_error(rfsrc_airq)
# 
# # Plot the gg_error object
# plot(gg_dta)
# ## End(Not run)
## Not run: 
# ## ------------- Boston data
# data(rfsrc_Boston, package="ggRandomForests")
# 
# # Get a data.frame containing error rates
# gg_dta<- gg_error(rfsrc_Boston)
# 
# # Plot the gg_error object
# plot(gg_dta)
# ## End(Not run)
## Not run: 
# ## ------------- mtcars data
# 
# # Get a data.frame containing error rates
# gg_dta<- gg_error(rfsrc_mtcars)
# 
# # Plot the gg_error object
# plot(gg_dta)
# ## End(Not run)

## ------------------------------------------------------------
## Survival example
## ------------------------------------------------------------
## Not run: 
# ## ------------- veteran data
# ## randomized trial of two treatment regimens for lung cancer
# data(veteran, package = "randomForestSRC")
# rfsrc_veteran <- rfsrc(Surv(time, status) ~ ., data = dta$veteran, ...)
# 
# gg_dta <- gg_error(rfsrc_veteran)
# plot(gg_dta)
# ## End(Not run)
## Not run: 
# ## ------------- pbc data
# # Load a cached randomForestSRC object
# data(rfsrc_pbc, package="ggRandomForests")
# 
# gg_dta <- gg_error(rfsrc_pbc)
# plot(gg_dta)
# ## End(Not run)

Run the code above in your browser using DataLab