Tutorials › Statistical Genetics › Modeling Repeated Cell Types Within Donors

Single-Cell and Cell-Type Genetics · Tutorial 958 of 989

Modeling Repeated Cell Types Within Donors

Model multiple cell-type profiles per donor without treating correlated measurements as independent genetic observations.

Advanced 10 min read

What You'll Learn

  • Represent each donor’s cell-type pseudobulk values as a correlated multivariate outcome
  • Distinguish an unstructured covariance model from a random-intercept mixed model
  • Derive how within-donor correlation changes the variance of an average
  • Estimate a shared genetic effect while accounting for repeated cell types
  • Identify assumptions that support valid inference with complete or missing profiles

Why Cell Types From One Donor Are Repeated Measurements

A pseudobulk profile summarizes expression within a cell type for a donor. When several cell types are measured in that donor, the resulting profiles are not independent observations: they share the donor’s genotype and may also share biological and technical influences. A model that treats every donor-by-cell-type profile as independent can therefore misstate the uncertainty in genetic-effect estimates.

The goal here is to represent that dependence directly. The central unit for genetic inference remains the donor, while the measurements from different cell types within that donor form a correlated profile. A model can express this profile jointly with a multivariate distribution, or use a mixed-effects formulation that induces a particular covariance structure.

Definition: Let \(i=1,\ldots,n\) index donors and \(k=1,\ldots,K\) index cell types. Write \(Y_{ik}\) for the pseudobulk outcome for donor \(i\) and cell type \(k\), and \(G_i\) for the donor’s genotype dosage. The vector \(\mathbf{Y}_i=(Y_{i1},\ldots,Y_{iK})^\mathsf{T}\) is the donor’s multivariate profile. Repeated cell types are measurements within a donor, not additional independent donors.

The outcome might be normalized expression for a gene, with units on the chosen expression scale. A genotype dosage might be coded as 0, 1, or 2 copies of an allele. Covariates such as ancestry components, age, or technical variables can enter the mean model, but they do not remove the need to describe within-donor covariance.

Multivariate and Mixed-Effects Representations

A multivariate model specifies the mean of each cell-type profile and the covariance among cell types. For example, a cell-type-specific genetic association can be written as:

$$ \mathbf{Y}_i = \boldsymbol{\alpha} + \boldsymbol{\beta}G_i + \mathbf{\Gamma}\mathbf{C}_i + \boldsymbol{\varepsilon}_i, \qquad \boldsymbol{\varepsilon}_i \sim N(\mathbf{0},\boldsymbol{\Sigma}). $$

Here, \(\boldsymbol{\alpha}\) contains the cell-type means, \(\boldsymbol{\beta}\) contains the cell-type-specific genotype slopes, and \(\mathbf{C}_i\) is a vector of donor-level covariates with corresponding coefficient matrix \(\mathbf{\Gamma}\). The \(K\)-by-\(K\) covariance matrix \(\boldsymbol{\Sigma}\) describes residual variation and dependence among cell types after accounting for the mean model. Its diagonal entries are residual variances; its off-diagonal entries are residual covariances. It must be positive definite for a nonsingular multivariate normal likelihood.

This formulation permits different genetic effects by cell type, as well as general covariance among the cell-type outcomes. A shared genetic effect is a restricted mean model in which all entries of \(\boldsymbol{\beta}\) are equal. The covariance model and the mean model answer different questions: covariance describes how outcomes co-vary, while the genotype coefficients describe their expected changes with genotype.

A mixed-effects model is another way to represent repeated profiles. For example, a donor random intercept gives:

$$ Y_{ik} = \alpha_k + \beta_kG_i + \boldsymbol{\gamma}_k^\mathsf{T}\mathbf{C}_i + b_i + \varepsilon_{ik}, \qquad b_i\sim N(0,\tau^2),\quad \varepsilon_{ik}\sim N(0,\sigma_k^2). $$

The usual random-intercept specification assumes that donor effects \(b_i\) are independent across donors, independent of the covariates and genotype, and independent of the residual errors. It also assumes residual errors are independent across cell types, conditional on \(b_i\). Integrating over the random intercept gives covariance \(\tau^2\) between two different cell types from the same donor, and variance \(\tau^2+\sigma_k^2\) for cell type \(k\). Thus, this model imposes a particular covariance structure; it is not a substitute for every possible multivariate covariance model.

Worked Example: A Random Intercept Implies a Specific Correlation

Suppose two cell types are measured for each donor. In a hypothetical analysis, the fitted random-intercept variance is \(\tau^2=2\) expression units squared, and the residual variance for each cell type is \(\sigma_k^2=3\) expression units squared. Calculate the within-donor covariance matrix and correlation implied by the model.

For either cell type, the marginal variance is the sum of the random-intercept and residual variances:

$$ \operatorname{Var}(Y_{ik})=\tau^2+\sigma_k^2=2+3=5. $$

