Learn R Programming

ggRandomForests (version 1.1.2)

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, ...)

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.
...
not used

Value

  • gg_rfsrc object

See Also

plot.gg_rfsrc rfsrc plot.rfsrc gg_survival

Examples

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

plot.gg_rfsrc(gg_dta)

## ------------------------------------------------------------
## Regression example
## ------------------------------------------------------------
# rfsrc_airq <- rfsrc(Ozone ~ ., data = airquality, na.action = "na.impute")
data(rfsrc_airq, package="ggRandomForests")
gg_dta<- gg_rfsrc(rfsrc_airq)

plot.gg_rfsrc(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)
data(rfsrc_veteran, package = "ggRandomForests")
gg_dta <- gg_rfsrc(rfsrc_veteran)
plot(gg_dta)
plot(gg_dta, level=.68)

Run the code above in your browser using DataLab