Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Reference Categories in Compositional Models

Differential Abundance and Compositional Effects · Tutorial 528 of 700

Reference Categories in Compositional Models

Learn to interpret reference-dependent log-ratio coefficients and recover reference-invariant pairwise conclusions through algebraic reparameterization.

Advanced 12 min read

What You'll Learn

  • Define condition effects as changes in cell-type log ratios relative to a chosen reference.
  • Translate coefficient vectors exactly when changing the reference cell type.
  • Transform standard errors and test pairwise contrasts using coefficient covariance.
  • Distinguish a reference-specific null from a reference-invariant compositional conclusion.
  • Recognize assumptions and diagnostics that matter when interpreting reference-based coordinates.

Why a Reference Category Matters

A cell-type composition records relative shares: increasing one share necessarily changes at least one other share, because the proportions sum to one. Log-ratio coordinates, introduced in the earlier material on log-ratio coordinates, express comparisons between parts rather than treating each share as an unconstrained outcome. A reference cell type provides an anchor for those comparisons. Changing the anchor changes the numerical coefficients, but it need not change the underlying pairwise conclusions.

The key interpretive question is therefore not simply, “Is the coefficient positive?” It is, “Which cell type is in the numerator, which is in the denominator, and how does that ratio change with condition?” A coefficient relative to one reference is not an absolute change in a cell type’s proportion.

Definition: For a composition with \(K\) cell types and strictly positive proportions \(p_1,\ldots,p_K\), a reference-based log-ratio coordinate for cell type \(k\) relative to reference type \(r\) is \(\log(p_k/p_r)\), where \(k\ne r\). In a regression, the coefficient for a predictor in this coordinate describes its association with the log ratio of type \(k\) to type \(r\), conditional on the other predictors in the model.

For example, suppose \(x\) indicates condition, with \(x=0\) for a control group and \(x=1\) for a treated group. A reference-based model can be written as

$$ \log\left(\frac{p_{ik}}{p_{ir}}\right) = \alpha_k + \beta_k x_i, \qquad k\ne r. $$

Here \(p_{ik}\) is the proportion of cell type \(k\) for observation \(i\), and \(\alpha_k\) is the intercept for its log ratio to reference type \(r\). The coefficient \(\beta_k\) is the condition-associated change in that log ratio. For a binary condition, it is the treated-minus-control difference in the log ratio, under this model. Exponentiating it gives a ratio of ratios:

$$ \exp(\beta_k) = \frac{(p_k/p_r)_{\text{treated}}}{(p_k/p_r)_{\text{control}}}. $$

Thus, \(\exp(\beta_k)=1.5\) means that the ratio of type \(k\) to the reference type is 1.5 times as large in the treated condition as in the control condition. It does not mean that the proportion of type \(k\) increased by 50 percentage points, or even necessarily that its own proportion increased.

Changing the Reference Is a Reparameterization

Consider a model using reference \(r\), and suppose we instead choose cell type \(s\) as the reference. For any predictor, let \(\beta_k^{(r)}\) denote its coefficient for type \(k\) relative to \(r\). Set \(\beta_r^{(r)}=0\) as a convenient anchor. The coefficient for type \(k\) relative to \(s\) is

$$ \beta_k^{(s)} = \beta_k^{(r)}-\beta_s^{(r)}. $$

This follows directly from subtracting the two log ratios. The same identity applies to the intercepts and to each predictor’s coefficient vector in a model with multiple predictors.

$$ \log\left(\frac{p_k}{p_s}\right) = \log\left(\frac{p_k}{p_r}\right) - \log\left(\frac{p_s}{p_r}\right). $$

The transformation is reversible: using \(s\) as the reference, set \(\beta_s^{(s)}=0\), then \(\beta_k^{(r)}=\beta_k^{(s)}-\beta_r^{(s)}\). Therefore, if the model allows the same set of compositions under either parameterization, changing the reference changes the coordinate description, not the fitted pairwise log ratios. A complete set of \(K-1\) reference coordinates represents the same \(K\)-part composition as another complete set of \(K-1\) reference coordinates.

Worked Example: Translating Effects Between Two References

Suppose a hypothetical study compares treated and control samples with three cell types, A, B, and C. The control composition is \((0.50, 0.30, 0.20)\) and the treated composition is \((0.40, 0.36, 0.24)\), in the order A, B, C. First use A as the reference.

