Tutorials › Statistical Methods for Single-Cell RNA Sequencing › A Worked Stability Analysis for Two Cell Populations

Cluster Validity and Stability · Tutorial 289 of 700

A Worked Stability Analysis for Two Cell Populations

Learn how overlap and sample size change validity scores and resampling stability in a two-population simulation, and why neither alone establishes biological truth.

Advanced 12 min read

What You'll Learn

  • Specify a two-population simulation in which separation controls overlap.
  • Calculate silhouette values and interpret the overall score.
  • Distinguish population overlap from uncertainty in estimated cluster centers.
  • Summarize resampling stability on a common set of cells.
  • Recognize when sample size improves stability without resolving population overlap.
  • Combine validity and stability evidence without treating either as proof of biological truth.

Why a Two-Population Example Is Useful

A clustering method can return two groups even when the underlying cell populations overlap substantially. Conversely, populations that are well separated in a chosen representation can yield a convincing validity score and highly reproducible assignments. A controlled two-population simulation helps separate these situations: we set the population separation and sample size, then examine what an internal validity score and a resampling stability measure reveal.

The goal is not to identify a universal score threshold. A silhouette or stability value depends on the geometry, distance, clustering procedure, and resampling design. The useful question is how each measure responds as conditions change, and what conclusions remain justified.

Simulation model: Let \(Z_i\in\{1,2\}\) denote the population of cell \(i\), with equal population probabilities. For a one-dimensional representation \(X_i\), suppose \(X_i\mid Z_i=1\sim N(-\delta/2,\sigma^2)\) and \(X_i\mid Z_i=2\sim N(\delta/2,\sigma^2)\). Here \(\delta>0\) is the distance between population means and \(\sigma>0\) is the within-population standard deviation. The standardized separation is \(d=\delta/\sigma\). Larger \(d\) means less overlap; it does not guarantee that a clustering algorithm recovers biologically meaningful groups.

This model makes assumptions that are intentionally simple: two equally frequent populations, equal within-population variances, and a one-dimensional Gaussian representation. Real single-cell data can violate all three assumptions, for example through unequal population sizes, non-Gaussian shapes, donor effects, or a continuous cell state. Here the simplified setting lets us vary overlap and sample size separately.

Overlap and Sample Size Are Different

Even if the population parameters were known, some cells would be difficult to classify when the distributions overlap. With equal prior probabilities and equal variances in this model, the optimal classification boundary is zero, halfway between the two means. The probability of assigning a cell to the wrong population is the same for each population:

$$ P(\text{error}\mid Z_i=1) =P(X_i>0\mid Z_i=1) =\Phi\left(-\frac{\delta}{2\sigma}\right) =\Phi\left(-\frac{d}{2}\right), $$

where \(\Phi\) is the standard normal cumulative distribution function. The same error probability applies to population 2 by symmetry. This is a population-level limit for classification under the stated model; it is not a guarantee about the result of a particular clustering algorithm.

Worked Example: Translating Separation Into Overlap

Suppose the within-population standard deviation is \(\sigma=1\) unit. Compare separations \(\delta=4\), \(2\), and \(1\) unit.

For \(\delta=4\), \(d=4/1=4\), so the optimal error probability is \(\Phi(-4/2)=\Phi(-2)\approx0.0228\), or about 2.28%. For \(\delta=2\), \(d=2\), giving \(\Phi(-1)\approx0.1587\), or about 15.9%. For \(\delta=1\), \(d=1\), giving \(\Phi(-0.5)\approx0.3085\), or about 30.9%.

Thus, under this model, reducing separation increases the fraction of cells that lie on the “wrong” side of the optimal boundary. Increasing the number of sampled cells does not change these population error probabilities: it gives more observations from the same overlapping distributions.

Sample size does affect how precisely the population means are estimated. If the numbers of observed cells are \(n_1\) and \(n_2\), and the model assumptions hold, the difference between their sample means has standard error \(SE=\sigma\sqrt{1/n_1+1/n_2}\). More cells reduce this uncertainty. They do not, by themselves, make two overlapping population distributions less overlapping.

Worked Example: More Cells, More Precise Centers

Suppose the two populations have \(\sigma=1\) and \(\delta=2\), and the same number \(n\) of cells is sampled from each. The standard error of the difference between the two sample means is \(SE=\sigma\sqrt{1/n+1/n}\).

With \(n=10\) per population, \(SE=1\sqrt{0.1+0.1}=\sqrt{0.2}\approx0.447\) units. With \(n=50\) per population, \(SE=1\sqrt{0.02+0.02}=\sqrt{0.04}=0.200\) units. The estimated mean difference is therefore more precise in the larger sample, while the population separation remains \(d=2\) and the model’s optimal classification error remains \(\Phi(-1)\approx0.1587\).

