【发布时间】:2020-06-12 08:29:14
【问题描述】:
我用 glmTMB 制作了一个零膨胀负二项式模型,如下所示
M2<- glmmTMB(psychological100~ (1|ID) + time*MNM01, data=mnmlong,
ziformula=~ (1|ID) + time*MNM01, family=nbinom2())
summary(M2)
这是输出
Family: nbinom2 ( log )
Formula: psychological100 ~ (1 | ID) + time * MNM01
Zero inflation: ~(1 | ID) + time * MNM01
Data: mnmlong
AIC BIC logLik deviance df.resid
3507.0 3557.5 -1742.5 3485.0 714
Random effects:
Conditional model:
Groups Name Variance Std.Dev.
ID (Intercept) 0.2862 0.535
Number of obs: 725, groups: ID, 337
Zero-inflation model:
Groups Name Variance Std.Dev.
ID (Intercept) 0.5403 0.7351
Number of obs: 725, groups: ID, 337
Overdispersion parameter for nbinom2 family (): 3.14
Conditional model:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.89772 0.09213 31.451 < 2e-16 ***
time -0.08724 0.01796 -4.858 1.18e-06 ***
MNM01 0.02094 0.12433 0.168 0.866
time:MNM01 -0.01193 0.02420 -0.493 0.622
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Zero-inflation model:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.29940 0.17298 -1.731 0.083478 .
time 0.12204 0.03338 3.656 0.000256 ***
MNM01 0.06771 0.24217 0.280 0.779790
time:MNM01 -0.02821 0.04462 -0.632 0.527282
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
想知道模型的R平方,尝试了以下2种方法都没有成功
MuMIn::r.squaredGLMM(M2)
r.squaredGLMM.glmmTMB(M2) 中的错误:r.squaredGLMM 不能(还) 以零通货膨胀处理“glmmTMB”对象
performance::r2_zeroinflated(M2)
residuals.glmmTMB(model, type = "pearson") 中的错误:pearson 零通胀或零通胀模型不实施残差 可变色散
你有什么建议?
【问题讨论】:
-
我觉得挺复杂的。你试过
r2_nakagawa()吗?但我会先阅读它的含义。试试besjournals.onlinelibrary.wiley.com/doi/full/10.1111/… 和tandfonline.com/doi/abs/10.1080/… -
正如 Dylan 建议的那样,
performance::r2_nakagawa()(或简称为performance::r2())应该可以工作。 -
这些模型是通过最大似然推导出来的,而 rsquare 根本不存在。您可以尝试类似伪 r 平方的方法,但请注意其解释。 stats.idre.ucla.edu/other/mult-pkg/faq/general/…
标签: r glm mixed-models variance model-fitting