For B relative to A, the control ratio is \(0.30/0.50=0.60\), and the treated ratio is \(0.36/0.40=0.90\). The condition coefficient is

$$ \beta_B^{(A)} = \log\left(\frac{0.90}{0.60}\right) = \log(1.5) = 0.4055. $$

For C relative to A, the control ratio is \(0.20/0.50=0.40\), and the treated ratio is \(0.24/0.40=0.60\). Thus,

$$ \beta_C^{(A)} = \log\left(\frac{0.60}{0.40}\right) = \log(1.5) = 0.4055. $$

Now choose B as the reference. The translated coefficient for A relative to B is \(0-0.4055=-0.4055\). For C relative to B, it is \(0.4055-0.4055=0\). Directly, C/B is \(0.20/0.30=0.667\) in controls and \(0.24/0.36=0.667\) in treated samples, so its ratio of ratios is 1 and its log effect is zero. The coefficients changed, but the pairwise statements agree: A’s ratio to B declined by the reciprocal factor, while C’s ratio to B did not change.

Reference-Dependent and Reference-Invariant Conclusions

A coefficient such as \(\beta_B^{(A)}\) answers a specific question: how does B’s abundance relative to A change with the predictor? Its value depends on the chosen denominator. By contrast, a comparison between two non-reference types can be recovered from their two coefficients. With A as reference, the predictor’s effect on B relative to C is

$$ \beta_{B:C} = \beta_B^{(A)}-\beta_C^{(A)}. $$

This difference is invariant to which reference was used to calculate the coordinates. It is the predictor’s effect on the log ratio \(p_B/p_C\). The corresponding ratio of ratios is \(\exp(\beta_B^{(A)}-\beta_C^{(A)})\).

The global null of no compositional association with a predictor is also reference-invariant. In reference-\(r\) coordinates, it is the joint hypothesis that all \(K-1\) coefficients are zero. In an unanchored description, the equivalent statement is that the predictor has the same effect on every cell type, so all pairwise differences in effects are zero. Rejecting or not rejecting a single coefficient tests only one comparison with the selected reference; it does not by itself settle the global question.

Worked Example: Recovering a Pairwise Effect

Suppose a hypothetical model uses A as reference and estimates the condition effects \(\beta_B^{(A)}=0.40\) and \(\beta_C^{(A)}=-0.20\). The effect for B relative to C is the difference:

$$ \beta_{B:C}=0.40-(-0.20)=0.60, \qquad \exp(0.60)=1.822. $$

The estimated B-to-C ratio is therefore multiplied by about 1.822 between the two conditions. If C is instead used as reference, the coefficient for B relative to C is \(0.60\), exactly the same pairwise effect. The individual coefficients relative to A and C have different meanings; the B-versus-C contrast does not.

For inference about this difference, the covariance between the two estimated coefficients matters. Suppose their estimated variances are \(0.04\) and \(0.09\), and their estimated covariance is \(0.01\). Then the standard error of their difference is

$$ SE(\hat\beta_B^{(A)}-\hat\beta_C^{(A)}) = \sqrt{0.04+0.09-2(0.01)} = \sqrt{0.11} = 0.3317. $$

Ignoring covariance would give the wrong standard error. Under a large-sample normal approximation, a Wald statistic for the null that the B-versus-C condition effect is zero is \(0.60/0.3317=1.809\), with a two-sided \(p\)-value of about 0.0705. This is not significant at a 0.05 level using that approximation. The test concerns a particular pairwise contrast, not either coefficient considered alone.

Uncertainty and Reference Choice

Changing references transforms uncertainty as well as point estimates. If estimates for types \(k\) and \(s\) relative to \(r\) have variances \(V_k\) and \(V_s\), and covariance \(C_{ks}\), then the variance for the translated coefficient is

$$ \operatorname{Var}(\hat\beta_k^{(s)}) = V_k+V_s-2C_{ks}. $$

The covariance term is essential because both estimates come from the same composition data and are generally dependent. More generally, if a vector of coefficients is transformed by a matrix \(A\), its covariance matrix is transformed to \(A\widehat{\operatorname{Var}}(\hat\beta)A^\mathsf{T}\). A standard error or confidence interval cannot be translated by subtracting point estimates alone.

Worked Example: Testing a Contrast With Its Covariance

