0

I am trying to derive error bars for my data, which is proportional(Dead/Alive) and analysed with a binomial GLM. So far I have tried using the predict() function in R but in the treatment groups where there is either no deaths or 100% deaths the error bars are very large (essentially covering 0%-100%). Is there something wrong with my code? Or is there an easier way of calculating CIs or standard error bars?

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) 
user29689
  • 15
  • 2
  • You have a saturated model and complete separation. When you have treatment groups with 100% Dead you are in essence estimating the SE around infinity as an estimate for the true odds ratio. (A logistic regression coefficient of 26 is effectively an odds ratio of infinity, so there's nothing wrong with your code.) – IRTFM Sep 02 '13 at 16:17
  • OK thanks, but surely this is a common problem? There are many studies of a similar type that have 100% mortality and they have error bars. Prop.test() will give me an CI with 100% deaths, but this doesn't take account of the rest of the data – user29689 Sep 02 '13 at 16:28
  • Oh, it's a common problem all right. But you specified a particular model and you did not cite any of these "many studies that have 100% mortality that have error bars". If you allowed a wider range of model, you could have gotten narrower error bars. This may need to be transferred to CrossValidated.com where you can get statistical advice. – IRTFM Sep 02 '13 at 16:32
  • I agree with the ones above, you cannot make sensible comparisons without context with either 0 or 100% in this kind of model. – PascalVKooten Sep 02 '13 at 20:47

0 Answers0