Why Compare Analyses of the Same Nested Data?
Single-cell measurements are nested: cells sampled from one donor share biological features and are not generally independent replicates of a population of donors. Comparing analyses on the same hypothetical data makes the consequences concrete. A cell-independent analysis can report a smaller standard error by treating the cells as independent; donor summaries make the biological replicate explicit; and a hierarchical model represents both donor variation and cell-level variation.
The three analyses need not estimate the same quantity in every design. Here, the main comparison uses equal numbers of cells per donor and an outcome measured on a continuous scale, such as a normalized expression value. The target is the difference between condition means across donors. These calculations are not a prescription for a particular expression model: the outcome scale, design, and target must be specified before comparing methods.
Hypothetical Balanced Example: Three Analyses
Suppose four independent donors are observed in each of two conditions, with 15 cells per donor. The outcome is normalized expression in arbitrary units. The donor-level means are \(0.10, 0.20, 0.30, 0.40\) in condition A and \(0.20, 0.30, 0.40, 0.50\) in condition B. Thus the mean across donors is \(0.25\) in A and \(0.35\) in B. The estimated condition difference, B minus A, is \(0.10\) units. For this example, suppose each donor’s 15 cell values have within-donor sample variance \(0.09339\), and the pooled variance of all 120 cell outcomes is \(0.1039\).
These are hypothetical summaries, chosen to make the same data structure comparable under three approaches. They are internally consistent: each condition’s four donor means have sample variance \(0.01667\); the cell-level pooled variance follows from the within-donor and between-donor sums of squares, as shown in the hierarchical calculation below.
Worked Example: Cell-Independent Analysis
If the 60 cells in each condition were independent observations with a common variance, the standard error for a difference of means would be \(SE=\sqrt{s_p^2(1/n_A+1/n_B)}\). Substituting the pooled cell variance and cell counts gives
The test statistic for a zero difference is \(t=0.10/0.05885\approx1.699\). Under the independent-cell, equal-variance model, the degrees of freedom are \(60+60-2=118\), giving a two-sided \(p\)-value of approximately \(0.092\). A 95% interval is approximately \(0.10\pm1.980(0.05885)\), or \((-0.0165,\ 0.2165)\) units.
The arithmetic is correct for the stated independent-cell model. The key issue is whether the model is credible: cells from a donor share a donor-level context, so this standard error does not account for within-donor dependence. The \(p\)-value is not the probability that the null hypothesis is true; it is the probability, under the model and null, of a statistic at least as extreme as the observed one.
Worked Example: Donor-Summary Analysis
Now take the donor, not the cell, as the independent replicate. The donor means in each condition have sample variance \(s^2=0.01667\) units squared. With four donors per condition, the standard error of the difference is
The test statistic is \(t=0.10/0.09129\approx1.095\). Using the pooled two-sample \(t\) procedure with \(df=4+4-2=6\), the two-sided \(p\)-value is approximately \(0.316\). With \(t_{0.975,6}\approx2.447\), the 95% interval is
This interval describes uncertainty about the difference between condition means across donors under the two-sample model. Its width reflects that there are four donors per condition, not 60 independent biological replicates per condition. The normality and equal-variance assumptions apply to donor means in this calculation; with so few donors, they cannot be checked reliably from the data alone.
Hierarchical Model and Its Uncertainty
A simple random-intercept model makes the nesting explicit. For donor \(j\) in condition \(g(j)\), it writes each cell outcome as a condition mean, a donor-specific deviation, and a cell-level residual. The model assumes independent donors, mean-zero normally distributed donor deviations with common variance \(\tau^2\), and independent mean-zero normally distributed residuals with common variance \(\sigma^2\). Donor deviations and residuals are mutually independent. These assumptions are substantive: a random intercept allows baseline outcomes to differ across donors, but does not automatically handle condition-specific donor responses, dependence between donors, or a misspecified outcome distribution.
Here \(\beta_1\) is the model’s condition B minus condition A contrast. In a balanced design with the same number of cells per donor, the fitted contrast is the difference between the two equally weighted averages of donor means. Its standard error includes variation among donors and the residual uncertainty in estimating each donor mean.
The result follows by first averaging within each donor. The donor mean is \(\bar{Y}_j=\beta_0+\beta_1 I\{g(j)=B\}+b_j+\bar{\varepsilon}_j\). Since the \(m\) independent residuals each have variance \(\sigma^2\), their mean has variance \(\sigma^2/m\). Independence of \(b_j\) and \(\bar{\varepsilon}_j\) therefore gives \(\operatorname{Var}(\bar{Y}_j)=\tau^2+\sigma^2/m\). Averaging \(D_A\) independent donor means in A and \(D_B\) in B, then subtracting, adds the two variances and yields the displayed result.
Worked Example: Decomposing Hierarchical Uncertainty
For the eight donor means above, the within-condition sample variance is \(s^2_{\text{donor}}=0.01667\). In this balanced example, the residual variance estimate is \(\hat{\sigma}^2=0.09339\). The method-of-moments estimate of the donor variance component is the observed variance of donor means minus the sampling variance of a donor mean, divided by the number of cells:
Equivalently, the balanced one-way decomposition gives \(\hat{\tau}^2=(MS_{\text{between}}-MS_{\text{within}})/15\), where \(MS_{\text{between}}=15(0.01667)=0.2500\) and \(MS_{\text{within}}=0.09339\). Thus \((0.2500-0.09339)/15\approx0.01044\). The positive estimate indicates appreciable donor-level variation beyond cell-level residual variation in this illustrative fit.
For four donors in each condition, the model-based standard error is
The contrast remains \(0.10\) units. In this balanced Gaussian example, the donor-summary calculation and the hierarchical calculation agree: each donor contributes equally, and donor-mean variance is represented as \(\tau^2+\sigma^2/15\). A small-sample interval based on the eight donor means and \(df=6\) is the same approximate interval, \((-0.1235,\ 0.3235)\) units. In general, mixed-model software may use a different degrees-of-freedom approximation, and variance-component estimates themselves are uncertain.
The pooled cell variance used in the first example is also consistent with these summaries. The within-donor sum of squares is \(112(0.0933946)\); the donor-mean sum of squares within conditions, expanded across 15 cells per donor, is \(2(15)(0.05)=1.50\); and the condition means contribute \(120(0.05^2)=0.30\). The total is approximately \(12.2602\), so dividing by \(118\) gives \(0.1039\) units squared.
What Changes With Unequal Cell Counts?
Equal cell counts make the three point estimates in the balanced example align, but this need not hold when donors contribute different numbers of cells. An unweighted average of donor means gives each donor equal influence. A raw cell mean gives more weight to donors with more observed cells. Those answer different questions when donor cell counts vary, especially if cell yield is related to donor characteristics or the outcome.
Worked Example: Unequal Counts Change the Cell-Weighted Mean
Suppose two donors in condition A have means \(0.0\) and \(1.0\), based on 5 and 50 cells, respectively. Their equally weighted donor mean is \((0.0+1.0)/2=0.50\). Their pooled cell mean is
For comparison, suppose two donors in condition B have means \(0.4\) and \(0.6\), each based on 10 cells. The donor-average mean in B is \(0.50\), and the cell-weighted mean is also \(0.50\). The equally weighted donor contrast, B minus A, is therefore \(0.00\) units; the cell-weighted contrast is \(0.50-0.9091=-0.4091\) units. Neither arithmetic is inherently wrong, but the second result is dominated by the high-cell-count donor in A. The intended target determines which weighting is appropriate.
Assumptions, Diagnostics, and Alternatives
The analyses differ in what they assume and how they use the data. Donor summaries are transparent and protect against counting cells as independent replicates, but discard within-donor cell-level detail after computing each summary. The hierarchical model retains that structure and can accommodate unequal cell counts and covariates, but its results depend on the random-effects structure, distributional assumptions, and estimation method. Cell-independent tests are simple, but their usual standard errors and reference distributions require independence across cells; that requirement is generally implausible for cells from the same donor.
| Approach | What is treated as independent? | Main uncertainty source | Important limitation |
|---|---|---|---|
| Cell-independent | Individual cells | Cell-level pooled variation | Understates uncertainty when within-donor correlation is ignored |
| Donor summary | Donors | Variation among donor means | Can lose cell-level information; few donors limit precision |
| Hierarchical | Donors, with cells clustered within them | Between-donor and within-donor variation | Depends on model structure and stable variance estimation |
Diagnostics should focus on whether the assumed structure is plausible, not only whether a numerical procedure converges. Inspect donor means and cell counts by condition; look for influential donors, uneven sampling, outlying donor means, and patterns in residuals. Residual checks can reveal severe skew, outliers, or changing residual spread, though they cannot establish that a random-effects distribution is correct when there are very few donors. Sensitivity to removing one donor or changing the variance structure is informative, but should not be used to select whichever result is most favorable.
When a variance-component estimate is near zero, the fitted hierarchical model may appear to have little donor variation. With few donors, this is weak evidence that population heterogeneity is truly absent. For example, if four donors per group have a pooled donor-mean variance of \(0.002\) units squared and \(\hat{\sigma}^2=0.09\) with 15 cells per donor, the moment estimate is truncated at zero because \(0.002-0.09/15=-0.004<0\). A model using \(\hat{\tau}^2=0\) has a nominal contrast standard error \(\sqrt{0.09(1/60+1/60)}\approx0.05477\) units. That plug-in result does not account for substantial uncertainty about the variance component with only eight donors.
A practical pitfall is to say, “There are 120 cells, so the analysis has 120 independent replicates.” The correction is to distinguish the number of measured cells from the number of independent biological donors. More cells can improve estimation of a donor’s mean, but do not create additional donors or remove between-donor uncertainty. Conversely, a donor summary is not automatically sufficient for every scientific question: one must specify whether donors are weighted equally and whether the outcome and contrast are defined on a scale where the donor mean is appropriate.
Check Your Understanding
Answer each question, then compare with the brief solutions.
- With 20 cells per donor and many donors in each condition, which term in the hierarchical donor-mean variance decreases as cell numbers increase: \(\tau^2\) or \(\sigma^2/m\)?
- Why can the balanced donor-summary and hierarchical contrasts agree while their descriptions of the data differ?
- In the unequal-count example, which donor determines most of condition A’s raw cell mean, and why?
- A cell-independent analysis produces a narrow interval. What key assumption should be checked before interpreting that interval as valid for a donor population?
- If a random-intercept variance estimate is zero with only a few donors, what is a cautious interpretation?
Solutions. (1) The within-donor term \(\sigma^2/m\) decreases as \(m\) increases; \(\tau^2\) represents between-donor variation and does not decrease merely by sampling more cells per donor. (2) In a balanced design, both give equal weight to each donor mean; the hierarchical model additionally decomposes donor-mean variation into between-donor and cell-sampling components. (3) The donor with mean \(1.0\) and 50 cells, because the cell-weighted average gives that donor 50 of the 55 total cell weights. (4) Check whether cells can reasonably be treated as independent across donors’ clusters; shared donor effects generally violate this assumption. (5) The data and small donor count may not estimate heterogeneity precisely; a boundary estimate is not proof that true donor variation is absent.