我在使用bayesglm的预测函数时遇到了一些问题。我读过一些帖子说当样本外数据比样本内数据的水平更高时,这个问题可能会出现,但我在fit和predict函数中使用的是相同的数据。使用普通的glm预测工作正常,但是使用bayesglm就不行。例如:
control <- y ~ x1 + x2
# this works fine:
glmObject <- glm(control, myData, family = binomial())
predicted1 <- predict.glm(glmObject , myData, type = "response")
# this gives an error:
bayesglmObject <- bayesglm(control, myData, family = binomial())
predicted2 <- predict.bayesglm(bayesglmObject , myData, type = "response")
Error in X[, piv, drop = FALSE] : subscript out of bounds
# Edit... I just discovered this works.
# Should I be concerned about using these results?
# Not sure why is fails when I specify the dataset
predicted3 <- predict(bayesglmObject, type = "response")
无法弄清如何使用bayesglm对象进行预测。有什么想法吗?谢谢!