Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Fixed Donor Effects and Their Limits

Biological Replication and Donor-Level Inference · Tutorial 451 of 700

Fixed Donor Effects and Their Limits

Use donor indicators to control for baseline differences, identify what the model estimates from within-donor variation, and recognize when fixed effects cannot answer a donor-level question.

Advanced 11 min read

What You'll Learn

  • Interpret a donor fixed effect as a separate baseline for each observed donor.
  • Derive the within-donor, centered form of the fixed-effects estimator.
  • Calculate a fixed-effects slope and interpret its units and scope.
  • Diagnose why donor-level exposures are collinear with donor indicators.
  • Distinguish controlling for donor baselines from creating independent donor replication.
  • Compare fixed effects with pooled regression, donor summaries, and random-intercept models.

Why Include Donor Fixed Effects?

Cells from the same donor can share baseline characteristics that affect their measured expression or another cell-level outcome. A regression that treats all cells as if they began from the same baseline can mix these donor differences with the relationship of interest. Donor fixed effects address this by assigning a separate intercept to each observed donor.

This adjustment has a specific scope. Fixed effects can control for donor-specific baseline differences when the predictor varies within donors. They do not turn cells into independent biological replicates, and they cannot identify the effect of a predictor that is constant within each donor. The key question is therefore not just how many cells were measured, but where the predictor varies.

Definition: A donor fixed-effects model gives each observed donor its own intercept. For cell \(i\) from donor \(d\), a one-predictor model is $$ Y_{id}=\alpha_d+\beta X_{id}+\varepsilon_{id}, $$ where \(Y_{id}\) is the outcome, \(X_{id}\) is a predictor, \(\alpha_d\) is donor \(d\)'s intercept, \(\beta\) is a common slope, and \(\varepsilon_{id}\) is the residual. A coefficient is identified by the data only if its predictor is not perfectly explained by the donor indicators and other included predictors.

The intercept \(\alpha_d\) represents the fitted outcome for donor \(d\) when \(X_{id}=0\), conditional on the model. If zero is not a meaningful predictor value, this may not be a scientifically useful baseline; centering \(X\) can make the intercept more interpretable without changing the fixed-effects slope. With several predictors, the same idea applies: each donor gets an intercept, while the model specifies whether slopes are shared or allowed to differ.

How Within-Donor Variation Identifies the Slope

The model can be written using one indicator for each donor, with a coefficient for each donor's intercept. Its important consequence becomes clear by subtracting each donor's mean from that donor's observations. Let \(\bar{Y}_d\) and \(\bar{X}_d\) denote the respective means among the observed cells from donor \(d\). Averaging the model within donor gives \(\bar{Y}_d=\alpha_d+\beta\bar{X}_d+\bar{\varepsilon}_d\). Subtracting that equation from each cell's equation removes \(\alpha_d\):

$$ Y_{id}-\bar{Y}_d = \beta(X_{id}-\bar{X}_d)+(\varepsilon_{id}-\bar{\varepsilon}_d). $$

When the predictor has variation within donors, the least-squares slope from this centered regression is

$$ \hat{\beta}_{FE} = \frac{\sum_d\sum_i (X_{id}-\bar{X}_d)(Y_{id}-\bar{Y}_d)} {\sum_d\sum_i (X_{id}-\bar{X}_d)^2}. $$

The denominator must be greater than zero: at least one donor must have within-donor variation in \(X\). The formula also shows what this coefficient uses: how differences in \(X\) among cells from the same donor align with differences in \(Y\) among those cells. It does not use differences in donor-average \(X\) to estimate the slope. In the one-predictor model, the fitted donor intercept is \(\hat{\alpha}_d=\bar{Y}_d-\hat{\beta}_{FE}\bar{X}_d\).

Assumptions for interpreting the model: The conditional mean of the outcome is adequately represented by donor-specific intercepts and the included predictors, with a common slope if one common \(\beta\) is fitted. For a causal interpretation, relevant confounding must also be controlled, including factors that vary within donors. For conventional cell-level least-squares standard errors and tests, the error model must justify those calculations; in particular, donor indicators alone do not ensure that residuals from cells of the same donor are independent. A fitted coefficient can be calculated without these inferential assumptions, but its uncertainty and interpretation still depend on them.

Worked Example: Calculating a Common Within-Donor Slope

Suppose, hypothetically, that a continuous predictor \(X\) and an outcome \(Y\) are measured in three cells from each of three donors. The values are:

