我试图将来自不同gbm.plot.fit
模型的plot.gbm
和gbm
结合起来。这是我的示例代码:
#----------------------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)
错误消息是:
arrangeGrob(...,as.table = as.table,clip = clip,main = main,: 输入必须是grobs!
有人可以告诉我代码可能出错吗?