Tutorials › Statistical Genetics › Deriving Pseudoreplication and the Effective Sample Size

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

Deriving Pseudoreplication and the Effective Sample Size

Learn why thousands of cells may provide far less independent information than their count suggests, and calculate the resulting design effect and effective sample size.

Advanced 10 min read

What You'll Learn

  • State the assumptions behind the equal-cluster design effect
  • Derive how intradonor correlation changes the variance of a cell-level mean
  • Calculate effective sample size for equal and unequal numbers of cells per donor
  • Quantify the standard-error inflation caused by clustering
  • Distinguish an effective-cell calculation from the number of independent donors
  • Recognize when the simple design effect does not apply

Why Cell Counts Can Overstate Information

A single-cell experiment may record expression in many thousands of cells, but cells from one donor share biological and technical influences. Their measurements are therefore often correlated. If an analysis treats every cell as an independent replicate, its standard error can be too small: the apparent amount of information is then greater than the independent information in the data.

The key quantities are the design effect, which compares the variance under clustering with the variance under independent observations, and the effective sample size, the number of independent observations that would give the same variance for a particular estimator. These quantities make the impact of within-donor correlation explicit. They do not turn cells into additional donors or replace a model that accounts for the study design.

Definition: Suppose \(N\) cells are grouped into \(J\) independent donors, with \(m_j\) cells from donor \(j\). Let \(Y_{ij}\) denote the measurement on cell \(i\) from donor \(j\), with common marginal variance \(\sigma^2\). The intradonor correlation \(\rho\) is the correlation between two distinct cells from the same donor. The design effect is the variance of the clustered cell-weighted mean divided by the variance it would have if the \(N\) measurements were independent with variance \(\sigma^2\). The corresponding effective sample size is \(N\) divided by the design effect.

Equal Numbers of Cells per Donor

Begin with the balanced case: every donor contributes \(m\) cells, so \(N=Jm\). Assume that different donors are independent, every cell measurement has variance \(\sigma^2\), and any two distinct cells from the same donor have correlation \(\rho\). This is an exchangeable within-donor correlation assumption: all within-donor pairs have the same correlation. Usually \(\rho\) is positive in single-cell data.

The cell-weighted sample mean is \(\bar{Y}=\sum_{j=1}^{J}\sum_{i=1}^{m}Y_{ij}/N\). Under independence, its variance would be \(\sigma^2/N\). Under the stated clustering assumptions, each donor contributes \(m\) individual variances and \(m(m-1)\) ordered covariance terms. The covariance for each within-donor pair is \(\rho\sigma^2\), and covariances between different donors are zero.

$$ \begin{aligned} \operatorname{Var}(\bar{Y}) &= \frac{1}{N^2} \left[Jm\sigma^2+Jm(m-1)\rho\sigma^2\right] \\ &= \frac{\sigma^2}{N}\left[1+(m-1)\rho\right]. \end{aligned} $$

The multiplier \(1+(m-1)\rho\) is the design effect for equal cluster sizes. Dividing the independent-observation variance by this multiplier gives the effective sample size. The standard error is multiplied by the square root of the design effect, because standard error is the square root of variance.

Result: With \(J\) independent donors, \(m\) cells per donor, \(N=Jm\), common cell variance \(\sigma^2\), and common within-donor correlation \(\rho\),
$$ \operatorname{DEFF}=1+(m-1)\rho,\qquad n_{\mathrm{eff}}=\frac{N}{1+(m-1)\rho},\qquad \frac{SE_{\mathrm{clustered}}}{SE_{\mathrm{independent}}} =\sqrt{1+(m-1)\rho}. $$
Here the effective sample size is an independent-cell equivalent for the variance of this mean. It is not the number of independent donors.

Worked Example: Many Cells but a Much Smaller Effective Sample Size

Suppose, hypothetically, that 8 donors each contribute 100 cells, for \(N=800\), and that a continuous cell-level measurement has intradonor correlation \(\rho=0.10\). Assume independent donors, equal cluster sizes, and a common variance across cells.

