Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Zero Counts in Cell-Type Compositions

Differential Abundance and Compositional Effects · Tutorial 529 of 700

Zero Counts in Cell-Type Compositions

Learn when a zero cell-type count can be treated as a sampling zero, why it cannot enter a log-ratio directly, and how to assess zero-handling choices without mistaking them for observed evidence.

Advanced 11 min read

What You'll Learn

  • Distinguish finite-sampling zeros from structural absence using biological and sampling context.
  • Derive the probability of observing zero cells when a cell type has positive underlying proportion.
  • Explain why log-ratio coordinates are undefined when a component is zero.
  • Compare prior-based and multiplicative replacement with direct zero-aware analysis.
  • Use pseudocount sensitivity analysis to show how choices affect log-ratios.
  • Identify when a zero should not be replaced and when the data do not resolve its cause.

Why a Zero Needs Interpretation

A cell-type count of zero is an observation, not by itself an explanation. It may arise because a cell type is present in the population but was not sampled, or because that cell type is genuinely absent from the population being described. Those situations have different implications for inference. Treating every zero as a small positive count can conceal structural absence; treating every zero as proof of absence can overstate what finite sampling establishes.

This distinction matters especially for log-ratio analysis. A log-ratio compares the relative amounts of two components, but the logarithm of zero is undefined. Replacing zero with a small number makes a calculation possible, yet the resulting value depends on the replacement rule. The key is to decide what assumptions justify a replacement, and to report how sensitive conclusions are to that decision.

Definition: A sampling zero is an observed zero for a component whose underlying proportion is positive, caused by finite sampling. A structural zero represents genuine absence of that component in the population or condition being defined. A count table alone generally cannot establish which kind of zero occurred.

Sampling Zeros and Structural Absence

Suppose a sample contains \(N\) cells, and a particular cell type has underlying proportion \(p\). Under independent sampling with a fixed proportion \(p\), the count \(X\) for that type follows a binomial sampling model, \(X\sim \operatorname{Binomial}(N,p)\). Equivalently, under a multinomial model for all cell types, the marginal count for one type has this binomial distribution. If \(p>0\), the probability of observing no cells of that type is

$$ P(X=0\mid N,p)=(1-p)^N. $$

Thus, a zero is more plausible when the sample is small or the underlying proportion is low. This calculation is a sampling explanation, not proof that the type is present. Structural absence corresponds to \(p=0\) in the defined population, in which case \(P(X=0)=1\). In practice, uncertainty about the biological population, cell capture, classification, and sample processing can make the distinction difficult.

Before choosing a zero treatment, clarify the target composition: which cells were eligible to be sampled, what counts as the cell type, and whether the scientific setting makes its absence plausible. A zero observed after limited sampling is not automatically structural. Conversely, strong biological or design information that the type cannot occur in a condition should not be overridden by adding a small count.

Worked Example: How Often Could Sampling Produce a Zero?

Suppose, hypothetically, a cell type has underlying proportion \(p=0.0100\), and cells are sampled independently. Calculate the probability of observing no cells of that type in samples of \(N=100\) and \(N=500\).

The sampling-zero probability is \((1-p)^N\). For \(N=100\),

$$ P(X=0)=(1-0.0100)^{100}=0.99^{100}\approx 0.3660. $$

For \(N=500\),

$$ P(X=0)=0.99^{500}\approx 0.006570. $$

Under the stated model, observing zero is fairly common with 100 sampled cells, but much less common with 500. Neither probability tells us that this particular hypothetical cell type is truly present; the calculation shows why sample size is relevant when interpreting a zero. The independent-sampling assumption may also be an approximation if cells are clustered by donor or affected by capture and classification processes.

Why Log-Ratios Fail at Zero

A composition is a vector of nonnegative proportions that sum to one. For two positive components \(x_j\) and \(x_k\), their log-ratio is \(\log(x_j/x_k)\). The ratio is unchanged if both values are scaled by the same positive constant, which is why log-ratios describe relative composition rather than absolute cell numbers. But if \(x_j=0\) and \(x_k>0\), then \(x_j/x_k=0\) and \(\log(0)\) is not a finite real number. If both are zero, their ratio is itself undefined.

Consequently, log-ratio coordinates and balances require positive components as ordinarily defined. A zero cannot simply be passed to the logarithm. Any analysis that replaces it has added an assumption about a positive value that was not observed. The choice can substantially affect the coordinate, particularly when the observed count is small.

