if (FALSE) {
#---------------------------------------------------------------------
# iris data - classification random forest
#---------------------------------------------------------------------
# load the rfsrc object from the cached data
data(rfsrc_iris, package="ggRandomForests")
# The plot.variable call
partial_iris <- plot.variable(rfsrc_iris,
partial=TRUE, show.plots=FALSE)
# plot the forest partial plots
gg_dta <- gg_partial(partial_iris)
plot(gg_dta, panel=TRUE)
#---------------------------------------------------------------------
# MASS::Boston data - regression random forest
#---------------------------------------------------------------------
# load the rfsrc object from the cached data
data(rfsrc_boston, package="ggRandomForests")
# The plot.variable call
partial_boston <- plot.variable(rfsrc_boston,
partial=TRUE, show.plots = FALSE )
# plot the forest partial plots
gg_dta <- gg_partial(partial_boston)
plot(gg_dta, panel=TRUE)
#---------------------------------------------------------------------
# randomForestSRC::pbc data - survival random forest
#---------------------------------------------------------------------
# load the rfsrc object from the cached data
data(rfsrc_pbc, package="ggRandomForests")
# The plot.variable call -
# survival requires a time point specification.
# for the pbc data, we want 1, 3 and 5 year survival.
partial_pbc <- lapply(c(1,3,5), function(tm) {
plot.variable(rfsrc_pbc, surv.type = "surv",
time = tm,
xvar.names = xvar,
partial = TRUE,
show.plots = FALSE)
})
# plot the forest partial plots
gg_dta <- gg_partial(partial_pbc)
plot(gg_dta)
}
Run the code above in your browser using DataLab