This distinction matters for stability: larger samples may make estimates and assignments more reproducible, even though individual cells remain difficult to classify near the overlap region.

Validity: What the Silhouette Measures

For a fixed partition and a chosen distance, the silhouette summarizes whether each cell is closer, on average, to its assigned cluster than to its nearest alternative cluster. For cell \(i\), let \(a(i)\) be the mean distance from \(i\) to the other cells in its assigned cluster. For each other cluster, calculate the mean distance from \(i\) to that cluster; let \(b(i)\) be the smallest such mean. For a cell in a singleton cluster, the silhouette is conventionally set to zero.

Definition: For a cell that is not in a singleton cluster, its silhouette is \(s(i)=[b(i)-a(i)]/\max\{a(i),b(i)\}\). It lies between \(-1\) and \(1\). A value near 1 indicates that the cell is much closer, on average, to its assigned cluster; a value near 0 indicates similar within-cluster and nearest-other-cluster distances; a negative value indicates that the nearest alternative cluster is closer on average. The overall silhouette is the arithmetic mean of the cell-level silhouettes.

Worked Example: Correcting the Overall Silhouette Calculation

Consider a six-cell, two-cluster distance illustration. The cell-level distance summaries are given below; \(a(i)\) is the within-cluster mean distance and \(b(i)\) is the mean distance to the nearest other cluster. These summaries are the inputs to the silhouette formula.

Cell\(a(i)\)\(b(i)\)\(s(i)\)
1140.75
21.540.625
3150.8
4140.75
51.540.625
6150.8

For cell 2, the mean distance to the other cluster is \((3+4+5)/3=4\), and its within-cluster mean distance is \(1.5\). Thus \(s(2)=(4-1.5)/\max(1.5,4)=2.5/4=0.625\). Cell 5 has the same summaries and also has silhouette \(0.625\). For cell 6, \(a(6)=1\) and \(b(6)=5\), so \(s(6)=(5-1)/5=0.8\).

The overall silhouette is therefore \((0.75+0.625+0.8+0.75+0.625+0.8)/6=4.35/6=0.725\). It is an average of cell-level distance summaries, not the proportion of cells that are correctly assigned.

In the two-population simulation, a well-separated pair of groups will often have larger average silhouettes than a heavily overlapping pair, provided the chosen distance represents the simulated geometry reasonably. But the score is a property of the observed representation and partition. It does not establish that the groups are discrete cell types, nor that the chosen number of clusters is biologically correct.

Stability: Would the Assignments Recur?

Stability asks whether similar clustering assignments are recovered when the data are perturbed and the analysis is repeated. To compare runs, cluster labels must first be aligned because labels such as “cluster 1” and “cluster 2” are arbitrary. A useful design here is to repeatedly subsample cells, rerun the clustering procedure with the same specified preprocessing and settings, and compare assignments on a common set of cells. The comparison should account for cells absent from a subsample rather than silently treating them as assigned.

For a simple assignment-agreement summary, suppose each of \(R\) runs assigns every cell in a fixed reference set. After aligning labels, calculate the fraction of reference cells assigned to the same cluster as in a designated reference run, separately for each run. The mean of these fractions is an easy-to-read stability summary. Other established comparisons, such as adjusted Rand index or variation of information, use different summaries of partition agreement; their values and interpretations should not be interchanged.

Worked Example: Summarizing Agreement Across Resampled Runs

Suppose a fixed reference set has 10 cells. After matching cluster labels to a reference partition, five resampled runs agree with that partition for 9, 8, 10, 9, and 8 cells, respectively. Assume all 10 cells are comparable in every run.

The run-specific agreement fractions are \(9/10=0.90\), \(8/10=0.80\), \(10/10=1.00\), \(9/10=0.90\), and \(8/10=0.80\). Their mean is \((0.90+0.80+1.00+0.90+0.80)/5=4.40/5=0.88\). Equivalently, there are \(44\) agreements among \(5\times10=50\) cell-run comparisons, giving \(44/50=0.88\).

The result means that assignments agreed with this reference partition for 88% of the evaluated cell-run comparisons in this illustrative resampling design. It does not mean that 88% of the cells are known to belong to true populations; the reference partition itself may be wrong, and the agreement depends on which cells and perturbations were used.

Reading Validity and Stability Together

The following hypothetical results illustrate patterns that can arise when the two simulation factors are varied. The scores are illustrative, not universal expected values. Assume that the same distance, clustering algorithm, and resampling procedure are used throughout. Stability is summarized by mean matched assignment agreement on a common reference set.

