5
使用bayesglm時,我遇到預測函數的一些問題。我讀過一些文章,指出當樣本數據比樣本數據更多時,可能會出現這個問題,但我使用相同的數據來擬合和預測函數。 Predict可以正常工作,但不適用於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對象進行預測。有任何想法嗎?謝謝!