Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Silhouette Widths for Cluster Separation

Cluster Validity and Stability · Tutorial 264 of 700

Silhouette Widths for Cluster Separation

Learn to calculate cell-level and cluster- and cell-averaged silhouette widths, interpret negative and positive values, and assess whether distance choices are meaningful for sparse single-cell data.

Advanced 10 min read

What You'll Learn

  • Define a cell’s average within-cluster distance and its average distance to the nearest other cluster.
  • Calculate a silhouette width and interpret its range and sign.
  • Distinguish cell-weighted and equally cluster-weighted summaries.
  • Diagnose how sparse profiles, distance choices, and cluster size affect interpretation.
  • Recognize singleton clusters, ties, and zero-distance edge cases.
  • Use silhouette summaries alongside other cluster diagnostics rather than as proof of biological validity.

What a Silhouette Width Measures

A clustering assigns cells to groups, but the labels alone do not show whether each cell sits comfortably in its assigned cluster or near a competing one. A silhouette width summarizes this local comparison using distances between cells. Its value is dimensionless: it describes relative separation, not a distance in expression units and not evidence that a cluster is biologically real.

The earlier material on cluster validity emphasizes that a diagnostic is only meaningful relative to the representation and question being studied. For single-cell RNA sequencing, this matters because sparse expression profiles can make distances sensitive to normalization, feature selection, and the many zero entries. A silhouette calculation is straightforward; choosing and interpreting its input distances requires care.

Definition: Suppose \(n\) cells are assigned to \(K\geq 2\) nonempty clusters. Let \(d(i,j)\) be the distance or dissimilarity between cells \(i\) and \(j\), and let \(C(i)\) be the cluster containing cell \(i\). For a cell in a cluster with at least two members, its average within-cluster distance is $$ a(i)=\frac{1}{|C(i)|-1}\sum_{\substack{j\in C(i)\\j\ne i}}d(i,j). $$ For any other cluster \(C\), define the average distance from cell \(i\) to that cluster as $$ d(i,C)=\frac{1}{|C|}\sum_{j\in C}d(i,j). $$ The nearest-other-cluster distance is \(b(i)=\min_{C\ne C(i)}d(i,C)\). If \(\max\{a(i),b(i)\}>0\), the cell-level silhouette width is $$ s(i)=\frac{b(i)-a(i)}{\max\{a(i),b(i)\}}. $$

The average to another cluster is taken over all its cells, not just its nearest individual cell. The minimum is then taken across the other clusters. Thus \(b(i)\) measures the average dissimilarity to the closest competing cluster, while \(a(i)\) measures the cell’s average dissimilarity to its assigned cluster mates.

The formula presumes finite, nonnegative distances. A metric is a natural choice, but the arithmetic also works for a finite nonnegative dissimilarity that is not a metric; its interpretation then depends on what that dissimilarity represents. At least two clusters are required to define \(b(i)\). For a singleton cluster, \(a(i)\) has no terms, so the usual convention is to set its silhouette to zero. If both \(a(i)\) and \(b(i)\) are zero, the formula has a zero denominator; a common convention is also to set \(s(i)=0\) and report that such ties occurred.

Interpreting the Sign and Size

When \(s(i)\) is near 1, the cell is, on average, much closer to its own cluster than to its nearest alternative. A value near 0 indicates that the two average distances are similar. A negative value means \(a(i)>b(i)\): on this distance scale, the cell is closer on average to another cluster than to its assigned cluster. Negative values may flag a boundary cell, an assignment that merits review, or a mismatch between the chosen distance and the structure of interest. They do not by themselves identify which explanation is correct.

The normalization makes silhouettes comparable across cells measured on the same dissimilarity scale. If \(b(i)\geq a(i)\), then \(s(i)=1-a(i)/b(i)\). If \(a(i)>b(i)\), then \(s(i)=b(i)/a(i)-1\). The value is therefore dimensionless and ranges from \(-1\) to 1 whenever the denominator is positive.

Justification of the range: Since \(a(i)\) and \(b(i)\) are nonnegative, their difference satisfies $$ -\max\{a(i),b(i)\}\leq b(i)-a(i)\leq \max\{a(i),b(i)\}. $$ Dividing by the positive denominator \(\max\{a(i),b(i)\}\) gives \(-1\leq s(i)\leq 1\). If \(a(i)=0<b(i)\), then \(s(i)=1\); if \(b(i)=0<a(i)\), then \(s(i)=-1\). These extremes describe distance relationships, not certainty about cluster membership.

Worked Example: Calculating Widths From a Small Distance Table

