Johann Hibschman wrote:
I'm having trouble calling randomForest::partialPlot programmatically.
It tries to use name of the (R) variable as the data column name.

You may want to consider looking at plotmo (in the plotmo package) which doesn't have the above issue.

library(randomForest)
library(plotmo)
plotmo.var <- function(var.name)
{
   plotmo(model, degree1=var.name, degree2=0)
}
model <- randomForest(Volume ~ ., data = trees)
plotmo(model)
plotmo.var("Girth")

Plotmo can be considered to be a "poor man's partial dependence plot" --- it simply holds the not-being-plotted variables at their median values, rather than averaging as in a partial dependence plot. This may seem a bit simplistic, but an advantage is that plotmo plots are easier to understand than partial dependence plots (I believe). Or at least it is easier to understand what a plotmo plot is NOT telling you. For additive models, the shape of the plotmo curve is identical to the partial dependence curve. Currently the quickest introduction to plotmo is pages 17-19 of http://www.milbo.org/rpart-plot/prp.pdf

Regards,
Steve
www.milbo.users.sonic.net

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to