The design effect is \(1+(m-1)\rho=1+(100-1)(0.10)=1+9.9=10.9\). Thus the variance of the cell-weighted mean is 10.9 times the variance calculated under cell independence.

The effective sample size is \(n_{\mathrm{eff}}=800/10.9=73.39\) cells, approximately. This does not mean that the experiment has about 73 independent donors: it has 8 donors. It means only that, for this mean and these assumptions, the variance matches that of about 73 independent cell measurements.

The standard-error ratio is \(\sqrt{10.9}=3.302\). A standard error computed as though all 800 cells were independent would therefore be about 3.30 times smaller than the clustered standard error under the assumed model. This is a variance comparison, not a claim that every fitted model's standard error has exactly this ratio.

Short Derivation From Pairwise Covariances

The design effect follows directly by expanding the variance of a sum. For any random variables, the variance of their sum is the sum of their variances plus twice the sum of covariances over unordered pairs. Equivalently, one may sum covariances over all ordered pairs, including each variable paired with itself. This second form counts the diagonal terms as variances and is convenient for clusters.

1
Count diagonal terms.
There are \(N\) cells, each with variance \(\sigma^2\), so the diagonal contributes \(N\sigma^2\).
2
Count within-donor pairs.
Donor \(j\) has \(m_j(m_j-1)\) ordered pairs of distinct cells. Each covariance is \(\rho\sigma^2\), so all such pairs contribute \(\rho\sigma^2\sum_{j=1}^{J}m_j(m_j-1)\).
3
Divide by the square of the total cell count.
The cell-weighted mean divides the sum by \(N\), so its variance divides the variance of the sum by \(N^2\).
$$ \begin{aligned} \operatorname{Var}(\bar{Y}) &= \frac{\sigma^2}{N^2} \left[N+\rho\sum_{j=1}^{J}m_j(m_j-1)\right],\\ \operatorname{DEFF} &= \frac{\operatorname{Var}(\bar{Y})}{\sigma^2/N} =1+\rho\left(\frac{\sum_{j=1}^{J}m_j(m_j-1)}{N}\right). \end{aligned} $$

For equal cluster sizes, \(\sum_j m_j(m_j-1)=Jm(m-1)=N(m-1)\), which reduces the expression to \(1+(m-1)\rho\). This establishes the equal-size result and also shows how to calculate the design effect when cluster sizes differ, provided the same variance and correlation assumptions remain reasonable.

Unequal Cluster Sizes and the Role of Donors

When donors contribute different numbers of cells, the cell-weighted mean gives more weight to donors with more observed cells. Under the same common-variance and common-correlation assumptions, the design effect can be written as \(1+\rho(\sum_j m_j^2/N-1)\). This depends on both the total number of cells and how those cells are distributed across donors. More uneven cluster sizes generally increase the design effect for positive \(\rho\), compared with a more balanced allocation at the same total cell count.

Worked Example: Design Effect With Unequal Donor Contributions

Consider hypothetical data from 3 independent donors contributing 4, 8, and 12 cells, respectively. There are \(N=4+8+12=24\) cells. Suppose the common intradonor correlation is \(\rho=0.20\), and assume a common marginal variance.

The sum of squared cluster sizes is \(4^2+8^2+12^2=16+64+144=224\). Using the unequal-size formula, \(\operatorname{DEFF}=1+\rho(\sum_j m_j^2/N-1)\). Substitution gives \(1+0.20(224/24-1)=1+0.20(9.333-1)=1+1.667=2.667\).

The effective sample size is \(24/2.667=9.000\) cells, and the standard-error inflation relative to an independence calculation is \(\sqrt{2.667}=1.633\). An effective-cell equivalent greater than the 3-donor count is possible here: the quantity compares the variance of a cell-weighted mean to independent cells. It does not estimate how many independent donors are available for a donor-level genetic contrast.

The donor count remains essential in genetic studies because a donor's genotype is shared across that donor's cells. Replicating that genotype across many cells does not create independent genotype observations. The effective sample size is useful for quantifying loss of precision for a specified cell-level mean; it should not be substituted mechanically for the number of donors when reasoning about genetic replication or inferential degrees of freedom.