Separation \(d\)Cells per populationIllustrative mean silhouetteIllustrative stabilityInterpretation
41000.710.96Groups are well separated in this representation and assignments recur often.
21000.440.82Overlap is greater; some cells are less clearly assigned.
11000.200.61Substantial overlap is reflected in weaker distance separation and less reproducible assignments.
14000.210.78More cells improve repeatability in this illustration, while the populations remain overlapping.

The last two rows isolate the key distinction: sample size can improve the reproducibility of a fitted partition without materially improving the population separation measured by silhouette. That pattern is not guaranteed. Stability can remain low if the clustering algorithm is sensitive to initialization, if preprocessing changes across runs, or if the overlap region contains many cells whose assignments are intrinsically ambiguous.

1
Set the simulation conditions.
Choose \(\delta\), \(\sigma\), the number of cells per population, and a representation and distance. Vary overlap and sample size separately when interpreting their effects.
2
Fit the specified clustering procedure.
Keep the procedure fixed for a controlled comparison, and record its settings. If random initialization is relevant, distinguish seed variation from data resampling.
3
Calculate validity and stability.
Compute the silhouette on the fitted partition and compare appropriately aligned partitions across resampled runs on a clearly defined common set of cells.
4
Interpret both in context.
Describe what the distance score and the resampling comparison show, then check whether their pattern is compatible with the known simulation conditions. Do not substitute either metric for evidence of biological truth.

Assumptions, Diagnostics, and Alternatives

The Gaussian model is useful for explanation, but conclusions drawn from its numerical overlap calculation depend on equal variances, equal prior probabilities, and the one-dimensional feature. The silhouette calculation requires a defined distance and a partition with meaningful within- and between-cluster distances. Resampling stability requires a perturbation design that reflects the intended source of uncertainty and a comparison that handles cluster-label permutations and missing cells correctly.

Useful diagnostics include plotting the simulated distributions and their overlap, checking whether cell-level silhouettes cluster near zero or include many negative values, and inspecting which cells change assignments across runs. A high overall silhouette can conceal a small, poorly separated subset; a high mean stability can conceal a rare cluster that repeatedly disappears. Also check whether conclusions change under reasonable preprocessing or feature perturbations. If the result depends strongly on a particular representation or random seed, report that sensitivity rather than presenting a single score as definitive.

The main alternatives answer related but distinct questions. The silhouette evaluates within-partition geometry for a chosen distance. Resampling agreement evaluates recurrence under a specified perturbation. In a simulation, comparison with the known generating labels can directly evaluate recovery of the simulated populations, but such labels are unavailable in ordinary data and recovery of a simulation’s labels does not establish biological validity. A plot can reveal shape or overlap that a scalar score hides, but visual separation is not a substitute for a defined quantitative comparison.

A common mistake is to reason, “The stability is high, so these must be true cell populations.” The correction is that stability establishes reproducibility only under the procedure and perturbations used. A method can repeatedly recover a partition imposed by a strong technical gradient or by a modeling choice. The earlier material on stable clusters and truth is directly relevant: reproducibility is valuable evidence about robustness, but it is not proof of biological meaning.

Key takeaway: In a two-population analysis, decreasing separation increases population overlap, while increasing sample size can improve estimation and resampling repeatability. Validity and stability describe different properties of the fitted partition; neither alone verifies that the partition represents true cell populations.

Check Your Understanding

Answer each question using the stated model and distinguish population overlap from reproducibility.

  1. With equal variances and equal population probabilities, what is the optimal classification error when \(d=3\)?
  2. If the sample size increases while \(\delta\) and \(\sigma\) remain fixed, does the model’s population classification error change? Explain.
  3. A cell has \(a(i)=2\) and \(b(i)=3\). Calculate its silhouette and interpret it.
  4. In five resampled runs, matched assignment agreements are 18, 17, 19, 16, and 20 out of 20 cells. Calculate mean agreement.
  5. Give one reason a high resampling stability value does not prove that the clusters are biologically true.

Solutions. (1) The error is \(\Phi(-d/2)=\Phi(-1.5)\approx0.0668\), or 6.68%. (2) No. The population error remains \(\Phi(-\delta/(2\sigma))\); larger samples can improve estimation precision but do not change the distributions’ overlap. (3) \(s(i)=(3-2)/\max(2,3)=1/3\approx0.333\). The cell is closer on average to its assigned cluster than to the nearest alternative, but the separation is not large. (4) The mean is \((18+17+19+16+20)/(5\times20)=90/100=0.90\), or 90% agreement. (5) For example, the same technical gradient or analysis choice can produce a reproducible partition without corresponding to distinct biological populations.

Clinical Biostats