# Beta-diversity for data with zeros

Background
I am looking into enterotyping the gut microbiome data, obtained by shotgun sequencing. This essentially means performing the Principal Coordinates Analysis (PCoA/NMDS) of the beta-diversity matrix (distance matrix), based on the abundance table of species/gene-counts for all possible species/genes in all samples: for sample $$i$$ the counts of species/genes are $$\mathbf{x}_i=(x_{i1}, x_{i2},...,x_{im})$$. Such a table necessarily contains many zeros, whenever a species/gene is not present in a sample. Some of the possible beta-diversity measures are listed in table 1 of this article.

Problem
Statistically speaking, such data are considered to be an example of compositional data, i.e., the meaningful information is contained only in the ratios of the counts, which makes log-based distances the most suitable ones. These are used in many statistical methods (see, e.g., here). However, the log-transofmation is meaningful only when all the entries in the count table are strictly positive $$x_{ik}>0$$. One thus faces a problem of dealing with zero entries.

Possible solutions

• Using metrics not sensitive to zero entries (excluding alr, ilr and other similar log-transformations, highly recommended by statisticians - this limits the choice of statistical methods)
• Imputation of zeros: this requires a principled/biologically-sound way of imputing the zeros, since the results may be potentially very sensitive to this choice.

Question
What are the commonly used imputation methods? What is their advantages/disadvantages and justification for their use?

Some references

• An appropriate way to handle this is with a so-called zero-inflated model: paul-buerkner.github.io/brms/articles/…. Commented May 20, 2021 at 6:24
• I'll often use the pseudocount method for exploratory analyses. Basically just apply a pseudocount of 1 to every count in the table (since Log(1) = 0), so the action you actually end up performing is Log(x+1). Commented May 20, 2021 at 15:52
• @MikeyC Pseudocount is what I meant by "imputation of zeros": it is certainly a good method when one is interested only in the most abundant species (those that have counts), but I see how it may create problems when detecting low abandance species is important. Commented May 26, 2021 at 9:46
• Correct, you still keep them in the sample. The model estimates parameter values for a separate process leading to ratios at zero and parameter values for a separate process leading to values $\in (0, 1)$. A great introduction to similar models can be found in McElreath's Statistical Rethinking book (slides, lecture 13). Commented May 26, 2021 at 11:46
• I'll also point out that most of the suggestions here focus on what to do about zeros, but don't consider compositionality. You'd ideally want a solution that considered (1) presence of zeros (via inflation or just low means), (2) discrete nature of data (i.e., potentially higher sampling variance at low densities) and (3) compositionality. This example uses Dirichlet-multinomial mixtures, but then reverts to Bray-Curtis-based PCoA for ordination. Commented Jun 22, 2023 at 1:51