For distinct cell types \(k\ne \ell\), only the shared random intercept contributes covariance under the stated model:

$$ \operatorname{Cov}(Y_{ik},Y_{i\ell})=\tau^2=2. $$

The implied covariance matrix and correlation are therefore:

$$ \boldsymbol{\Sigma} = \begin{pmatrix} 5 & 2\\ 2 & 5 \end{pmatrix}, \qquad \operatorname{Corr}(Y_{i1},Y_{i2}) = \frac{2}{\sqrt{5\cdot 5}} =0.400. $$

This positive correlation follows from the shared donor effect. The calculation also shows the limitation of a random intercept: it forces the covariance between the two cell types to be the same and, here, gives both cell types the same marginal variance. If the data support different covariance patterns, a more flexible covariance model may be needed.

How Dependence Changes Uncertainty

The effect of dependence can be seen by considering an average across \(K\) cell types for one donor. If every cell type has variance \(\sigma^2\) and every pair has correlation \(\rho\), then the variance of their average is:

$$ \operatorname{Var}\left(\frac{1}{K}\sum_{k=1}^K Y_{ik}\right) = \frac{\sigma^2}{K}\{1+(K-1)\rho\}. $$

When \(\rho=0\), this reduces to \(\sigma^2/K\), the variance under independence. Positive correlation makes the average less precise than that independence calculation suggests. Negative correlation can reduce the variance, subject to the requirement that the full covariance matrix is valid. This is one reason the direction and magnitude of dependence matter; there is no universal correction that can be applied without specifying a covariance structure.

Key result: If donors are independent and each donor contributes a \(K\)-dimensional outcome vector with covariance \(\boldsymbol{\Sigma}\), then the covariance of the sample mean profile is \(\boldsymbol{\Sigma}/n\). The number of independent donor-level profiles, not the number of donor-by-cell-type rows, determines the independent replication for donor-level genetic predictors.

This result follows directly from independence across donors. In the sum of \(n\) donor vectors, cross-donor covariance terms are zero; the covariance of the sum is therefore \(n\boldsymbol{\Sigma}\). Dividing the sum by \(n\) divides its covariance by \(n^2\), giving \(\boldsymbol{\Sigma}/n\). Dependence within each vector remains in the off-diagonal entries of that covariance.

Worked Example: Correlation Changes the Precision of a Donor Average

Suppose each donor has three cell-type pseudobulk measurements on the same expression scale. For illustration, assume each has variance \(9\) squared expression units and every pair has correlation \(0.5\). Calculate the variance and standard error of the average across the three cell types for one donor, then for a mean profile averaged across 25 independent donors.

The covariance between any pair is \(0.5\sqrt{9\cdot9}=4.5\) squared expression units. There are three variances and six ordered off-diagonal covariance terms in the variance of the sum. Thus:

$$ \operatorname{Var}\left(\frac{Y_{i1}+Y_{i2}+Y_{i3}}{3}\right) = \frac{3(9)+6(4.5)}{3^2} = \frac{54}{9} =6. $$

The standard error for this one-donor average, understood as its standard deviation across hypothetical donors, is \(\sqrt{6}=2.449\) expression units. If the three measurements were incorrectly treated as independent, the calculated variance would be \(9/3=3\), giving a standard error of \(1.732\) expression units.

For a mean of these donor-level averages across 25 independent donors, the standard error is:

$$ SE=\sqrt{\frac{6}{25}}=0.490 $$

expression units. The independence calculation would instead give \(\sqrt{3/25}=0.346\) expression units. The difference comes from positive within-donor correlation, not from a change in the number of donors.

Worked Genetic Association With a Correlated Profile

A multivariate or mixed model can estimate a genetic effect while accounting for repeated profiles. The following small example uses a deliberately simple model to make the covariance adjustment transparent. It does not represent a real study.

Worked Example: A Shared Genetic Slope With Two Cell Types

Consider four hypothetical donors, two with genotype dosage 0 and two with dosage 1. Each donor has pseudobulk expression measured in cell types A and B. Suppose the outcomes, in expression units, are as follows: donor 1 has (10, 12), donor 2 has (12, 10), donor 3 has (14, 16), and donor 4 has (16, 14). Assume a shared genotype slope, cell-type-specific intercepts, independent donors, Gaussian errors, and a known within-donor covariance matrix:

$$ \boldsymbol{\Sigma} = \begin{pmatrix} 4 & 2\\ 2 & 4 \end{pmatrix}. $$

The model’s equal-variance, positive-definite covariance matrix has marginal variances of 4 and correlation \(2/\sqrt{4\cdot4}=0.5\). The cell-type-specific intercepts allow A and B to have different baseline means; the shared slope assumes the expected genotype-associated change is the same in the two types.

Average the two cell-type measurements within each donor. The four donor averages are 11, 11, 15, and 15 expression units. The average at genotype 0 is 11, and the average at genotype 1 is 15. Because the dosage difference between groups is 1, the estimated shared slope is:

