I want to use Fisher exact or G-test/Chi-squared (the choice depends on the numbers of observations in a particular case) to test difference in species frequencies between and within replicated groups of observations. Here are some toy-data

    1.1 1.2 1.3 2.1 2.2 2.3
spec1   1   2   1   3   5   4
spec2   4   4   6   0   1   1
spec3   10  12  9   9   10  10

The first row denotes samples. The first digit of a sample ID represents a replicated group and the second one represents a replicate. Here is an example of the dataset collapsed for the first species.

spec1   1   2   1   3   5   4
others  14  16  15  9   11  11

It's easy to compare replicates within groups, because we can simply perform a bunch of pair-wise tests and apply some multiple-comparison p-value adjustment, but how do we treat replicates when we compare different groups? Can we just combine them into one sample?

I'm aware of this post, but it has no answers.

  • $\begingroup$ I'm not sure I understand your question :/ Can you try and rephrase? For example, in the sentence "Can we just combine them into one sample?", what is "them" referring to? "replicates" or "groups"? $\endgroup$
    – winni2k
    Aug 2, 2018 at 19:38
  • $\begingroup$ @winni2k Excuse me for a delayed response. Yes, the question is about handling replicates in a chi-square-like test. Regarding your question: "them" refers to "replicates". Since chi-square is a goodness of fit test, by "merging" I've implied estimating a single discrete distribution given a group of samples (i.e. replicates) drawn from that distribution (in this particular case, the later can be approximated by a multinomial distribution or a Dirichlet-multinomial) $\endgroup$ Aug 7, 2018 at 19:51
  • $\begingroup$ See stats.stackexchange.com/questions/169142/… $\endgroup$ Dec 18, 2020 at 18:22

1 Answer 1


Testing species frequencies

I understand the OP's first question to be "Are the proportions of species 1, 2, and 3 identical across all six columns?" I think a chi-square test of independence of rows and columns would be applicable if the cell counts are sufficiently high (that's a whole other topic).

When can count data be combined?

My reading on this topic suggests that one can combine count data if one can show that the data (replicates) are homogeneous. Zar [1] describes combining multiple tests of goodness of fit (section 22.6) or multiple 2x2 contingency tables (section 23.4) through a heterogeneity chi-square. This test is performed by calculating the chi-square statistics for each replicate separately, and then comparing the sum of those chi-square statistics to the chi-square statistic one derives from pooling the data. Zar describes the steps in detail and this page does so as well.

[1]: Jerold H. Zar. 1999. Biostatistical Analysis, 4th edition.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.