# NOT RUN {
## ------------------------------------------------------------
## find interactions, survival setting
## ------------------------------------------------------------
data(pbc, package = "randomForestSRC")
pbc.obj <- rfsrc(Surv(days,status) ~ ., pbc, importance = TRUE)
find.interaction(pbc.obj, method = "vimp", nvar = 8)
## ------------------------------------------------------------
## find interactions, competing risks
## ------------------------------------------------------------
data(wihs, package = "randomForestSRC")
wihs.obj <- rfsrc(Surv(time, status) ~ ., wihs, nsplit = 3, ntree = 100,
importance = TRUE)
find.interaction(wihs.obj)
find.interaction(wihs.obj, method = "vimp")
## ------------------------------------------------------------
## find interactions, regression setting
## ------------------------------------------------------------
airq.obj <- rfsrc(Ozone ~ ., data = airquality, importance = TRUE)
find.interaction(airq.obj, method = "vimp", nrep = 3)
find.interaction(airq.obj)
## ------------------------------------------------------------
## find interactions, classification setting
## ------------------------------------------------------------
iris.obj <- rfsrc(Species ~., data = iris, importance = TRUE)
find.interaction(iris.obj, method = "vimp", nrep = 3)
find.interaction(iris.obj)
## ------------------------------------------------------------
## interactions for multivariate mixed forests
## ------------------------------------------------------------
mtcars2 <- mtcars
mtcars2$cyl <- factor(mtcars2$cyl)
mtcars2$carb <- factor(mtcars2$carb, ordered = TRUE)
mv.obj <- rfsrc(cbind(carb, mpg, cyl) ~., data = mtcars2, importance = TRUE)
find.interaction(mv.obj, method = "vimp", outcome.target = "carb")
find.interaction(mv.obj, method = "vimp", outcome.target = "mpg")
find.interaction(mv.obj, method = "vimp", outcome.target = "cyl")
# }
Run the code above in your browser using DataLab