Skip to content
Prev 268091 / 398502 Next

randomForest partial dependence plot variable names

See if the following is close to what you're looking for.  If not, please give more detail on what you want to do.

data(airquality)
airquality <- na.omit(airquality)
set.seed(131)
ozone.rf <- randomForest(Ozone ~ ., airquality, importance=TRUE)
imp <- importance(ozone.rf)  # get the importance measures
impvar <- rownames(imp)[order(imp[, 1], decreasing=TRUE)]  # get the sorted names
op <- par(mfrow=c(2, 3))
for (i in seq_along(impvar)) {
    partialPlot(ozone.rf, airquality, impvar[i], xlab=impvar[i],
                main=paste("Partial Dependence on", impvar[i]), ylim=c(30, 70))
}
par(op)

Andy
Notice:  This e-mail message, together with any attachme...{{dropped:11}}