How Cluster Size and Correlation Affect Precision

The equal-size formula gives two immediate comparisons. If \(\rho=0\), then \(\operatorname{DEFF}=1\) and \(n_{\mathrm{eff}}=N\): clustering does not inflate the variance under this model. If \(\rho=1\), all cells within each donor are perfectly correlated, so \(\operatorname{DEFF}=m\) and \(n_{\mathrm{eff}}=J\). In between, adding cells within a donor increases information, but less than adding the same number of independent observations when \(\rho>0\).

Worked Example: Same Total Cells, Different Cluster Sizes

Compare two hypothetical designs, each with 1,000 cells and intradonor correlation \(\rho=0.05\). Design A has 20 donors with 50 cells each; Design B has 100 donors with 10 cells each. Assume equal cluster sizes within each design, independent donors, and the same marginal cell variance.

For Design A, \(\operatorname{DEFF}=1+(50-1)(0.05)=1+2.45=3.45\). Therefore \(n_{\mathrm{eff}}=1000/3.45=289.9\), and the standard error is inflated by \(\sqrt{3.45}=1.857\) relative to treating the cells as independent.

For Design B, \(\operatorname{DEFF}=1+(10-1)(0.05)=1+0.45=1.45\). Therefore \(n_{\mathrm{eff}}=1000/1.45=689.7\), and the standard-error inflation is \(\sqrt{1.45}=1.204\). Under these assumptions, spreading the same number of cells over more independent donors reduces the design effect. The effective sample sizes remain cell-equivalents; the designs have 20 and 100 independent donors, respectively.

This comparison explains why collecting additional cells from donors already well represented in the data may yield diminishing returns when within-donor correlation is positive. It does not imply that cells beyond the effective sample size should be discarded. Additional cells can improve measurement precision, characterize within-donor variation, and support other analyses; the calculation concerns the variance of a particular mean under a particular model.

Assumptions, Scope, and Common Pitfalls

The formulas are exact for the stated variance structure and cell-weighted mean. They require independent donor clusters, a common marginal variance, and a common within-donor correlation. Equal-size formulas additionally require the same number of analyzed cells per donor. In applications, the correlation and variance structure may differ across donors, cell types, or expression levels. If those assumptions are poor, a single design effect can be only an approximation.

The result concerns a simple mean, not every estimator. Regression coefficients can have different precision effects depending on the distribution of predictors across donors and cells, covariate adjustment, unequal variances, and the model used to account for clustering. The effective sample size from this formula should not be treated as a universal sample size for all tests or models. Nor is an estimated design effect a substitute for checking whether the inferential procedure respects the experimental units.

  • Mistake: “There are 10,000 cells, so the genetic analysis has 10,000 independent replicates.” Cells from a donor are correlated, and cells from one donor share the same genotype. The count of cells is not the count of independent donors.
  • Mistake: “The effective sample size is the number of donors.” Not generally. It is an independent-cell equivalent for the variance of a specified mean. With \(\rho=1\) and equal cluster sizes it equals the donor count; otherwise it can differ.
  • Mistake: “The design effect tells us how much every standard error is inflated.” The square-root multiplier applies to the simple mean under the assumptions used to derive it. Regression and other estimators need variance calculations that match their own design and model.
Key takeaway: With equal numbers of cells per donor, the variance inflation is \(1+(m-1)\rho\), and the standard-error inflation is its square root. Always report the number of donors as well as the number of cells, and interpret effective sample size only for the estimator and assumptions that define it.

Check Your Understanding

Use the stated formulas and explain what each computed quantity means.

  1. With 12 donors, 25 cells per donor, and intradonor correlation 0.04, calculate the design effect and effective sample size.
  2. For the same design, by what factor is the standard error of the mean inflated relative to an independence calculation?
  3. Explain why an effective sample size of 100 cells would not mean that a study with 10 donors has 100 independent genotype observations.
  4. For unequal cluster sizes, name the assumptions needed to use the design-effect formula derived here.
  5. Why should the design effect for a simple mean not automatically be applied to a regression coefficient?
Clinical Biostats