# Partial Dependency plots and Gradient boosting (GBM package)

Is it possible to plot a partial dependency plot to display the class probability and estimate the effects of a predictor for a GBM model? Something similar to partialPlot from randomForest package.

According to this article, a partial plot is doable with gbm.

Thanks in advance for your help.

## 1 Answer

Yes, it's really easy. Check out ?plot.gbm. The usage goes like this:

 plot(gbm.model, i.var = 1, lwd = 2, col = "blue", main = "")


and looks like

i.var controls the index of the variable to plot. You can also do two (or more) way plots using

 plot(gbm.model, i.var = c(1,2), lwd = 2, col = "blue", main = "")

• thank you, i really appreciate your efforts and time here and in your blog. – Panos Kal. Nov 14 '13 at 3:12