Solved – Chi-square/G-test/Fisher exact with replicates

chi-squared-testfishers-exact-testhypothesis testing

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.

Best Answer

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.