Donor\(X\) values\(Y\) values
10, 1, 210, 12, 13
20, 1, 220, 21, 24
30, 1, 27, 9, 10

For every donor, \(\bar{X}_d=1\). The donor-specific means of \(Y\) are \(11.667\), \(21.667\), and \(8.667\). For donor 1, the centered cross-product sum is \((-1)(-1.667)+(0)(0.333)+(1)(1.333)=3\); its centered \(X\) sum of squares is \(1+0+1=2\). The corresponding cross-product sums for donors 2 and 3 are 4 and 3, and each has centered \(X\) sum of squares 2.

Therefore, $$ \hat{\beta}_{FE}=\frac{3+4+3}{2+2+2}=\frac{10}{6}=1.667. $$ The fitted slope is 1.667 outcome units per one-unit increase in \(X\), using within-donor variation under the common-slope model. The fitted intercepts are \(11.667-1.667(1)=10\), \(21.667-1.667(1)=20\), and \(8.667-1.667(1)=7\). The coefficient calculation does not by itself establish a causal effect or validate cell-level standard errors.

Why Donor-Level Exposures Cannot Be Estimated This Way

Suppose the predictor is a donor-level exposure \(Z_d\), such as a treatment assignment that is the same for every cell from a given donor. In a fixed-effects model, its cell-level value is repeated within donor, so \(Z_{id}=Z_d\). This predictor is exactly a combination of the donor indicators: every donor's indicator is 1 for that donor's cells and 0 for the others, and multiplying each indicator by that donor's exposure value reconstructs \(Z\). As a result, a separate coefficient for \(Z_d\) cannot be distinguished from the donor intercepts.

$$ Z_{id}-\bar{Z}_d=Z_d-Z_d=0. $$

The centered predictor has no variation, so its within-donor slope denominator is zero. In the uncentered model, the same problem appears as exact collinearity: changing the exposure coefficient can be offset by changing the donor intercepts without changing any fitted value. Software may drop the exposure term or report that the model matrix is rank deficient. This is not a software defect; the data and model do not identify that coefficient.

Worked Example: A Donor-Level Treatment Is Aliased With Donor Intercepts

Imagine, hypothetically, that three donors contribute several cells each. Donors 1 and 2 are unexposed, and donor 3 is exposed, so their exposure values are \(Z_1=0\), \(Z_2=0\), and \(Z_3=1\). Consider a model with a separate intercept \(\alpha_d\) for each donor and an exposure coefficient \(\gamma\):

$$ Y_{id}=\alpha_d+\gamma Z_d+\varepsilon_{id}. $$

For donors 1 and 2, the fitted mean is their donor intercept. For donor 3, it is \(\alpha_3+\gamma\). For any number \(c\), replace \(\gamma\) by \(\gamma+c\) and replace \(\alpha_3\) by \(\alpha_3-c\). The fitted mean for donor 3 remains \((\alpha_3-c)+(\gamma+c)=\alpha_3+\gamma\), and the fitted means for donors 1 and 2 do not change. Thus the data cannot distinguish \(\gamma\) from the donor intercepts. Adding more cells from these same donors repeats the same exposure values and does not resolve the aliasing.

A donor-level exposure requires a design and analysis that compare independent donors across exposure groups, rather than a model that absorbs every donor's baseline with a separate intercept. The number of cells is not the number of independent treatment assignments.

What Fixed Effects Control—and What They Do Not

Donor fixed effects control for characteristics that are constant across the observed cells of a donor, whether those characteristics have been measured or not, by allowing each donor a separate baseline. This can reduce bias from baseline differences when estimating a relationship supported by within-donor variation. It does not control automatically for unmeasured factors that change across cells within a donor and are associated with both the predictor and outcome. Nor does it guarantee a common slope is appropriate: a single \(\beta\) summarizes within-donor relationships under the specified common-slope model.

A fixed intercept is not a model for a population distribution of donor effects. The fitted intercepts describe the donors included in the analysis; the model alone does not say how those donors represent a broader population. Compared with the earlier material on random-intercept models, fixed effects avoid requiring a distribution for donor intercepts, but they also absorb predictors that vary only between donors. These approaches answer different questions and their assumptions should not be treated as interchangeable.

