5

bayesglm の使用時に予測機能に問題があります。この問題は、アウト オブ サンプル データがイン サンプル データよりも多くのレベルを持つ場合に発生する可能性があるという投稿を読んだことがありますが、フィット関数と予測関数に同じデータを使用しています。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 オブジェクトで予測する方法がわかりません。何か案は?ありがとう!

4

1 に答える 1