r - 没有线性预测器的泊松 GLM 模型
问题描述
我正在尝试在 R 中运行代码(我对此很陌生),并且我得到了一个非常大的数据集,我需要使用它来拟合泊松 glm,例如 log(mu) = B0 +B1x1。设 Yi 为对象 i 的响应计数,xi = 1(黑色)和 xi = 0(白色)。
该数据集可在 www.stat.ufl.edu/~aa/glm/data 找到。
我加载了数据,但我很难理解这个模型。这是我到目前为止的代码,但显然我遗漏了一些东西。
str(hdata)
head(hdata)
attach(hdata)
hfit = glm(count ~ factor(race), family = poisson(link = log))
summary(hfit)
#plot the model
par(mfrow = c(2,2))
plot(hfit)
#overdispersion test
library(AER)
dispersiontest(hfit, trafo =1)
#goodness of fit test
sum(resid(hfit, type="pearson")^2)
#pvalue
1 - pchisq(2279.873, 1306)
我需要这个模型的帮助,因为我似乎无法区分每场比赛,我认为这就是我需要做的。当我运行 hfit 的摘要时,我最终得到 -2.38 作为截距,1.73 作为 factor(race)1。AIC 为 1122。此外,当我进行过度分散测试时,我得到 c = 0.743,如果模型具有等分散性,则 c = 0。我说的对吗?谢谢
解决方案
推荐阅读
- json - 发生异常,字符 1 处出现意外字符
- python - 如果我有重复的日期,如何用 pandas 中两个日期之间计算的值填充一列?
- python-requests - 如何在绝对链接-for 循环 (requests_html) 中获取项目的 URL
- c# - 为什么 Unity 给了我这么多“找不到类型或命名空间名称'X'(您是否缺少 using 指令或程序集引用?)”
- c# - WPF StackPanel 性能
- sql - 以特定方式对列值进行排序
- python - 获取 a 标签的 href
- c# - Newtonsoft JToken 的列表框显示值
- office-interop - 正确/可靠地替换 MS Word 互操作
- razor - 如何使 2sxc 应用程序 URL 显示在 DNN 的 Sitemap.aspx 中?