# NOT RUN {
## ------------------------------------------------------------
## classification example
## ------------------------------------------------------------
iris.obj <- rfsrc(Species ~ ., data = iris,
block.size = 1, 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, block.size = 1))
}
## ------------------------------------------------------------
## 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, block.size = 1)
plot(mv.obj, m.target = "carb")
plot(mv.obj, m.target = "mpg")
plot(mv.obj, m.target = "cyl")
# }
Run the code above in your browser using DataLab