# Testing if the difference between two count variables is different from zero

I have two count variables for several hundred thousand comparisons, one expected and one observed, and I would like to test if the counts are significantly different.

One possible approach I have looked into is simply subtracting the expected from the observed count for each row and then build a 95% CI and see if 0 is within this range. However, I am unsure if this is the best method and I am wondering if there is something more appropriate for performing such an analysis?

I have also checked into using a GLM for count data to estimate a slope and see if it is equal to 1. However, I have not seen any examples of this being used with count predictor variables, save someone else asking about it here: Does using count data as independent variable violate any of GLM assumptions? From this it appears like it would be okay, if certain things are taken into account. But, does this overcomplicate something as simple "is the difference between observed and expected different from zero?".

• Looks difficult; the difference is Skellam distributed but there is no standard GLM for such distributions. en.wikipedia.org/wiki/Skellam_distribution You may try t-test which is reasonably robust in large samples. Apr 27, 2015 at 15:36
• @tomka I think there is a misunderstanding stemming from my wording in the last sentence of GLM part of my question. I meant to use the expected count variable as the predictor for the observed counts using an appropriate model for count data (such as zero-inflated poisson), not the difference between the two, which as you mention would be Skellam distributed. Does this change anything? Apr 27, 2015 at 22:03
• Are you in fact saying you have just one observed count & want to compare its distribution to one expected from theory? Dec 15, 2015 at 17:47
• @Scortchi I have thousands of counts from two parents and one offspring. We expect the offspring to have the additive value of the parents. This is what I mean for the expectation. We expect that the value of the counts for the offspring should fall on a one-to-one line if we plot the sum of the parents against the offspring and I wanted to see if there was a test for deviation from the line. Dec 16, 2015 at 22:13