【发布时间】:2020-10-05 16:55:44
【问题描述】:
我正在尝试将我的数据拟合到零膨胀负二项式模型,但是当计算 SE 时,我的 3 个自变量(曝光)之一似乎导致产生 NaN(请参阅 zeroinfl 调用的最后)在汇总功能中。我也尝试过运行负二项式障碍模型并且遇到了类似的问题。
str(eggTreat)
'data.frame': 455 obs. of 4 variables:
$ Exposure : Factor w/ 2 levels "C","E": 2 2 2 2 2 2 2 2 2 2 ...
$ hi_lo : Factor w/ 2 levels "hi","lo": 2 2 2 2 2 2 2 2 2 2 ...
$ Egg_count: int 0 0 0 0 0 0 0 0 0 0 ...
$ Food : Factor w/ 2 levels "1.5A5YS","5ASMQ": 2 2 2 2 2 2 2 2 2 2 ...
mod.zeroinfl <- zeroinfl(Egg_count ~ Food+Exposure+hi_lo | Food+Exposure+hi_lo, data=eggTreat,
+ dist="negbin")
> summary(mod.zeroinfl)
Call:
zeroinfl(formula = Egg_count ~ Food + Exposure + hi_lo | Food + Exposure + hi_lo, data = eggTreat, dist = "negbin")
Pearson residuals:
Min 1Q Median 3Q Max
-0.65632 -0.47163 -0.28588 0.02976 9.00804
Count model coefficients (negbin with log link):
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.04435 0.14393 -0.308 0.7580
Food -1.12486 0.22267 -5.052 4.38e-07 ***
Exposure -2.34990 0.38684 -6.075 1.24e-09 ***
hi_lo -0.44893 0.19524 -2.299 0.0215 *
Log(theta) -0.24387 0.22639 -1.077 0.2814
Zero-inflation model coefficients (binomial with logit link):
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.830e+01 NA NA NA
Food -5.768e+00 5.628e+04 0 1
Exposure 4.612e-01 NA NA NA
hi_lo -7.477e+00 9.963e+05 0 1
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Theta = 0.7836
Number of iterations in BFGS optimization: 21
Log-likelihood: -350.2 on 9 Df
Warning message:
In sqrt(diag(object$vcov)) : NaNs produced
function (object, ...)
{
object$residuals <- residuals(object, type = "pearson")
kc <- length(object$coefficients$count)
kz <- length(object$coefficients$zero)
se <- sqrt(diag(object$vcov))
【问题讨论】:
标签: r nan distribution