I am trying to run a binomial GLM but have some zero cell counts resulting in estimates of +/- infinity. In the text book "An Introduction to Categorical Data Analysis" Agresti A. (1996) it suggests to add a small constant to the zero cells - which I also came across in the more accessible paper here.

However, when I try this in R I get a warning message of:

non-integer counts in a binomial glm!.


  1. I'm not sure if this is the right thing to do?
  2. Is there a better way to deal with zero cell counts?


mod2<-glm(cbind(Dead,Alive)~A*B*C, family=binomial)
  • $\begingroup$ This doesn't help with the zero cell-count problem but I noticed that you create the object gaf but never use it anywhere in the code; the glm call only looks at the vectors Dead and Alive etc, rather than the data.frame where you collected them together. $\endgroup$ – Sycorax says Reinstate Monica Sep 12 '13 at 12:53
  • $\begingroup$ Thanks - I used it later but forgot to remove it for this question $\endgroup$ – user29689 Sep 12 '13 at 12:59

I think the confusion is stemming from the fact that in a binomial glm formula the mean proportion of deaths cannot be zero. It's ok for some of your observed proportions of deaths to be zero. The fitting procedure isn't simply taking the log of Dead/Alive, it's finding the maximum likelihood estimates for the following model: \begin{eqnarray} Y_i &\sim& Bin\left( m_i, \mu_i \right), ~~~~\text{for}~~ i=1,...,n, \\ \log\frac{\mu_i}{1-\mu_i} &=& \beta_0 + \beta_1 A_i + \beta_2 B_i + \beta_3 C_i. \end{eqnarray} I know your A, B and C covariates are actually factors but the story is the same. If your observed response $y_i$ is zero, your modelling assumption is that the probability of death $\mu_i$ in this case is probably very low, so that in a random sample of $m_i$ observations you may well see no deaths (which is in fact what you've observed here).

Hope that helps.

  • $\begingroup$ I'm not sure I fully understand - because it seems to contradict what I have read in the previous references which indicate the observed proportions of deaths cannot be zero. I first notice the problem when I tried to calculate the CIs for the proportions and the CIs for the 0 deaths groups spanned from 0-100%. $\endgroup$ – user29689 Sep 12 '13 at 13:50
  • $\begingroup$ I'm not sure what references you've been looking at. How about this from Prof. Brian Ripley at Oxford: r.789695.n4.nabble.com/… $\endgroup$ – Sam Livingstone Sep 12 '13 at 14:02
  • $\begingroup$ He references the text book 'Modern Applied Statistics with S' 4th edition. $\endgroup$ – Sam Livingstone Sep 12 '13 at 14:04
  • $\begingroup$ Do you mean intervals for each $\mu_i$? How are you calculating them? $\endgroup$ – Sam Livingstone Sep 12 '13 at 14:08
  • $\begingroup$ Thanks, I'll try and get hold of it. The references I was referring to are in my original post - including a text book example. Also the following link explains the problem rfd.uoregon.edu/files/rfd/StatisticalResources/lgst_zero.txt - Sorry I don't wan't this to sound rude, it is just difficult to know what to do when there is seemingly conflicting information (it could be me misunderstanding of course) $\endgroup$ – user29689 Sep 12 '13 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.