![](/img/trans.png)
[英]How do i Interpret the coefficients of glm with binomial error distribution?
[英]How do I fit a GLM using Binomial Distribution for this data in R?
一种合适的方式是:
vaccine <- c(rep(c(0,1,2),c(12,4,8)),rep(c(0,1,2),c(175,61,340)))
cough <- c(rep(1,12+4+8),rep(0,175+61+340))
然后,您可以执行以下操作:
linfit <- glm(cough~vaccine,family=binomial)
summary(linfit)
要么
factorfit <- glm(cough~as.factor(vaccine),family=binomial)
summary(factorfit)
要么
ordfactorfit <- glm(cough~ordered(vaccine),family=binomial)
summary(ordfactorfit)
或其他可能性,具体取决于您的特定假设。
这不是做到这一点的唯一方法(并且您可能不希望使用非常大的数据集来做到这一点),但是以这种方式“放松”会使某些事情变得容易。 您可以轻松地table(data.frame(cough=cough,vaccine=vaccine))
( table(data.frame(cough=cough,vaccine=vaccine))
)。
您可能还会发现对卡方的签名根贡献:
t=table(data.frame(cough=cough,vaccine=vaccine))
r=rowSums(t)
c=colSums(t)
ex=outer(r,c)/sum(t)
print((t-ex)/sqrt(ex),d=3)
vaccine
cough 0 1 2
0 -0.337 -0.177 0.324
1 1.653 0.868 -1.587
这些解释有点类似于标准化残差。
比例的曲线No
对阵疫苗(有说$ \\ $下午在标记1个标准误差)将同样有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.