I was trying to combine gbm.plot.fit
and plot.gbm
from different gbm
models. Here is my example code:
#----------------------ask on stackexchange----------------------------#
mydata <- read.csv("http://www.ats.ucla.edu/stat/data/binary.csv")
library(gbm)
library(dismo)
full.model<- gbm.step(data=mydata,gbm.x = 2:4,gbm.y = 1,family = "bernoulli", tree.complexity = 5,learning.rate = 0.005, bag.fraction = 0.5)
fit1 <- gbm.step(data=mydata,gbm.x = 2,gbm.y = 1,family = "bernoulli", tree.complexity = 5,learning.rate = 0.005, bag.fraction = 0.5)
a=gbm.plot.fits(full.model,v="gre")
b=plot.gbm(full.model,i.var="gre")
c=gbm.plot.fits(fit1)
d=plot.gbm(fit1)
grid.arrange(a, b, c, d, ncol=2, nrow =2)
The error message is:
Error in arrangeGrob(..., as.table = as.table, clip = clip, main = main, : input must be grobs!
Can someone tell me what might go wrong with my code?