Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Cell Sampling Uncertainty Within Donors

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

Cell Sampling Uncertainty Within Donors

Separate uncertainty from sampling cells within donors from uncertainty due to sampling donors, and combine the two components under clearly stated assumptions.

Advanced 10 min read

What You'll Learn

  • Define a donor-specific target and distinguish it from a cell-weighted target.
  • Calculate cell-sampling variance for a mean of donor-level estimates.
  • Decompose population-level variance into within-donor and between-donor components.
  • Handle donor-specific conditional variances correctly when they vary across donors.
  • Identify assumptions, diagnostics, and limits of variance-component calculations.
  • Explain why adding cells cannot remove uncertainty from sampling donors.

Two Sources of Uncertainty

A donor-level estimate is often calculated from a finite sample of cells. Even if the donors in a study were fixed in advance, repeating the cell-sampling process could produce different estimates for those donors. That is cell-sampling uncertainty within donors. If the donors are viewed as a sample from a broader population, the true donor values also vary from donor to donor. That is donor-sampling uncertainty.

These components answer different questions. For the donors actually observed, how precisely have their donor-specific quantities been measured from cells? For a target population of donors, how uncertain is the estimated population mean after accounting for both imperfect cell measurements and variation among sampled donors? A standard error that answers only one of these questions should not be described as answering the other.

Definition: Let \(\theta_i\) be the donor-specific quantity of interest for donor \(i\), such as that donor's mean expression in a specified cell type. Let \(\hat{\theta}_i\) be its estimate from the sampled cells, and let \(v_i=\operatorname{Var}(\hat{\theta}_i\mid\text{donor }i)\) be its conditional cell-sampling variance. For \(D\) donors, the equally weighted donor mean estimate is \(\hat{\mu}=D^{-1}\sum_{i=1}^{D}\hat{\theta}_i\). Its target is the average of donor-specific quantities, not an average in which donors receive weights proportional to their cell counts.

The cell-level quantity may be a mean, a proportion, or another donor-specific summary. The central requirement is that \(\hat{\theta}_i\) estimate the stated \(\theta_i\) without systematic cell-sampling bias under the sampling design. For example, a sample mean is conditionally unbiased if the sampled cells represent the target cell population within that donor and the relevant mean exists. If cells were selected selectively, the sampling variance alone does not repair bias.

Conditional Uncertainty for the Observed Donors

First treat the \(D\) observed donors as fixed. Assume each \(\hat{\theta}_i\) is conditionally unbiased for \(\theta_i\), and that the cell-sampling errors are independent across donors. Conditional on these donors, the target is their finite-donor mean \(\bar{\theta}_D=D^{-1}\sum_i\theta_i\). The estimator's conditional variance is the sum of the donor-specific variances divided by \(D^2\):

$$ \operatorname{Var}(\hat{\mu}\mid\text{observed donors}) =\operatorname{Var}\left(\frac{1}{D}\sum_{i=1}^{D}\hat{\theta}_i\middle|\text{observed donors}\right) =\frac{1}{D^2}\sum_{i=1}^{D}v_i . $$

The conditional standard error is therefore \(\sqrt{D^{-2}\sum_i v_i}\). This describes repeated cell sampling within these same donors. It does not include uncertainty from choosing a different set of donors from the donor population.

Worked Example: Cell-Sampling Error for Fixed Donors

Suppose three fixed donors have estimated mean expression values \(2.1\), \(2.4\), and \(1.8\) normalized units. Their estimated conditional cell-sampling variances are \(0.04\), \(0.09\), and \(0.16\) normalized-units-squared. Assume the donor-specific estimates are conditionally unbiased and their cell-sampling errors are independent across donors.

The equally weighted estimate is \(\hat{\mu}=(2.1+2.4+1.8)/3=2.1\) normalized units. Its conditional variance is

$$ \widehat{\operatorname{Var}}(\hat{\mu}\mid\text{these donors}) =\frac{0.04+0.09+0.16}{3^2} =\frac{0.29}{9} =0.03222\ \text{normalized-units-squared}. $$

Thus the conditional standard error is \(\sqrt{0.03222}=0.1795\) normalized units. It quantifies cell-sampling uncertainty for these three donors; it does not quantify how much their mean would change if a different set of donors had been sampled.

Adding Donor-Population Uncertainty