Consider a hypothetical four-cell dataset with clusters \(A=\{1,2\}\) and \(B=\{3,4\}\). Suppose the within-cluster distances are \(d(1,2)=d(3,4)=2\), and the cross-cluster distances are \(d(1,3)=5\), \(d(1,4)=7\), \(d(2,3)=6\), and \(d(2,4)=8\). These are nonnegative and symmetric, and there are two nonempty clusters.

For cell 1, \(a(1)=2\), while its average distance to \(B\) is \(b(1)=(5+7)/2=6\). Thus \(s(1)=(6-2)/6=4/6=0.6667\). For cell 2, \(a(2)=2\) and \(b(2)=(6+8)/2=7\), so \(s(2)=(7-2)/7=5/7\approx0.7143\).

For cell 3, \(a(3)=2\) and \(b(3)=(5+6)/2=5.5\), giving \(s(3)=(5.5-2)/5.5=3.5/5.5=7/11\approx0.6364\). For cell 4, \(a(4)=2\) and \(b(4)=(7+8)/2=7.5\), giving \(s(4)=(7.5-2)/7.5=5.5/7.5=11/15\approx0.7333\). All four widths are positive, so each cell is, on average, closer to its own cluster than to the other cluster under these distances.

Summarizing Cells and Clusters

The ordinary overall average silhouette is the mean across cells:

$$ \bar{s}_{\mathrm{cell}}=\frac{1}{n}\sum_{i=1}^{n}s(i). $$

This is a cell-weighted summary: a cluster with more cells contributes more to the average. One can also calculate each cluster’s mean silhouette and average those means equally:

$$ \bar{s}_{C}=\frac{1}{|C|}\sum_{i\in C}s(i), \qquad \bar{s}_{\mathrm{equal\ cluster}}=\frac{1}{K}\sum_{C}\bar{s}_{C}. $$

The equally cluster-weighted value is a separate summary, not the same as the usual overall cell mean unless all clusters have equal sizes or happen to have the same mean silhouette. Reporting both can be useful when cluster sizes are imbalanced: one summarizes the average cell, while the other gives each cluster equal influence. Neither replaces examining the distribution of cell-level values and cluster-level means.

Worked Example: Cell-Weighted Versus Equally Cluster-Weighted Means

Suppose a hypothetical dataset has two clusters. The cell-level silhouettes in cluster \(A\) are \(0.75\) and \(2/3\); those in cluster \(B\) are \(0.4\), \(9/14\), and \(11/18\). These values could arise from \((a,b)\) pairs \((1,4)\), \((1,3)\), \((3,5)\), \((5,14)\), and \((7,18)\), respectively, because each pair gives \(s=(b-a)/b\). All distances are positive, and there are no singleton clusters.

The unrounded cluster means are $$ \bar{s}_{A}=\frac{0.75+2/3}{2}=\frac{17}{24}=0.708333\ldots, \qquad \bar{s}_{B}=\frac{0.4+9/14+11/18}{3}=\frac{521}{945}=0.551322\ldots. $$

The cell-weighted mean uses all five cells: $$ \bar{s}_{\mathrm{cell}}=\frac{0.75+2/3+0.4+9/14+11/18}{5} =\frac{3869}{6300}=0.614126\ldots\approx0.6141. $$ The equally cluster-weighted mean is calculated from the unrounded cluster means: $$ \bar{s}_{\mathrm{equal\ cluster}}= \frac{(0.75+2/3)/2+(0.4+9/14+11/18)/3}{2} =0.629828\ldots\approx0.6298. $$ It is larger because the smaller cluster \(A\) has the higher mean and receives half the weight in the cluster-balanced summary, despite containing only two of the five cells. Rounding the cluster means before the final calculation can change the last reported digit, so retain full precision until the final rounding.

Using Silhouettes With Sparse Expression Profiles

A cell’s expression profile may contain many zeros, and the distances between profiles depend on the representation. Applying Euclidean distance directly to untransformed counts, for example, may emphasize library size or highly abundant features rather than the biological differences of interest. Other representations and dissimilarities can emphasize different aspects of the data. A silhouette does not correct for those choices: it evaluates the supplied distances and the supplied clustering.

For a defensible interpretation, the cells used to calculate distances should be represented consistently with the clustering question. State the representation and distance, and check whether the resulting values are driven by technical scale, a few extreme cells, or the prevalence of zeros. Sparse profiles can also produce many ties or repeated distances. These do not invalidate the arithmetic, but can reduce the ability of a distance to distinguish cells and make near-zero silhouettes less informative.

Worked Example: A Negative Width in a Sparse-Profile Analysis

