如何解决如何获得我的二项式回归是否与 R 中的空模型显着不同的 p 值?
我有一个人口统计数据集 demos_mn
和一个结果变量。有 5 个感兴趣的变量,所以我的 glm 和 null 模型看起来像这样:
# binomial model
res.binom <- glm(var.bool ~ var1 + var2*var3 + var4 + var5,data = demos_mn,family = "binomial")
# null model
res.null <- glm(var.bool ~ 1,family = "binomial")
# calculate marginal R2
print(r.squaredGLMM(res.binom))
# show p value
print(anova(res.null,res.binom))
这是我的 glm 混合模型的工作流程,但对于我的二项式模型,我没有获得仅针对预测变量的整体模型的 p 值。我希望有人能启发我吗?
我使用 glmer
作为模型的重复测量版本确实取得了一些成功,但不幸的是,这意味着我必须摆脱一些未重复测量的关键变量。
解决方法
也许你忘记了 test="Chisq"
?来自?anova.glm
:
test:一个字符串,(部分)匹配“Chisq”之一, “LRT”、“Rao”、“F”或“Cp”。请参阅“stat.anova”。
example("glm") ## to set up / fit the glm.D93 model
null <- update(glm.D93,. ~ 1)
anova(glm.D93,null,test="Chisq")
Analysis of Deviance Table
Model 1: counts ~ outcome + treatment
Model 2: counts ~ 1
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 4 5.1291
2 8 10.5814 -4 -5.4523 0.244
test="Chisq"
命名不当:它是一个似然比检验,注意它是一个渐近检验[依赖于大样本量]。对于具有可调尺度参数(高斯、伽玛、准似然)的 GLM,您将使用 test="F"
。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。