I have 4 groups (G1, G2, G3, G4) consisting of samples of biological material, and we test them in order to identify are there any bacteria present. We also know that all of the samples contain virus X. So the idea is to see is there at least one bacteria present (coinfection) in a sample, and then to test whether the coinfection rate/proportions differ among groups. The data can be represented as:

Factor Group 1 Group 2 Group 3 Group 4
Bacteria A (number of samples for which pCR test was positive) 10 0 3 2
Bacteria B (number of samples for which pCR test was positive) 4 2 2 4
Bacteria C (number of samples for which pCR test was positive) 4 2 2 4
Bacteria D (number of samples for which pCR test was positive) 1 8 0 0
Coinfection (total number of samples with at least one bacteria present) 15 9 6 3
No Coinfection (only virus X present) 5 15-9 45-6 24-3
Total Sample 20 15 45 24

So I want to test the difference in proportions for each bacteria among G1 and G3, G1 and G4, G2 and G3, G2 and G4, G1 and G2. I did Fisher exact test by creating a 2*2 table for each Bacteria and two respective groups, for instance:

Factor Group 1 Group 2
Bacteria A 10 0
No Bacteria A 15-10 9-0

The question is: Is this an appropriate solution? how do i adjust for multiple comparisons? the vector of p-values which i get should include all the p-values for each combination i tested overall (G1 and G3, G1 and G4, G2 and G3, G2 and G4, G1 and G2), or just pairwisely (5 vectors of p-values to be adjusted)?

(Since bacteria can co-occur, the sum of elements does not add to total sample size, so i can not use pairwise_fisher_test, which includes adjustment)

Additional information: Subjects were tested for co-infection, so all of them have virus X+ either none (then subject is classified in 'no coinfection' group) or one or several of bacteria. Indeed, there are individuals who have 3 bacteria present at the same time, and that individual is added to the total count sum of each respective row. The idea is to test whether the proportions of bacterial infections differ among groups.

I am not sure what kind of test is possible in this regard, as there are many possible combinations of viruses that are exhibited in subjects, if we want to make the table disjoint. Theoretically, virus X can coexit with all the bacteria, so the idea of the proportion testing is whether certain kind of bacteria is more likely to be observed together in a particular group.

  • 1
    $\begingroup$ Welcome to Cross Validated! (1) What does "bacteria can co-occur" mean? Is it just that there is 1 bacterium in Group 1 that is neither A, B, C, nor D types, & so on for the other groups? (2) Are you sure it's reasonable to assume counts are independent? - that the 10 Bacteria A in Group 1 aren't progeny of a single spore in a Petri dish, for example. (3) Overall it's hard to give advice without knowing the experimental set-up - not just the data but how they were obtained is relevant to the statistical analysis $\endgroup$ Commented Mar 20 at 8:45
  • $\begingroup$ @Scortchi-ReinstateMonica thank you for the clarification, indeed there is overlap in counts. I am not sure what would be the other method applicable in this situation: the sample size is relatively small for proportion testing using z-statistic. i thought about a stratification of different combinations of bacteria to make table disjoint, but as there are 11 bacteria in total (i wrote 4 as an example), listing all possible combinations would be a tedious task, or is this a way to go? many thanks in advance! $\endgroup$ Commented Mar 20 at 9:22
  • $\begingroup$ So for each virus-infected subject you have the group to which he (uniquely) belongs, plus the observed presence or absence of four different types of bacteria? And do the groups distinguish different treatment regimes to which the subjects are randomly allocated? Or reflect other attributes the subjects are observed to have? Or ... ? $\endgroup$ Commented Mar 20 at 10:24
  • $\begingroup$ @Scortchi-ReinstateMonica not exactly, individual can be assigned to different categories. So say i have subject with ID '1', he is tested for the presence of 11 different bacteria, it is found that he has bacterea A, C,D . So he is added to the total count of each group . All samples are tested in such a way, so the numbers reflect total count of subjects infected with this particular bacteria type. So they are not disjoint. $\endgroup$ Commented Mar 20 at 11:52
  • $\begingroup$ @Scortchi-ReinstateMonica the samples contain biological material collected gtom four groups, which is tested, so there are no treatment or anything of that sort. Just counting number a particular bacteria present or not, and if yes in how many samples. And compare the proportion of each virus among groups, whether they differ. $\endgroup$ Commented Mar 20 at 11:56

1 Answer 1


The results that need to go into the MC adjustment depend on your content hypothesis, i.e. your research question. If you only have one "global" hypothesis whether there is a difference somewhere between any group for any bacterium, then all p-values need to be adjusted. You do not seem to be interested to compare bacteria within groups (such as, is Bacterium A more present than Bacterium B, in any group), so the other option might be to adjust WITHIN bacteria, in that case all p-values for a given Bacterium across groups need to enter correction. This is statistically more lenient and seem attractive for many people - however, when only a few come out significant, one might question the theoretical validity of the tests - this questioning is not something people do in general in the biomedical sciences, so you might get away with that, but it is not good practice (see here for more on multiple testing: http://daniellakens.blogspot.com/2016/02/why-you-dont-need-to-adjust-you-alpha.html and here: https://link.springer.com/article/10.1007/s11229-021-03276-4). Ultimately, this is something you have to decide based on the theory around and the aims of your study - one way of doing MC adjustment is not more correct than the other in general.

Aside from that, dependency between bacteria might be an issue for you - this is also something only you can know for your case, but let's say Bacteria A increases the probability for all other bacteria, then all comparisons for all bacteria except A are influenced by the A counts. In a hypothetial scenario you might end up with differences for all bacteria between two groups, but in reality it might just be driven by sampling variability of bacterium A, which is then not well captured by your statistical test + MC adjustment. In a data set of reasonable size you might be able to test the bacteria for independence (i.e. if bacteria are truly independent, you would see much more individuals with only few numbers of coinfections compared to many but if they are dependent, that can change) but I am afraid in your case the theory has to do the heavy lifting, if your case numbers are accurate.

That being said, I am not convinced that running so many individual tests is the way to go here. Did you look into (multivariate) beta regression yet?

Are you interested in combinations of bacteria as well? Because the last sentence in your question ("Theoretically, virus X can coexit with all the bacteria, so the idea of the proportion testing is whether certain kind of bacteria is more likely to be observed together in a particular group.") sounds like you are looking for a kind of dependency, but your analysis and your text before that do not really match that.

  • $\begingroup$ +1 It's not often that answers here deal with the whole inferential context of a question rather than just dealing with the statistical analysis. Good one! $\endgroup$ Commented Mar 20 at 19:57
  • $\begingroup$ @Finn thank you for such an answer, very appreciated!When trying to estimate proportion of any coinfection based on virus and group (proportion ~ virus +group), i get an output, but not sure of the validity (and interpretation), as the bacterium for which a significance is found has higher number of occurence in the data. Also, i can not include all the data as some bacteria are not identified at all (so proportion is zero), which are dropped before fitting.The main question here: do the groups significantly differ in composition of bacteria (eg. bact.D has higher prop. wrt other groups?). $\endgroup$ Commented Mar 21 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.