In a hypothetical analysis of transformed single-cell profiles, a cell assigned to cluster \(A\) has average distance \(a(i)=0.84\) to other cells in \(A\). Its average distance to cluster \(B\) is \(0.56\), and its average distance to any other cluster is larger, so \(b(i)=0.56\). The distances are finite and nonnegative, and the cell is not a singleton.

The silhouette is $$ s(i)=\frac{0.56-0.84}{\max\{0.56,0.84\}} =\frac{-0.28}{0.84}=-0.3333\ldots. $$ This cell is, on average, closer to \(B\) than to its assigned cluster under the stated dissimilarity. The appropriate conclusion is that its assignment or the distance representation warrants inspection, not that the cell must be reassigned. For instance, a nearby transition state, technical variation, or an unsuitable distance could produce the same sign. A second cell with \(a(i)=0.30\) and \(b(i)=0.60\) has \(s(i)=(0.60-0.30)/0.60=0.5000\), indicating clearer relative separation on that same scale. Neither value alone establishes a biological interpretation.

Diagnostics, Alternatives, and Limitations

A single mean can conceal important structure. Inspect cell-level values and cluster-specific means, noting the proportion of negative values, clusters with many widths near zero, and clusters whose mean is low despite a high overall average. Check whether results change materially under reasonable choices of representation or distance. If a nearest competing cluster is consistently different from the one suggested by the scientific question, that is useful diagnostic information rather than a reason to hide the cell-level pattern.

Silhouette widths compare average distances, so they can miss structure that is not well summarized by averages. A cluster may contain subgroups, have uneven density, or be elongated; a single mean silhouette does not describe those features fully. A singleton’s conventional width of zero is a bookkeeping convention, not evidence of ambiguous placement. Similarly, if all relevant distances are zero, assigning zero by convention prevents division by zero but cannot recover separation that the distance provides no way to express.

The main alternatives are complementary diagnostics, not interchangeable versions of the same calculation. Visual inspection of a low-dimensional representation can reveal patterns, but projection may distort distances. Graph-based diagnostics examine connectivity in a neighborhood graph, a different aspect of cluster structure. Cluster validity can also be assessed with other scalar indices, which summarize separation and cohesion differently; no one score is a universal criterion for choosing a clustering. In practice, report the distance definition and representation, show cluster-level and cell-level summaries, and interpret the result alongside the scientific context and other diagnostics.

1
Specify the input.
State the cell representation, distance or dissimilarity, and fixed cluster assignment being evaluated.
2
Calculate cell-level quantities.
For each cell, calculate its average distance within its cluster and its average distance to every other cluster; use the smallest of the latter averages as \(b(i)\).
3
Summarize without hiding imbalance.
Report the cell-weighted mean and cluster-level means; if useful, also report the equally cluster-weighted mean.
4
Investigate warnings.
Inspect negative and near-zero values, singleton clusters, zero-distance ties, and sensitivity to plausible distance choices before drawing conclusions.
Common pitfall: “The average silhouette is positive, so every cell is well assigned and the clusters are biologically valid.” This does not follow. A positive average can coexist with many negative cell-level widths, and the calculation only describes separation under the chosen distances and clustering. Examine the cell- and cluster-level results and use independent biological and technical evidence before making broader claims.

Check Your Understanding

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

  1. A cell has \(a(i)=0.6\) and \(b(i)=0.9\). Calculate its silhouette and interpret the sign.
  2. A cell has \(a(i)=1.2\) and \(b(i)=0.8\). Calculate its silhouette and explain what it indicates.
  3. Two clusters have mean silhouettes \(0.7\) and \(0.3\), with sizes 10 and 30. Calculate the cell-weighted and equally cluster-weighted means.
  4. Why is a singleton’s conventional silhouette of zero not evidence that it lies midway between clusters?

Solutions. For question 1, \(s=(0.9-0.6)/0.9=0.3/0.9=0.3333\). It is positive: the cell is closer on average to its assigned cluster than to its nearest alternative. For question 2, \(s=(0.8-1.2)/1.2=-0.4/1.2=-0.3333\). The cell is closer on average to another cluster under this distance, so its assignment or representation merits inspection. For question 3, the cell-weighted mean is \((10(0.7)+30(0.3))/40=(7+9)/40=0.4000\); the equally cluster-weighted mean is \((0.7+0.3)/2=0.5000\). The difference occurs because the smaller, higher-silhouette cluster receives equal weight in the second summary. For question 4, a singleton has no other cell in its own cluster, so its within-cluster average \(a(i)\) is undefined. Setting its silhouette to zero is a convention for this edge case, not a calculated indication of equal separation.

Clinical Biostats