ApproachHow donor differences enterWhat it can estimateMain caution
Pooled regression without donor indicatorsUses one common intercept unless other terms are addedCan use both within- and between-donor predictor variationDonor baseline differences may be mixed into the predictor relationship.
Donor fixed-effects regressionGives every observed donor a separate interceptSlopes for predictors with within-donor variationCannot estimate a donor-constant exposure alongside donor indicators.
Donor-level summariesReduces each donor to a summary before comparing donorsAssociations or group differences across donor summariesThe number of independent donor summaries, not the number of cells, governs replication.
Random-intercept modelRepresents donor intercepts through a distributional modelCan model donor-level predictors under its assumptionsRequires assumptions about the donor-effect distribution and its relation to predictors.

Diagnostics and Common Mistakes

Before interpreting a fixed-effects coefficient, check the structure that gives it meaning. Verify that the predictor actually varies within donors, and identify which donors supply that variation. A coefficient can be calculated from a small subset of donors even when many donors are present; in that case, its interpretation should reflect the observed support. Check whether the within-donor relationship plausibly has a common slope, whether the outcome-predictor relationship is adequately represented, and whether individual donors or cells dominate the centered sums of squares. A model warning about singularity or a dropped donor-level predictor is a direct clue to collinearity, not evidence that the exposure has no effect.

Most importantly, donor indicators adjust fitted baselines, not the independence structure of the residuals. If cells from a donor remain correlated after accounting for the intercepts, treating every cell as an independent replicate can give misleadingly small standard errors. The earlier material on biological replication and donor-level inference emphasizes why the independent donor count matters. Fixed effects do not create additional donors, and a large number of cells cannot compensate for having few independent donors for a donor-level claim.

Worked Example: A Pooled Slope Can Differ From a Fixed-Effects Slope

Consider hypothetical observations from two donors. Donor 1 has \(X=0,1\) and \(Y=10,12\); donor 2 has \(X=2,3\) and \(Y=20,22\). Within each donor, an increase of 1 unit in \(X\) accompanies an increase of 2 outcome units, so the fixed-effects slope is \(2\).

For comparison, the pooled means are \(\bar{X}=1.5\) and \(\bar{Y}=16\). The pooled cross-product sum is $$ (-1.5)(-6)+(-0.5)(-4)+(0.5)(4)+(1.5)(6)=22, $$ and the pooled \(X\) sum of squares is $$ (-1.5)^2+(-0.5)^2+(0.5)^2+(1.5)^2=5. $$ Thus the pooled slope is \(22/5=4.4\), not 2. The pooled calculation includes the large difference between donor baselines as well as the within-donor changes. The fixed-effects slope removes those donor-specific baselines and uses the within-donor changes. This example illustrates why the slopes can differ; it does not establish which model is suitable without considering the scientific question and assumptions.

  • Mistake: “There are thousands of cells, so a donor-level treatment effect has thousands of replicates.” Correction: If treatment is assigned by donor, the independent treatment replication is at the donor level. Repeated cells do not create additional independent assignments.
  • Mistake: “Donor fixed effects control every possible confounder.” Correction: They absorb donor-constant differences, but not cell-varying confounding or misspecification of the within-donor relationship.
  • Mistake: “The fixed-effects coefficient is the overall association across all donors.” Correction: Its identifying variation is within donors; the estimate is not obtained by comparing donor averages.
Key takeaway: Donor fixed effects provide a separate baseline for each observed donor. They identify slopes from within-donor variation, can control for donor-constant baselines, and cannot estimate a donor-constant exposure at the same time as unrestricted donor intercepts. They adjust a model; they do not create biological replication.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. A predictor has values 2, 4, and 6 in every donor. Can its slope be estimated in a donor fixed-effects model? Explain.
  2. In a donor fixed-effects model, what variation identifies the slope for a cell-level predictor?
  3. A treatment is constant within each donor. Why can adding more cells per donor not make its coefficient estimable alongside donor fixed effects?
  4. In the pooled-versus-fixed-effects example, which slope is based on within-donor changes, and why are the two estimates different?

Solutions. (1) Yes, because the predictor varies within each donor; its centered values are \(-2,0,2\), so the within-donor sum of squares is positive. (2) The slope is identified by how deviations of the predictor from each donor's mean align with outcome deviations from that donor's mean. (3) The treatment is a linear combination of donor indicators and has zero within-donor variation. More cells repeat the same exposure value rather than adding independent donor-level exposure variation. (4) The fixed-effects slope of 2 uses within-donor changes. The pooled slope of 4.4 also reflects the between-donor baseline difference, so it is not estimating the same variation-based relationship.

Clinical Biostats