Key distinction: A replacement value is a device for an analysis under a stated assumption; it is not an observed cell count. If a component is structurally absent, a finite log-ratio involving that component is not defined for that composition. A pseudocount does not turn the absence into measured presence.

Worked Example: Pseudocounts Can Change a Log-Ratio

Consider a hypothetical sample with counts \((0,20,80)\), so \(N=100\). Compare the log-ratio of the first component to the second after adding the same pseudocount \(c\) to each count. The resulting ratio is \((0+c)/(20+c)\); the common total used to convert counts to proportions cancels.

With \(c=0.5\),

$$ \log\left(\frac{0.5}{20.5}\right) =\log\left(\frac{1}{41}\right) \approx -3.714. $$

With \(c=1\),

$$ \log\left(\frac{1}{21}\right)\approx -3.045. $$

With \(c=2\),

$$ \log\left(\frac{2}{22}\right) =\log\left(\frac{1}{11}\right) \approx -2.398. $$

The observed counts have not changed, yet the calculated log-ratio moves by more than one log unit across these choices. This is not evidence that one replacement is correct. It shows that the zero treatment is consequential and must be justified and examined, rather than hidden as routine preprocessing.

Principled Ways to Handle Zeros

There is no universal replacement that is appropriate for every zero. The method should match the interpretation of the zero and the inferential target. Three broad approaches are useful to distinguish.

ApproachWhat it assumes or doesMain caution
Zero-aware count or probability modelUses the observed zero directly under a sampling model, without requiring a log of zero.Model assumptions must describe the sampling and, if relevant, the possibility of structural absence.
Prior-based replacementUses an explicit prior for positive proportions; observed zeros update that prior rather than being treated as measured small counts.Results depend on the prior and on the assumption that the component has positive probability.
Multiplicative replacementAssigns a chosen small positive amount to each zero and rescales positive components to preserve the total.The replacement threshold is an assumption; log-ratios can depend on it.

A zero-aware analysis can be preferable when the sampling model is appropriate because it need not manufacture positive observations just to use a logarithm. The exact model and its assumptions matter; this tutorial does not prescribe one model for every design. Prior-based replacement is a coherent option when the analyst can defend a prior and a sampling-zero interpretation. For example, under a multinomial sampling model with a Dirichlet prior having positive parameters, the posterior distribution remains on positive proportions. This does not represent structural absence: the prior assigns probability zero to an exactly absent component.

Multiplicative replacement is a compositional transformation: it assigns a small value to the zero component or components and scales the observed positive components proportionally so the composition still sums to one. It preserves ratios among the originally positive components, but it does not make the assigned zero value data-derived. It can be useful for a specified sensitivity analysis, provided the chosen amount and its effect are reported.

Worked Example: A Prior Makes the Replacement Assumption Explicit

For the hypothetical counts \((0,20,80)\), suppose the sampling-zero interpretation is adopted and a symmetric Dirichlet prior with parameter \(0.5\) is assigned to each of the three cell-type proportions. Under a multinomial likelihood, the posterior parameters are the observed counts plus the prior parameters:

$$ (0.5,\ 20.5,\ 80.5), \qquad 0.5+20.5+80.5=101.5. $$

The posterior mean composition is therefore

$$ \left(\frac{0.5}{101.5},\frac{20.5}{101.5},\frac{80.5}{101.5}\right) \approx (0.004926,\ 0.2020,\ 0.7931). $$

The log-ratio of the first posterior mean to the second is

$$ \log\left(\frac{0.5/101.5}{20.5/101.5}\right) =\log\left(\frac{0.5}{20.5}\right) \approx -3.714. $$

The prior has made a zero-to-positive assumption explicit and supplied a particular amount of regularization. The numerical log-ratio matches the \(c=0.5\) calculation above, but its interpretation is different: it follows from a specified prior and sampling model, rather than from an unexplained instruction to add \(0.5\). The posterior mean is not the whole posterior distribution, and uncertainty should not be discarded in a full inferential analysis. A different prior would change the result.

When the Zero Is Structural

