logistic regression predicts “NA” probability in R - why?

前提是你 提交于 2020-02-05 05:10:27

问题


I have run a logistic regression in R using the following code:

   logistic.train.model3 <- glm(josh.model2, family=binomial(link=logit), data=auth, na.action = na.exclude)
    print(summary(logistic.train.model3)) 

My response variable is binary, taking on values of 1 or 0.

when I look at the summary, everything looks fine, every variable has a coefficient.

However, when I try to output the predicted probabilities using the following code:

auth$predict.train.logistic <- predict(logistic.train.model3, type = "response")

Almost 20% of my predictions are "NA". How can this be? What is going on? Thanks in advance!


回答1:


Do you have NA in your variables? If so, you'll get NA for predict value.



来源:https://stackoverflow.com/questions/23276316/logistic-regression-predicts-na-probability-in-r-why

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!