问题与泊松模型 - 整数

时间:2017-09-04 15:03:29

标签: r integer poisson

我在使用Poisson运行log-log回归模型时遇到了麻烦。我该如何阻止此警告消息?这也是我第一次使用Poisson,所以我真的不知道该怎么做。非常感谢

sardegnalog.lm <-glm(log1p(fulldata[381:400,1])~log1p(fulldata[381:400,2])+log1p(fulldata[381:400,3])+log1p(fulldata[381:400,4])+log1p(fulldata[381:400,8]), family="poisson")
Warning messages:
1: In dpois(y, mu, log = TRUE) : non-integer x = 8.868132
2: In dpois(y, mu, log = TRUE) : non-integer x = 9.885069
3: In dpois(y, mu, log = TRUE) : non-integer x = 9.410911 
4: In dpois(y, mu, log = TRUE) : non-integer x = 7.876259
5: In dpois(y, mu, log = TRUE) : non-integer x = 11.826326
6: In dpois(y, mu, log = TRUE) : non-integer x = 9.632728
7: In dpois(y, mu, log = TRUE) : non-integer x = 9.872616
8: In dpois(y, mu, log = TRUE) : non-integer x = 6.899723
9: In dpois(y, mu, log = TRUE) : non-integer x = 9.027379
10: In dpois(y, mu, log = TRUE) : non-integer x = 16.733528
summary(sardegnalog.lm)
Call:
glm(formula = log1p(fulldata[381:400, 1]) ~ log1p(fulldata[381:400, 
2]) + log1p(fulldata[381:400, 3]) + log1p(fulldata[381:400, 
4]) + log1p(fulldata[381:400, 8]), family = "poisson")

Deviance Residuals: 
Min      1Q  Median      3Q     Max  
-3.267  -2.082  -1.093   1.085   3.123  

Coefficients:
                        Estimate Std. Error z value Pr(>|z|)    
(Intercept)                 -17.5129     5.2594  -3.330 0.000869 ***
log1p(fulldata[381:400, 2])   1.3144     0.4632   2.838 0.004544 ** 
log1p(fulldata[381:400, 3])   0.7884     0.2384   3.307 0.000944 ***
log1p(fulldata[381:400, 4])  -0.1477     0.2613  -0.565 0.571836    
log1p(fulldata[381:400, 8])  -0.7765     0.2960  -2.623 0.008715 ** 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for poisson family taken to be 1)

Null deviance: 144.602  on 19  degrees of freedom
Residual deviance:  80.231  on 15  degrees of freedom
AIC: Inf

Number of Fisher Scoring iterations: 6

1 个答案:

答案 0 :(得分:0)

很难确定,因为你还没有充分明确这个模型,但看起来你需要简单地将log1p放在公式的左边;泊松glm默认情况下已经有一个日志链接功能(但你不需要加1,因为它是平均值,而不是转换为线性预测变量的数据)。

但你仍然需要在右边。