二项式glm误差棒

时间:2013-09-02 16:10:22

标签: r glm predict

我正在尝试为我的数据导出误差条,这是成比例的(死/活)并使用二项式GLM进行分析。到目前为止,我已尝试在R中使用predict()函数,但在没有死亡或100%死亡的治疗组中,误差条非常大(基本上覆盖0%-100%)。我的代码有问题吗?或者是否有更简单的方法来计算CI或标准误差条?

A<-c(10,10,10,10,10,10,19,19,19,19,19,19)
B<-c("0","1","2","0","1","2","0","1","2","0","1","2")
C<-c("-ve","-ve","-ve","+ve","+ve","+ve","-ve","-ve","-ve","+ve","+ve","+ve")
Dead<-c(1,1,27,0,6,18,2,10,23,0,14,21)
Alive<-c(29,32,2,22,19,4,28,22,3,20,11,0)
Total<-Dead+Alive
gaf<-data.frame(A,B,C,Dead,Alive,Total)

mod2<-glm(cbind(Dead,Alive)~A*B*C, family=binomial)

p<-predict(mod2,newdata=gaf,se.fit=TRUE)
up<-with(p,fit+se.fit)
low<-with(p,fit-se.fit)
invLink<-family(mod2)$linkinv
av2<-with(p,invLink(fit))
upr<-invLink(up)
lwr<-invLink(low) 

0 个答案:

没有答案