$$ \hat{\beta} = \frac{15-11}{1-0} =4 $$

expression units per allele copy. For a donor’s two-cell-type average, the variance implied by the covariance matrix is:

$$ \operatorname{Var}\left(\frac{Y_{iA}+Y_{iB}}{2}\right) = \frac{4+4+2(2)}{4} =3. $$

Each genotype group has two independent donors, so the variance of the difference between the two group means is \(3/2+3/2=3\), and the standard error of the estimated slope is \(\sqrt{3}=1.732\) expression units per allele copy. Under the stated Gaussian model with known covariance, a 95% normal-based interval is:

$$ 4 \pm 1.96(1.732) = [0.606,\ 7.394] $$

expression units per allele copy. Under these assumptions, the interval describes values compatible with the data and model at the 95% confidence level; it is not a 95% probability statement about the fixed slope. If one instead treated all eight donor-by-cell-type observations as independent, the naive standard error would be \(\sqrt{4/4+4/4}=\sqrt{2}=1.414\), which is too small here because the within-donor covariance is positive. In an actual analysis, covariance parameters would generally be estimated rather than known, and that estimation uncertainty must be handled by the chosen inferential procedure.

Model Assumptions and Incomplete Profiles

The covariance model is only useful when its assumptions are plausible enough for the intended inference. A standard multivariate Gaussian analysis assumes that donor vectors are independent across donors, the mean is correctly specified, and the residual covariance matrix is positive definite. Normality supports the exact Gaussian likelihood calculations; with many independent donors, some coefficient procedures can rely instead on large-sample approximations. The genotype and covariate design must also contain enough variation to identify the coefficients.

The random-intercept model adds its own assumptions: a common donor-level shift across the modeled cell types, independence of the random intercept from genotype and covariates, and conditionally independent residual errors unless a further residual covariance structure is specified. If donor effects are associated with genotype after adjustment, or if cell types have distinct residual dependencies that the model cannot represent, the fitted genetic uncertainty can be unreliable. Model choice should reflect the scientific design and the covariance pattern the analysis needs to accommodate.

Some donors may lack a usable profile for one or more cell types. A multivariate likelihood can use observed components of a donor’s vector when the missingness mechanism is ignorable for that likelihood—for example, when missingness is independent of unobserved outcomes conditional on observed variables included in the model. If missingness depends on unobserved expression after conditioning, simply omitting absent measurements does not generally remove bias. A complete-case analysis also changes the target population if donors with complete profiles differ systematically from those with incomplete profiles.

Why the Donor-Level Dependence Matters

Genotype is measured at the donor level. Repeating that genotype value on several cell-type rows does not create new genetic information or new independent donors. The repeated outcomes can improve characterization of a donor’s profile and can support cell-type-specific estimates, but only if their dependence is represented. Otherwise, standard errors and tests may be miscalibrated, commonly appearing overly precise when the unmodeled correlations are positive.

A multivariate model is attractive when the analysis centers on the joint outcome profile or requires flexible covariance among a manageable number of cell types. A mixed-effects model can be convenient when a structured dependence, such as a donor random intercept, is scientifically reasonable. Neither label alone guarantees valid inference: the mean structure, covariance assumptions, missingness, and number of independent donors all matter.

Common Mistakes

  • Counting cell-type rows as independent genetic observations. The wrong reasoning is that \(nK\) rows provide \(nK\) independent genotype observations. The correction is that genotype varies across the \(n\) donors; within-donor outcomes are correlated repeated measurements.
  • Assuming a random intercept permits any covariance pattern. A random intercept produces a specific shared-covariance structure. The correction is to check whether its implied variances and covariances are appropriate, and use a more flexible model when needed.
  • Ignoring covariance because cell types are biologically distinct. Distinct cell types can still share donor-level influences. The correction is to assess dependence in the residual profiles after specifying the mean model.
  • Confusing covariance with a genetic effect. Correlation between cell-type outcomes does not itself establish a genetic association. The correction is to estimate genotype coefficients in a mean model and use the covariance model to quantify their uncertainty.
Key takeaway: Treat a donor’s cell-type pseudobulk measurements as a joint profile. Specify the genetic mean model and the within-donor covariance separately, and base independent replication on donors rather than on the number of cell-type rows.

Check Your Understanding

Use the model definitions and calculations above to answer these questions.

  1. In a multivariate model, what information is represented by an off-diagonal entry of \(\boldsymbol{\Sigma}\)?
  2. For a random-intercept model with \(\tau^2=1\) and residual variance \(\sigma_k^2=4\) for each of two cell types, what are the marginal variance and within-donor covariance?
  3. Why does positive within-donor correlation generally make an independence-based standard error for an average too small?
  4. A study has 80 donors and measures four cell types per donor. How many independent donor-level genotype observations are there, and what do the additional cell-type measurements contribute?
  5. Name one assumption of a random-intercept model that would not be required by an unstructured multivariate covariance model.
Clinical Biostats