Why Cells From One Donor Covary
A cell-level expression measurement reflects more than the cell’s state. Cells from one donor may share genetic background, environment, sample handling, and other donor-level influences. Consequently, two cells from that donor can be statistically related even when their cell-specific deviations are unrelated. A random-intercept model isolates one simple source of this dependence: a shared donor-specific contribution to every cell’s measurement.
This tutorial derives the covariance implied by that model. The outcome \(Y_{ij}\) will denote a measurement, such as a chosen gene’s normalized expression, for cell \(j\) from donor \(i\). The derivation concerns a specified outcome scale; a covariance on a transformed scale need not equal a covariance on the original count scale.
Random-Intercept Model and Assumptions
For a single group or condition, write the model as
where \(\mu\) is the population mean, \(B_i\) is the random intercept for donor \(i\), and \(\varepsilon_{ij}\) is the cell-specific residual. Assume
The standard random-intercept covariance calculation uses these additional assumptions:
- Different donors’ random intercepts are independent.
- Residuals from different cells are independent, including cells from the same donor.
- All residuals are independent of all donor intercepts.
- The variance components are common across the donors and cells being modeled.
Normal distributions are not required to calculate the covariance below. They may be added for likelihood-based modeling or distributional inference, but the covariance derivation uses only the stated means, variances, and independence assumptions. If a fixed predictor is included, such as a condition indicator, its contribution changes the conditional mean; the covariance calculation applies after accounting for that mean structure, provided the variance assumptions remain appropriate.
Deriving the Within-Donor Covariance
Take two distinct cells \(j\) and \(k\) from donor \(i\). Both measurements contain the same \(B_i\), while their residuals are independent. Expanding the covariance gives
The constant \(\mu\) contributes no covariance. The cross-covariances involving \(B_i\) are zero by independence, and the residual covariance is zero for distinct cells by the residual-independence assumption. The only shared random term is the donor intercept.
For one cell, the residual is not independent of itself. Thus the marginal variance is
For cells from different donors \(i\ne r\), all random terms are independent under the assumptions, so \(\operatorname{Cov}(Y_{ij},Y_{rk})=0\). Therefore, the correlation between two distinct cells from the same donor is
This correlation is often called the intraclass correlation coefficient for this random-intercept model. It is between zero and one when the two variance components are nonnegative and their sum is positive. It is zero if there is no donor-intercept variation, and it approaches one when cell-specific residual variation is small relative to donor variation. This is a model-based correlation for two distinct cells from the same donor, not a claim that every observed pair has exactly this empirical correlation.
Worked Example: Covariance and Correlation for Two Cells
Suppose a hypothetical model for a gene’s log-expression has \(\sigma_B^2=0.36\) log-expression-units squared and \(\sigma_\varepsilon^2=0.64\) log-expression-units squared. Find the marginal variance of one cell and the covariance and correlation of two distinct cells from the same donor.
The model gives marginal variance
The shared random intercept induces within-donor covariance
The correlation is \(0.36/1.00=0.36\). Thus the model predicts a positive association between two distinct cells from one donor. The number \(0.36\) is a dimensionless correlation; the covariance, by contrast, has squared outcome units.
Covariance Matrix for Cells From One Donor
For \(m_i\) cells from donor \(i\), collect the outcomes into a vector \(\mathbf{Y}_i=(Y_{i1},\ldots,Y_{im_i})^\mathsf{T}\). Its covariance matrix has the same marginal variance on the diagonal and the same within-donor covariance in every off-diagonal position:
Equivalently, if \(\mathbf{1}_{m_i}\) is the vector of \(m_i\) ones and \(I_{m_i}\) is the identity matrix,
The first term places the donor-level variance in every matrix entry because the donor effect is shared. The second adds residual variance only to the diagonal because residuals are independent across cells. This is a compound-symmetry covariance pattern: all cells have the same marginal variance, and every pair of distinct cells in the donor has the same covariance. Donors with different cell counts have matrices of different dimensions, but the same variance-component structure under the model.
Worked Example: Building a Three-Cell Covariance Matrix
Consider a hypothetical donor with three measured cells. Suppose \(\sigma_B^2=0.25\) and \(\sigma_\varepsilon^2=0.75\), in squared units of the expression outcome. The diagonal entries are the marginal variance, \(0.25+0.75=1.00\); each off-diagonal entry is the within-donor covariance, \(0.25\). Therefore,
For example, the covariance of cell 1 and cell 3 is \(0.25\), not \(1.00\): the diagonal value is a variance of one cell, whereas this off-diagonal value is a covariance between two different cells. The model-implied correlation for that pair is \(0.25/\sqrt{1.00(1.00)}=0.25\).
When the Structure Is Useful—and When It Fails
The random intercept is a compact way to represent stable, donor-shared variation. It clarifies why observations that have the same donor label need not be independent, even if each cell was measured separately. In single-cell analyses, this distinction matters whenever cell-level measurements are used to characterize variability or compare groups: the covariance model describes which observations share a modeled source of variation.
The structure is an assumption, not a consequence of merely grouping cells by donor. Diagnostics should assess whether its simplifications are plausible. Relevant checks include residual plots against fitted values and cell-level covariates; comparisons of within-donor residual patterns across donors; and checks for variation in residual spread or donor-level variability. With adequate numbers of donors and cells, one can inspect whether residual dependence appears to diminish with cell separation or differ by cell state. A single estimated donor variance near zero may also reflect limited information, rather than proof that donor effects are absent.
Several patterns indicate possible failure. If residuals from cells of the same donor remain correlated after accounting for the intercept, the assumed independent residuals are inadequate. If cells at different states, times, or conditions have different donor-level responses, one common intercept may be too restrictive. A random-slope model can represent donor-specific variation in a predictor’s effect, but it requires enough replicated information to estimate the added variance and covariance parameters. Heterogeneous cell types may require a richer mean or variance structure rather than one common residual variance.
Worked Example: Separating Shared Variation From Residual Variation
Suppose a hypothetical analysis estimates a marginal variance of \(2.5\) squared expression units and a within-donor covariance of \(1.0\) squared expression units for two distinct cells. Under the random-intercept assumptions, recover the two variance components and the implied correlation.
The off-diagonal covariance equals the donor-intercept variance, so \(\sigma_B^2=1.0\) squared expression units. The marginal variance is the sum of the donor and residual components:
The corresponding correlation is
Thus this model attributes \(1.0\) squared units of marginal variance to the shared donor component and \(1.5\) squared units to cell-specific residual variation. This decomposition is valid only if the random-intercept model and its residual-independence assumptions are reasonable.
Model Comparisons and Common Pitfalls
An independence model sets the within-donor covariance to zero. It is appropriate only if no shared or other within-donor random component remains after the modeled predictors, or if that dependence is intentionally outside the analysis. The random-intercept model instead imposes a common covariance for every pair of distinct cells within a donor. More flexible covariance models can describe cell-specific or distance-dependent relationships, but they require more assumptions and data to estimate reliably. These are alternative covariance descriptions, not interchangeable interpretations of the same fitted parameters.
A common mistake is to treat \(\sigma_B^2\) as the variance of an individual cell’s measurement. It is the variance of the donor-specific component; the total marginal variance of one cell is \(\sigma_B^2+\sigma_\varepsilon^2\). A related mistake is to call \(\sigma_B^2\) the within-donor correlation. It is a covariance in squared outcome units. The correlation is the covariance divided by the marginal standard deviations, which in this model yields \(\sigma_B^2/(\sigma_B^2+\sigma_\varepsilon^2)\).
Another failure is to infer the random-intercept model solely from an observed positive association. A shared donor effect is one plausible source, but unmodeled cell states, batches, or other shared factors may also create dependence. Conversely, a donor label alone does not guarantee a positive covariance under every possible data-generating process. The interpretation follows from the model’s explicit assumptions.
Check Your Understanding
Answer each question using the random-intercept assumptions stated above. Complete solutions follow.
- If \(\sigma_B^2=0.20\) and \(\sigma_\varepsilon^2=0.80\), what are the marginal variance and within-donor correlation?
- For two cells from different donors, what covariance does the model imply, and which assumption gives that result?
- In a two-cell covariance matrix, why is the diagonal not equal to the within-donor covariance?
- Suppose residuals from two cells of the same donor are positively correlated even after accounting for the donor intercept. Which model assumption is in question?
- Can a normality assumption be removed from the algebraic derivation of the within-donor covariance? Explain.
Solutions. (1) The marginal variance is \(0.20+0.80=1.00\), and the correlation is \(0.20/1.00=0.20\). (2) The covariance is zero under the model because different donors’ intercepts are independent and their cell residuals are independent of one another and of the intercepts. (3) The diagonal is a single cell’s variance, \(\sigma_B^2+\sigma_\varepsilon^2\); the off-diagonal is the covariance of two distinct cells, \(\sigma_B^2\). (4) The assumption that distinct cell residuals are independent is inadequate, or additional shared structure is missing. (5) Yes. The covariance expansion uses the means, variances, and independence assumptions, not normality.