
Last chance! 50% off unlimited learning
Sale ends in
Plot out-of-bag (OOB) error rates and variable importance (VIMP) from a RF-SRC analysis. This is the default plot method for the package.
# S3 method for rfsrc
plot(x, outcome.target = NULL,
plots.one.page = TRUE, sorted = TRUE, verbose = TRUE, ...)
An object of class (rfsrc, grow)
, (rfsrc, synthetic)
,
or (rfsrc, predict)
.
Character value for multivariate families specifying the target outcome to be used. The default is to use the first coordinate.
Should plots be placed on one page?
Should variables be sorted by importance values?
Should VIMP be printed?
Further arguments passed to or from other methods.
Plot cumulative OOB error rates as a function of number of trees and
variable importance (VIMP) if available. Note that the default
settings are now such that the error rate is no longer calculated on
every tree and VIMP is only calculated if requested. To get OOB error
rates for ever tree, use the option tree.err = TRUE
when
growing the forest or restore the model using the option
tree.err = TRUE
. Likewise, to view VIMP, use the option
importance
when growing the forest or restore the forest using
the option importance
.
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.
# NOT RUN {
## ------------------------------------------------------------
## classification example
## ------------------------------------------------------------
iris.obj <- rfsrc(Species ~ ., data = iris,
tree.err = TRUE, importance = TRUE)
plot(iris.obj)
## ------------------------------------------------------------
## competing risk example
## ------------------------------------------------------------
## use the pbc data from the survival package
## events are transplant (1) and death (2)
if (library("survival", logical.return = TRUE)) {
data(pbc, package = "survival")
pbc$id <- NULL
plot(rfsrc(Surv(time, status) ~ ., pbc, nsplit = 10, tree.err = TRUE))
}
## ------------------------------------------------------------
## multivariate mixed forests
## ------------------------------------------------------------
mtcars.new <- mtcars
mtcars.new$cyl <- factor(mtcars.new$cyl)
mtcars.new$carb <- factor(mtcars.new$carb, ordered = TRUE)
mv.obj <- rfsrc(cbind(carb, mpg, cyl) ~., data = mtcars.new, tree.err = TRUE)
plot(mv.obj, outcome.target = "carb")
plot(mv.obj, outcome.target = "mpg")
plot(mv.obj, outcome.target = "cyl")
# }
Run the code above in your browser using DataLab