If a component is truly absent in the target composition, it lies outside the positive support needed for an ordinary log-ratio involving that component. Do not replace it merely to force a finite coordinate. Instead, state that the component is absent under the defined condition, and define comparisons on a support where the relevant components exist. If the scientific question concerns whether the component is present at all, that is a presence-versus-absence question, distinct from comparing relative abundance conditional on presence.

The distinction also depends on what population is being discussed. A type absent from one donor's sampled cells may still exist in the broader condition or study population. A claim of structural absence requires a scientifically meaningful definition of the population and evidence or design knowledge supporting absence; a zero in a finite sample alone is insufficient.

Worked Example: Why a Structural Zero Should Not Be Replaced

Suppose, hypothetically, a validated lineage-specific intervention makes cell type A impossible in a precisely defined target population. A sample from that population has counts \((0,30,70)\) for types A, B, and C. Under the stipulated biological premise, A is structurally absent, so the observed zero is not being interpreted as a finite-sampling miss of a positive proportion.

The log-ratio of A to B is undefined for the target composition. If an analyst nevertheless adds \(0.5\) to both counts, the resulting value is

$$ \log\left(\frac{0.5}{30.5}\right) =\log\left(\frac{1}{61}\right) \approx -4.111. $$

That finite number describes the chosen replacement, not a measured relative abundance of A. The appropriate report is that A is structurally absent under the stated premise and that an A-to-B log-ratio is not defined. Ratios among B and C remain defined; for example, \(\log(30/70)\approx -0.8473\). If the premise were not established, the same observed count table would not by itself distinguish structural absence from a sampling zero.

Diagnostics, Sensitivity, and Common Pitfalls

Zero handling should be checked rather than treated as an invisible preprocessing step. Examine the sampling depth and the number of samples with zeros, and check whether the pattern is consistent with the proposed sampling-zero explanation. Review cell-type definitions and the biological context for evidence of genuine absence. Also verify that the zero is not caused by a data-processing or classification issue. These checks do not prove the zero type, but they can reveal when an assumption is implausible.

For pseudocount or replacement analyses, repeat the calculation over a scientifically defensible range of replacement values. Compare the resulting log-ratios and, in an inferential analysis, whether the substantive conclusions change. If conclusions shift materially, report that sensitivity rather than selecting the value that gives the preferred result. If the zero is structural, sensitivity analysis over positive replacements does not solve the estimand problem; it only shows the effect of imposing values on a component assumed absent.

  • Mistake: “A zero proves the cell type is absent.” A finite sample can miss a type with positive proportion. Use the sampling context and biological evidence before classifying the zero.
  • Mistake: “Adding a tiny constant is harmless.” The worked calculations show that even modest changes in the constant can move a log-ratio substantially. State the rule and check sensitivity.
  • Mistake: “Any replacement makes a structural zero analyzable.” A replacement creates a positive value by assumption. It does not define a meaningful log-ratio for a truly absent component.
  • Mistake: “A prior-based replacement and an arbitrary pseudocount are identical.” They can yield the same point calculation, but a prior-based method states a probability model and carries uncertainty; an unexplained constant does neither.

The central decision is not which constant to add, but whether a positive underlying proportion is a defensible assumption. If it is, a zero-aware model or explicit, justified replacement may be appropriate. If it is not, do not manufacture a finite log-ratio involving that component.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. For \(N=200\) and an underlying proportion \(p=0.005\), write the probability of observing zero and explain what the probability does and does not establish.
  2. Why is the log-ratio of a zero component to a positive component undefined?
  3. For counts \((0,10,90)\), calculate the first-to-second log-ratio after adding a pseudocount \(c=1\).
  4. What assumption is made by a Dirichlet prior with strictly positive parameters when it is used to handle a sampling zero?
  5. Give one reason a structural zero should not be handled by adding a pseudocount.

Solutions. (1) \(P(X=0)=(1-0.005)^{200}=0.995^{200}\approx 0.3670\). This is the probability under the stated positive-proportion sampling model; it does not prove that the type is present or absent. (2) The ratio is zero, and \(\log(0)\) is not finite or defined as a real number. (3) \(\log((0+1)/(10+1))=\log(1/11)\approx -2.398\). This depends on the chosen pseudocount. (4) It assumes the component has positive underlying probability; the prior does not assign probability to exact structural absence. (5) A pseudocount would create an artificial positive abundance and a finite log-ratio that does not represent the stipulated absent component.

Clinical Biostats