Suppose a hypothetical fitted model with A as reference estimates \(\hat\beta_B^{(A)}=0.30\) and \(\hat\beta_C^{(A)}=0.10\). Their estimated variances are \(0.04\) and \(0.09\), and their covariance is \(0.01\). To test whether the condition effect on B relative to C is zero, the estimated contrast is \(0.30-0.10=0.20\), with standard error

$$ SE = \sqrt{0.04+0.09-2(0.01)} = \sqrt{0.11} = 0.3317. $$

The Wald statistic is \(z=0.20/0.3317=0.603\). A two-sided standard normal reference gives \(p\approx0.547\), so these hypothetical data do not provide strong evidence against a zero B-versus-C condition effect at the 0.05 level. The result does not establish that the effect is exactly zero. Testing \(\beta_B^{(A)}\) or \(\beta_C^{(A)}\) separately would answer different questions.

Assumptions, Diagnostics, and Practical Choices

The algebraic reference transformation is exact when the relevant proportions are positive and the same complete set of cell types is used in each coordinate system. A regression interpretation additionally relies on the specified model being appropriate for the target estimand: for example, its predictor structure must represent the intended condition comparison, and any adjustment variables must be interpreted as conditioned upon. The algebra itself does not establish that a condition causes a compositional change, nor does it determine a sampling distribution or guarantee valid standard errors.

In practice, check whether a reported coefficient and its denominator are clearly identified, whether pairwise effects are formed with the correct subtraction order, and whether the covariance matrix is used for contrast uncertainty. If fitting the same model under two references produces pairwise estimates that fail the translation identities beyond numerical tolerance, investigate differences in the fitted model, data, or constraints. Reference changes can cease to be a mere reparameterization if the analysis imposes reference-dependent restrictions or uses a fitting procedure whose penalties depend on the coordinate system.

A reference can be selected for interpretability, such as a biologically meaningful or well-measured cell type. But a convenient reference does not make its proportion fixed, remove compositional dependence, or turn relative effects into absolute abundance effects. Log ratios also require positive proportions; zero-valued parts require separate treatment and cannot be made valid merely by choosing a different reference.

Key takeaway: Reference-based coefficients describe changes in ratios to the chosen reference. Translate them by subtraction; use coefficient covariance for uncertainty. Pairwise contrasts and the global no-compositional-effect conclusion are reference-invariant, while any single coefficient’s interpretation is reference-dependent.

Common Mistakes

  • Calling a log-ratio coefficient an absolute proportion change. A positive coefficient means the numerator’s ratio to the reference rises; it does not imply that the numerator proportion itself rose.
  • Changing the reference but keeping the old coefficient values. For new reference \(s\), subtract the old coefficient for \(s\) from every old coefficient, taking the old reference coefficient to be zero.
  • Testing a pairwise contrast with the wrong standard error. The variance of a difference includes minus twice the covariance, not just the sum of variances.
  • Treating a reference-specific null as a global null. A zero effect for B relative to A says nothing by itself about every other pairwise comparison.

Check Your Understanding

Try each question, then check the solutions below.

  1. With A as reference, estimated condition effects are \(\hat\beta_B^{(A)}=0.25\) and \(\hat\beta_C^{(A)}=-0.15\). What are the effects for A and B relative to C?
  2. Using the coefficients in Question 1, what is the estimated condition effect on the B-to-C ratio, and what ratio-of-ratios does it imply?
  3. For a contrast \(\hat\beta_B-\hat\beta_D=0.30\), suppose the variances are \(0.09\) and \(0.16\), with covariance \(0.03\). Calculate its standard error and Wald statistic.
  4. What does an estimated condition coefficient of zero for C relative to A mean? What does it not establish?

Solutions. (1) Set \(\hat\beta_A^{(A)}=0\). With C as the new reference, A relative to C is \(0-(-0.15)=0.15\), and B relative to C is \(0.25-(-0.15)=0.40\). (2) The B-to-C effect is \(0.25-(-0.15)=0.40\); its ratio-of-ratios is \(\exp(0.40)=1.492\), approximately. (3) The standard error is \(\sqrt{0.09+0.16-2(0.03)}=\sqrt{0.19}=0.4359\). The Wald statistic is \(0.30/0.4359=0.688\). (4) It means the fitted C-to-A ratio has no estimated condition change on the log scale. It does not show that C’s proportion is unchanged, that all compositional contrasts are zero, or that the true effect is exactly zero.

Clinical Biostats