For population inference, assume the donors are independent draws from a target donor population, with \(\operatorname{E}(\theta_i)=\mu\) and \(\operatorname{Var}(\theta_i)=\tau^2\). For each donor, assume \(\hat{\theta}_i\) is conditionally unbiased for \(\theta_i\), and that conditional cell-sampling errors are independent across donors. The cell-sampling variances \(v_i\) may differ across donors and may themselves vary randomly in the donor population.

The law of total variance separates the variation in the true donor mean from the cell-sampling variation around it. Conditional on the sampled donors, the estimator's expectation is their mean; across repeated donor samples, that mean has variance \(\tau^2/D\). The expected conditional variance is the population expectation of the donor-specific variances, not their realized sum treated as a fixed population quantity.

Theorem: Under the conditions above, for a fixed design specifying \(D\) donors and their cell-sampling allocations,
$$ \operatorname{Var}(\hat{\mu}) =\frac{\tau^2}{D}+\frac{1}{D^2}\sum_{i=1}^{D}\operatorname{E}(v_i). $$

Here \(\operatorname{E}(v_i)\) averages over the donor population under the allocation assigned to donor \(i\). If all donors have the same allocation and the same distribution of conditional variances, this reduces to \(\tau^2/D+\operatorname{E}(v_i)/D\). If the \(v_i\) are fixed design quantities, then \(\operatorname{E}(v_i)=v_i\); otherwise, replacing \(\operatorname{E}(v_i)\) by a realized \(v_i\) is not the population variance formula.

Why the Decomposition Holds

Write \(\hat{\theta}_i=\theta_i+e_i\), where \(e_i\) is the cell-sampling error. Conditional unbiasedness gives \(\operatorname{E}(e_i\mid\text{donor }i)=0\), and the conditional variance of \(e_i\) is \(v_i\). Let \(\mathcal{D}\) denote the sampled donors and their donor-specific quantities. Applying the law of total variance gives

$$ \begin{aligned} \operatorname{Var}(\hat{\mu}) &=\operatorname{Var}\{\operatorname{E}(\hat{\mu}\mid\mathcal{D})\} +\operatorname{E}\{\operatorname{Var}(\hat{\mu}\mid\mathcal{D})\}\\ &=\operatorname{Var}\left(\frac{1}{D}\sum_{i=1}^{D}\theta_i\right) +\operatorname{E}\left(\frac{1}{D^2}\sum_{i=1}^{D}v_i\right)\\ &=\frac{\tau^2}{D}+\frac{1}{D^2}\sum_{i=1}^{D}\operatorname{E}(v_i). \end{aligned} $$

The last equality uses independent, identically distributed donor values, so the variance of their mean is \(\tau^2/D\). It uses linearity of expectation for the cell-sampling term; it does not require the \(v_i\) to be nonrandom or independent of \(\theta_i\). If donors are dependent, or not sampled from a common population, the between-donor term must be modified rather than automatically set to \(\tau^2/D\).

Worked Example: Random Donor-Specific Cell Variances

Consider one randomly sampled donor, so \(D=1\). Suppose the donor's conditional cell-sampling variance \(v_1\) is \(1\) with probability \(1/2\) and \(9\) with probability \(1/2\), in squared units of the outcome. Assume the donor-specific estimate is conditionally unbiased. The population-average cell-sampling variance is

$$ \operatorname{E}(v_1)=\frac{1}{2}(1)+\frac{1}{2}(9)=5. $$

With one donor, the population variance of the estimate is \(\tau^2+\operatorname{E}(v_1)=\tau^2+5\) squared outcome units. For example, if \(\tau^2=4\), the total variance is \(4+5=9\), and the standard error is \(3\) outcome units. The cell-sampling contribution is \(5\), not whichever realized conditional variance, \(1\) or \(9\), occurs for the sampled donor. A realized \(v_1\) is relevant to a conditional calculation for that donor; the expectation is required for the unconditional population variance.

Worked Example: Unequal Cell Allocations Across Donors

Suppose \(D=3\) donors are sampled, with \(10\), \(25\), and \(100\) cells used to estimate each donor's mean. Assume independent random cell sampling within donors and a common within-donor cell variance of \(1.2\) squared outcome units. Under the usual sample-mean model, the conditional variance for donor \(i\) is \(v_i=1.2/n_i\). Assume the donor-level variance is \(\tau^2=0.25\) squared outcome units.

