我正在创建多个泊松回归,每个模型都有不同的结果。在这个与其他结果没有什么不同的特殊结果(所有二进制,0 或 1)上,我得到了这个我以前从未见过的奇怪错误。
mix_1<- glm(count~ offset(log(time)) + age + gender, data=x[x$diagnosis=="match",], family=poisson)
glm 模型没有任何问题,我没有按预期工作。我在尝试执行 cbind 并对系数求幂时收到错误。
mix_2 <- cbind(exp(coef(mix_1)), exp(confint(mix_1)))
这是我得到的错误:
Waiting for profiling to be done...
Error in glm.fit(x = Xi, y = Y, weights = W, etastart = LP, offset = o, :
NA/NaN/Inf in 'x'
warning
Warning messages:
1: glm.fit: fitted rates numerically 0 occurred
我认为这个问题不需要数据子集,因此我没有提供数据子集。但如果我确实没有必要,请告诉我,我将创建一个子集。
非常感谢所有帮助!
最佳答案
我刚刚也遇到了同样的问题。 Andrew Gelman 的博客 here 有一些关于 MASS 和 glm.fit 问题的讨论。 ,这可能至少略有相关。
问题似乎出在 confint()
函数上。来自confit手册:
There are stub methods for classes "glm" and "nls" which invoke those in package MASS which are based on profile likelihoods.
...
confint(glm.D93) # needs MASS to be present on the system
confint.default(glm.D93) # based on asymptotic normality
我发现如果我使用 confint.default()
函数,问题就会消失。我希望我能得到比这更多的答案。
关于error-handling - GLM 中的奇怪错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27669101/