[R] substitute games with randomForest::partialPlot
Stephen Milborrow
milbo at sonic.net
Fri Sep 16 20:43:41 CEST 2011
> 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
More information about the R-help
mailing list