Comparing counts

Published

December 6, 2024

Description of problem

  • Two random variables X1 and X2 with realiziations x1 and x2, each following a Poisson distribution with rates λ1 and λ2
  • Null hypothesis: λ1=λ2

Approximate, naive test

We can construct an approximate, pragmatic statistical test. The test statistic k=x2x1 follows approximately (asymptotically with growing λ1 and λ2) a normal distribution with μ=0 and σ=x1+x2.

x_1 <- 1500
x_2 <- 1600
k <- x_1 - x_2
sigma <- sqrt(x_1 + x_2)
(p_value <- 2 * pnorm(k, mean = 0, sd = sigma))
[1] 0.07248609

Exact test

R offers an exact test.

poisson.test(c(x_1, x_2))

    Comparison of Poisson rates

data:  c(x_1, x_2) time base: 1
count1 = 1500, expected count1 = 1550, p-value = 0.07537
alternative hypothesis: true rate ratio is not equal to 1
95 percent confidence interval:
 0.8731506 1.0065506
sample estimates:
rate ratio 
    0.9375 

Conclusion

It may be surprising – but measurement of two counts for different conditions can be enough in order to test for equality of event rates.