# What test do I use for comparing count data for significant differences between two groups of different sizes?

I need to compare count totals between two groups that are of unequal sizes. For example see table:

Total injuries includes back/neck injuries. I am looking to see if the back/neck injuries are significantly higher in one occupation, given the different injury totals and if possible, factoring in number of injury areas. The n is too low for Chi and Mann Whitney U test from what I understand. Any suggestions would be greatly appreciated. Thank you very much!

• Hi do you mind slightly formatting the table a bit, it is hard to read.. and also explain whether the back/neck is a subset of total injuries.. Apr 13, 2020 at 19:01
• Formatted table by removing some unnecessary spaces and putting 4 spaces at the start of each line to get 'code' format mode. // But headers still need explanation, as requested by @StupidWolf. Apr 13, 2020 at 19:27

Data. If, as @StupidWolf suggests, 'Back and Neck' injuries are a category of injuries, so that the rest of 'Total Injuries' can be considered as a complementary category, then your data table looks like this:

Inj Type \ Occup     CyO     HTO      TOTAL
-------------------------------------------
Back/Neck              1      34         35
Other                  3     216        219
-------------------------------------------
TOTAL                  4     250        254


Chi-squared test of independence. Then, supposing that there were 254 randomly chosen injuries altogether, such a table might potentially be analyzed using a chi-squared test of independence. We enter the data into a matrix in R, and check totals for validity.

DTA = matrix(c(1,34, 3,216), byrow=T, nrow=2); DTA
[,1] [,2]
[1,]    1   34
[2,]    3  216
rowSums(DTA); colSums(DTA);  sum(DTA)
[1]  35 219
[1]   4 250
[1] 254


However, as you say, a chi-squared test is not valid because the expected number of counts in one of the four cells is far below 5, required for the chi-squared statistic to have approximately an chi-squared distribution.

Fisher Exact Test. By contrast, Fisher's Exact Test (as implemented in R) is valid. However, it does not find significance of association between Occupation and Injury Type variables.

fisher.test(DTA)

Fisher's Exact Test for Count Data

data:  DTA
p-value = 0.4495
alternative hypothesis: true odds ratio is not equal to 1


Notes: (1) If the 1:3 ratio of Back/Neck injuries to Other injuries were to hold up with a larger number of subjects in the CyO occupational category, then you'd find significance. Consider the fake data table below. P-values are shown below for both Fisher and chi-square tests:

DTA.2 = matrix(c(15,34, 45,216), byrow=T, nrow=2); DTA.2
[,1] [,2]
[1,]   15   34
[2,]   45  216
fisher.test(DTA.2)$$p.val [1] 0.04669228 chisq.test(DTA.2)$$p.val
[1] 0.04807218


(2) You have enough data for HTO to make a reasonable 95% confidence interval for the proportion of HTO total injuries that are back/neck injuries. The point estimate is $$\hat p = 34/250 = 0.126$$ one of several kinds of 95% confidence intervals for $$p$$ is the Jeffries Interval $$(0.098, 0.183),$$ based on a Bayesian method. But for CyO you don't have enough data to make a useful interval estimate.

qbeta(c(.025,.975), 34.5, 216.5)
[1] 0.09777243 0.18259443

• Thank you! This is great! Apr 13, 2020 at 20:45