The three conditional variances are \(1.2/10=0.12\), \(1.2/25=0.048\), and \(1.2/100=0.012\). For this model these are specified by the allocation and common cell variance, so the population decomposition gives

$$ \operatorname{Var}(\hat{\mu}) =\frac{0.25}{3}+\frac{0.12+0.048+0.012}{3^2} =0.08333+0.02000 =0.1033\ \text{squared outcome units}. $$

The resulting standard error is \(\sqrt{0.1033}=0.3215\) outcome units. The first term reflects sampling donors; the second reflects sampling cells. Unequal cell counts lead to unequal precision of donor estimates, but the stated target still weights the three donors equally.

Estimating the Components and Checking Assumptions

In practice, \(\tau^2\) and the expected cell-sampling variances are usually unknown. A within-donor sample variance can estimate cell-level variability for a sample mean under an appropriate sampling model; for independent, identically distributed cells, the estimated conditional variance is \(s_i^2/n_i\). More complex sampling, weighting, or dependence requires a variance estimate that matches that design. A donor-level variance estimate can then inform the between-donor component. Substituting estimated components into the decomposition gives an estimated variance, but it does not automatically account for uncertainty in estimating those components, especially with few donors.

Useful checks include whether the sampled cells plausibly represent the target cells within each donor; whether cell counts and within-donor variability are recorded correctly; and whether the donor sampling scheme supports treating donors as independent draws from the stated population. Large differences in cell counts or within-donor variances make a single common cell-sampling variance implausible. Strong cell dependence, batch effects, or selection of cells by expression can also invalidate a simple \(s_i^2/n_i\) calculation. When cells are sampled without replacement from a known finite cell population, the variance should reflect that design, including a finite-population correction when appropriate.

A common mistake is to report the conditional cell-sampling standard error as though it were the population standard error. The correction is to state the target first. For a fixed set of donors, use the conditional variance \(D^{-2}\sum_i v_i\). For inference to a donor population, include the between-donor term and average random conditional variances: \(\tau^2/D+D^{-2}\sum_i\operatorname{E}(v_i)\). A second mistake is to pool all cells and thereby let donors with many sampled cells dominate an estimate intended to average donors equally. That changes the weighting and generally changes the estimand.

Donor-level procedures, including donor bootstrap methods, address uncertainty from donor sampling; resampling cells within donors can represent cell-sampling uncertainty. A nested resampling scheme can represent both levels when its resampling steps match the study design. Neither method fixes biased cell selection or makes a small number of donors equivalent to a large donor sample. The decomposition is also model-dependent: it relies on unbiased donor estimates, a meaningful donor target, and appropriate dependence assumptions. It separates sources of variance but does not by itself guarantee valid inference or provide a confidence interval.

Key takeaway: Cell counts govern the precision with which each donor is measured, while the number and variability of sampled donors govern population-level uncertainty. Keep the target explicit, and average random conditional variances when calculating unconditional variance.

Check Your Understanding

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

  1. For four fixed donors with conditional variances \(0.04\), \(0.04\), \(0.09\), and \(0.09\), what is the conditional variance and standard error of their equally weighted estimated mean?
  2. For \(D=2\), suppose \(\tau^2=1\) and each donor's random conditional variance has expectation \(0.5\). What is the population variance of the estimated donor mean?
  3. Why is a cell-pooled mean generally not the same target as an equally weighted donor mean when donors contribute different numbers of cells?
  4. Name two assumptions whose failure could make \(s_i^2/n_i\) an unsuitable estimate of a donor's cell-sampling variance.

Solutions. (1) The conditional variance is \((0.04+0.04+0.09+0.09)/4^2=0.26/16=0.01625\); the standard error is \(\sqrt{0.01625}=0.1275\) in the outcome's units. (2) The variance is \(1/2+(0.5+0.5)/2^2=0.5+0.25=0.75\) squared outcome units. (3) A pooled mean weights donors according to their cell contributions, while the donor mean assigns each donor weight \(1/D\); unequal cell counts therefore generally produce different weighted averages. (4) Examples include nonrepresentative cell selection, dependence among sampled cells, and failure of the independent, identically distributed cell model. In those cases, the variance calculation must reflect the actual sampling and dependence structure.

Clinical Biostats