# Statistical test for comparing overall preference of 3 groups based on count data

I am struggling to find any examples online of a data structure and appropriate statistical test which matches my data.

My dataset has counts of the number of courtships events of individual males towards different species of female. My hypothesis to test is that overall the males courted more towards the females of their own species.

I have looked at GLMs with poisson/negative binomial distributions, but this doesn't seem appropriate as I have 3 response variables which I want to compare. I want the model to take into account the differences in the overall number of courtship counts of individual males (which I think rules out Chi-square).

This is what my data looks like:

Does anyone have any ideas with this? And perhaps any links/descriptions of how you would go through the analysis on R?

• In the data you show, are all 6 males of species b? – BruceET Jul 12 at 5:47

Disclaimer: This answer is quite speculative because I don't exactly understand your experimental procedure or your data. And, after a (short) wait, I don't yet have an answer to my question. If the answer is No, if you think I am using your data improperly, or if you don't understand my analysis, please leave a comment. At least, maybe we'll have a framework for clarification, so we can start again.

If all six males are from Species b, then we could treat this as a block design and do a Friedman test. The 'main effect' is Species with three levels; the block effect is Males. It is assumed that Males may react differently, and the Friedman test does not test for differences among Males. (An analogous situation is that six judges taste three varieties of wine and give scores to each. In this case 'scores' are numbers of courtship events.)

Here are results from a Friedman test:

a = c(4,5,0,8,5,13)
b = c(33,17,1,63,14,14)
c = c(5,1,0,7,6,14)
DTA=cbind(a,b,c)
friedman.test(DTA)

Friedman rank sum test

data:  DTA
Friedman chi-squared = 8.4545, df = 2, p-value = 0.01459


So taken as a group, the males have a pattern of consistent preferences among species. You don't have much data--barely enough to get significant results from such a rank-based test. Also two of the males stand out as very different: #3 is remarkably non-frisky, and #6 is remarkably non-discriminatory. So the small P-value indicating a clear difference in preference is surprising.

By eye it seems that most of the males have some preference for species b. A Wilcoxon signed rank (paired) tests find significant preferences of b over a and also of b over c. In both cases there are cautionary notes about ties or 0's, so P-values are probably not exact. (In comparing b against a there are two differences of $$1$$; in comparing b against c, there is a difference of 0.) The difference between b and a is stronger.

wilcox.test(b-c, alte="g")$p.val [1] 0.02952911 Warning message: In wilcox.test.default(b - c, alte = "g") : cannot compute exact p-value with zeroes wilcox.test(b-a, alte="g")$p.val
[1] 0.01776117
Warning message:
In wilcox.test.default(b - a, alte = "g") :
cannot compute exact p-value with ties


In doing such ad hoc tests there is some danger of 'false discovery', and I judge the difference between b and c to be only borderline significant (only 5 out of 6 males showed a difference, and one of them only barely).

• Thank you very much for this! - I think that answers my question. The males are all from species b. During the experiment, the 6 males were kept to freely interact with an equal number of females from each species, and the number of courtship events with each species was counted over a set time period. I assume this design does not invalidate any of the assumptions of the tests? – VRWizard Jul 12 at 8:12
• Thanks for additional info. Should be OK. I suspected something like that design. – BruceET Jul 12 at 8:20