# Testing significance between samples with all zeroes in one

I have Count data with zeros, and I'd like to use a poisson GLM (or similar) to compare two groups. One group has all zeros, the other is count data ranging from 0-15.

Since one group has all zeros – I cant test it because variance is 0, but it seems obvious that the group which has regular presence is 'significantly different' to group which has no presence ever (If we assume that a 0 means not present rather than not sampled).

Apologies if the first line of code is not elegant - still learning..

dat = data.frame(x = rep(c("a","a","a","a","a","b","b","b","b","b"), times = 20), y = rep(c(0,0,0,0,0,7,3,0,1,4), times = 20))
fit = glm(y ~ x, dat, family = "poisson")
summary(fit)


The results show p ~ 1

If I even add one value to group a, it becomes testable and highly significant.

dat$y[1] = 2 fit = glm(y ~ x, dat, family = "poisson") summary(fit)  p< 0.000 How can i show statistically that my two ORIGINAL groups are significantly different? I know that zero-inflation models help where there are many zeroes, but I dont think it helps me here. ## 2 Answers In cases where the distribution is strange, I find it helpful to think in terms of permutation tests. In your case, the null hypothesis is that the mean difference is equal to zero. By repeatedly sampling with replacement from your two groups, and calculating the difference between them you generate a distribution of differences between the two groups. If 95% of this distribution is greater than or lesser than 0, it indicates that your groups are significantly different. Here is some code illustrating your example: dat = data.frame(x = rep(c("a","a","a","a","a","b","b","b","b","b"), times = 20), y = rep(c(0,0,0,0,0,7,3,0,1,4), times = 20)) xs <- dat$y[dat$x =='a'] ys <- dat$y[dat\$x =='b']

perm <- function(x, y) {
newx <- sample(x, replace = TRUE)
newy <- sample(y, replace = TRUE)
mean(newy) - mean(newx)
}

hist(replicate(10000, perm(xs, ys)), xlim = c(0, 5), main = '')
abline(v = 0, col = 'red', lwd = 2)


The red line indicates the expectation based on the null hypothesis i.e. that the difference in means is zero.

Since you have only zeroes for one group, even with 10k resamples the entire distribution is well above it i.e. p<0.0001. This approach is very flexible and doesn't need to be reserved for the case where one group has zero variance; it works for pretty much any distribution you care to throw at it.

With such extreme data values, any standard test such as t-test or Wilcoxon rank sum test will yield a significant result.

An exact Poisson test may be an other option if you want to stay in the same framework.