Learn R Programming

ggRandomForests (version 1.0.0)

gg_rfsrc.ggRandomForests: Predicted response data object

Description

Extracts the predicted response values from the randomForestSRC::rfsrc object, and formats data for plotting the response using plot.gg_rfsrc.

Usage

gg_rfsrc.ggRandomForests(object, surv_type = c("surv", "chf", "mortality",
  "hazard"), oob = TRUE, se, ...)

Arguments

object
randomForestSRC::rfsrc object
surv_type
("surv", "chf", "mortality", "hazard") for survival forests
oob
boolean, should we return the oob prediction , or the full forest prediction.
se
for survival forests, calculated the se bootstrap confidence interval
...
not used

Value

See Also

plot.gg_rfsrc rfsrc plot.rfsrc gg_survival

Examples

Run this code
## ------------------------------------------------------------
## classification example
## ------------------------------------------------------------
# iris_rf <- rfsrc(Species ~ ., data = iris)
data(iris_rf, package="ggRandomForests")
ggrf<- gg_rfsrc(iris_rf)

plot.gg_rfsrc(ggrf)

## ------------------------------------------------------------
## Regression example
## ------------------------------------------------------------
# airq.obj <- rfsrc(Ozone ~ ., data = airquality, na.action = "na.impute")
data(airq_rf, package="ggRandomForests")
ggrf<- gg_rfsrc(airq_rf)

plot.gg_rfsrc(ggrf)

## ------------------------------------------------------------
## Survival example
## ------------------------------------------------------------
## veteran data
## randomized trial of two treatment regimens for lung cancer
# data(veteran, package = "randomForestSRCM")
# veteran_rf <- rfsrc(Surv(time, status) ~ ., data = veteran, ntree = 100)
data(veteran_rf, package = "ggRandomForests")
ggrf <- gg_rfsrc(veteran_rf)
plot(ggrf)

Run the code above in your browser using DataLab