# Chi-square/G-test/Fisher exact with replicates

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.

• 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"? Aug 2, 2018 at 19:38
• @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) Aug 7, 2018 at 19:51
• Dec 18, 2020 at 18:22