所以这是一个非常简单的问题,只是似乎无法弄清楚。
我正在使用 glm 函数运行 logit,但不断收到与自变量相关的警告消息。它们被存储为因子,我已将它们更改为数字但没有运气。我也将它们编码为 0/1,但这也不起作用。
请帮忙!
> mod2 <- glm(winorlose1 ~ bid1, family="binomial")
Warning messages:
1: glm.fit: algorithm did not converge
2: glm.fit: fitted probabilities numerically 0 or 1 occurred
我也在 Zelig 中尝试过,但类似的错误:
> mod2 = zelig(factor(winorlose1) ~ bid1, data=dat, model="logit")
How to cite this model in Zelig:
Kosuke Imai, Gary King, and Oliva Lau. 2008. "logit: Logistic Regression for Dichotomous Dependent Variables" in Kosuke Imai, Gary King, and Olivia Lau, "Zelig: Everyone's Statistical Software," http://gking.harvard.edu/zelig
Warning messages:
1: glm.fit: algorithm did not converge
2: glm.fit: fitted probabilities numerically 0 or 1 occurred
编辑:
> str(dat)
'data.frame': 3493 obs. of 3 variables:
$ winorlose1: int 2 2 2 2 2 2 2 2 2 2 ...
$ bid1 : int 700 300 700 300 500 300 300 700 300 300 ...
$ home : int 1 0 1 0 0 0 0 1 0 0 ...
- attr(*, "na.action")=Class 'omit' Named int [1:63021] 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 ...
.. ..- attr(*, "names")= chr [1:63021] "3494" "3495" "3496" "3497" ...