Tutorials › Multivariate Statistics (Graduate) › Bootstrap Stability of Model-Based Clusters

Model-Based Clustering · Tutorial 672 of 975

Bootstrap Stability of Model-Based Clusters

Use case-resampled refits and optimal label matching to measure how reproducibly a selected Gaussian clustering model assigns observations.

Advanced 11 min read

What You'll Learn

  • Define case-resampling stability for a fixed Gaussian mixture model.
  • Refit a selected clustering model to bootstrap samples, including repeated cases.
  • Match arbitrary component labels by maximizing agreement on a common evaluation set.
  • Calculate matched agreement and cluster-specific Jaccard stability.
  • Interpret bootstrap variability without mistaking stability for cluster validity.
  • Recognize limitations from model selection, local optima, and weakly separated components.

Why assess cluster stability?

A fitted clustering can look clear in one data set and change substantially when a few cases are perturbed. This matters because the component labels are estimated rather than observed: a cluster that appears only under a small change in the cases may be a fragile feature of the fitted analysis. Bootstrap stability asks a focused question: if the observed cases were perturbed by case resampling and the same clustering model were refitted, would the resulting assignments be similar?

Here the model is a selected Gaussian mixture with a fixed number \(K\) of components and a fixed covariance constraint or covariance family. The stability exercise holds those choices fixed so that it assesses variation in the fitted clusters, not variation in model selection. It is a sensitivity analysis under resampling, not a test that clusters are real or useful.

Definition and resampling protocol

Definition: For a fixed selected clustering model, case-resampling bootstrap stability is the variability of its refitted cluster assignments when each bootstrap data set is formed by drawing \(n\) cases with replacement from the observed \(n\) cases. To compare a bootstrap fit with a reference fit, evaluate both fits on the same fixed set of cases and match component labels before measuring agreement.

Let the observed vectors be \(x_1,\ldots,x_n\), and let the selected model have \(K\) Gaussian components. Its fitted density has the form

$$ g(x;\hat\theta)=\sum_{k=1}^{K}\hat\pi_k \phi_d(x;\hat\mu_k,\hat\Sigma_k), \qquad \sum_{k=1}^{K}\hat\pi_k=1, $$

where the covariance matrices obey the selected covariance structure. A reference fit on the original data gives a hard assignment \(z_i^{(0)}\) for each case, usually the component with largest fitted posterior membership probability. For bootstrap replicate \(b\), draw \(n\) indices independently with replacement, refit the same model, and evaluate its fitted posterior memberships on every original case \(x_i\). This gives bootstrap-fit labels \(z_i^{(b)}\) on the common evaluation set, even for cases absent from that replicate's resample.

This common set is important. Bootstrap samples contain repeated rows and omit some original rows; comparing label sequences in resample order does not compare the same cases. Evaluating each fit on the original cases avoids that mismatch. The reference fit and bootstrap fit may give the same partition but use different numerical labels, so labels must also be aligned.

1
Fix the analysis being assessed.
Specify \(K\), the covariance model, preprocessing, and the fitting procedure. For a conditional stability assessment, keep these fixed across replicates.
2
Generate and fit bootstrap samples.
For each replicate, resample \(n\) cases with replacement and refit the specified Gaussian model, using a consistent policy for initialization and convergence.
3
Predict on a shared set.
Obtain hard labels from the reference fit and from each bootstrap fit for the same original \(n\) cases.
4
Align labels and summarize.
Choose the component permutation with greatest agreement, then report overall agreement and cluster-specific summaries across replicates.

Matching labels across fits

Mixture-component labels have no intrinsic order. A fit that calls a particular group “component 1” and another fit that calls it “component 3” may represent the same partition. Matching removes this arbitrary relabeling before any agreement score is calculated.

For one replicate, define the \(K\)-by-\(K\) overlap table \(N\) by

$$ N_{kj}=\#\{i:z_i^{(0)}=k,\ z_i^{(b)}=j\}. $$

Rows refer to reference clusters and columns to bootstrap-fit clusters. A permutation \(\pi\) maps each reference label \(k\) to one bootstrap label \(\pi(k)\). Choose the permutation maximizing the number of cases whose labels agree after this mapping. This is a linear assignment problem; for moderate \(K\), the Hungarian algorithm finds the optimum efficiently.

Result: If the two fits have the same \(K\) and are evaluated on the same cases, the maximum matched agreement is \(n^{-1}\max_{\pi}\sum_{k=1}^{K}N_{k,\pi(k)}\), where the maximum is over all permutations of \(1,\ldots,K\). This is the largest possible fraction of identical labels obtainable by relabeling the bootstrap fit.

To verify the result, fix any permutation \(\pi\). A case contributes one to the agreement count precisely when its reference label is \(k\) and its bootstrap label is \(\pi(k)\) for some \(k\). Those cases are exactly the cells \(N_{k,\pi(k)}\), so the agreement count is \(\sum_k N_{k,\pi(k)}\). Every relabeling is a permutation, and maximizing this count over all permutations therefore gives the best possible agreement. Dividing by \(n\) gives the fraction of cases that agree. \(\square\)

Worked Example: Finding the Best Label Match

Suppose the reference fit and one bootstrap fit both have three clusters. On the 100 original cases, their overlap table is

$$ N= \begin{pmatrix} 40&2&0\\ 3&28&4\\ 0&5&18 \end{pmatrix}. $$

The identity matching gives \(40+28+18=86\) agreements. To check that it is optimal, the six possible permutation sums are \(86,\ 49,\ 23,\ 6,\ 8,\ 28\). For example, the permutation mapping reference clusters \(1,2,3\) to bootstrap clusters \(1,3,2\) gives \(40+4+5=49\). The identity is the maximum, so matched agreement is \(86/100=0.86\).

The identity here means that the labels happen to align well; it is not assumed in advance. In a different replicate, the best permutation could exchange labels. Matching makes the score depend on the partitions, not on the names assigned to their components.

Cluster-specific stability

Overall matched agreement can conceal an unstable small cluster: many cases in large clusters may agree even when the small cluster changes substantially. A cluster-specific measure compares the cases in one reference cluster with the cases assigned to its matched bootstrap cluster. For reference cluster \(k\), let \(A_k\) be its case set and let \(B_{\pi(k)}\) be the matched bootstrap cluster's case set, both on the common evaluation data. Their Jaccard similarity is

$$ J_k=\frac{|A_k\cap B_{\pi(k)}|}{|A_k\cup B_{\pi(k)}|} =\frac{N_{k,\pi(k)}}{|A_k|+|B_{\pi(k)}|-N_{k,\pi(k)}}. $$

The numerator counts cases assigned to both matched clusters. The union counts cases assigned to at least one of them, so \(J_k\) is between zero and one; a value of one means the two case sets are identical. Averaging this score over bootstrap replicates gives a useful summary for each reference cluster. It should be accompanied by cluster sizes: a score based on a very small cluster can be especially sensitive to individual cases.

Worked Example: Calculating Cluster-Specific Jaccard Scores

Use the overlap table above. The optimal matching is the identity. Reference cluster 1 has size \(40+2=42\), and its matched bootstrap cluster has size \(40+3=43\). Their intersection has size 40, giving \(J_1=40/(42+43-40)=40/45\approx0.889\).

Reference cluster 2 has size \(3+28+4=35\); bootstrap cluster 2 has size \(2+28+5=35\). Thus \(J_2=28/(35+35-28)=28/42\approx0.667\).

Reference cluster 3 has size \(0+5+18=23\); bootstrap cluster 3 has size \(0+4+18=22\). Thus \(J_3=18/(23+22-18)=18/27\approx0.667\).

The overall matched agreement is 0.86, but the cluster-specific values show that the first cluster is more reproducible than the second and third in this replicate. Neither summary alone describes every feature of the changes.

What case resampling does to the likelihood

A bootstrap sample can be represented by its case multiplicities. Let \(W_i^{(b)}\) be the number of times original case \(i\) is drawn in replicate \(b\). These counts are nonnegative integers and satisfy \(\sum_i W_i^{(b)}=n\). For parameter \(\theta\), the observed-data log-likelihood of a Gaussian mixture on that resample is

$$ \ell_b(\theta)= \sum_{i=1}^{n}W_i^{(b)} \log\left\{\sum_{k=1}^{K}\pi_k \phi_d(x_i;\mu_k,\Sigma_k)\right\}. $$

This follows directly from the mixture density: each occurrence of case \(x_i\) contributes its log density once, and \(W_i^{(b)}\) occurrences contribute that term \(W_i^{(b)}\) times. Summing over distinct observed cases gives the displayed expression. Thus fitting to a case-resampled data set is equivalent, for the likelihood, to fitting the original rows with bootstrap multiplicities as weights. Cases with multiplicity zero do not contribute to that replicate's fitting objective, but their assignments can still be evaluated afterward under its fitted model.

Worked Example: Handling Repeated and Omitted Cases

Suppose the original data have six cases and the bootstrap indices are \(1,1,2,4,4,6\). The multiplicities for cases \(1\) through \(6\) are \((2,1,0,2,0,1)\): cases 1 and 4 appear twice, cases 3 and 5 are omitted, and cases 2 and 6 appear once. The bootstrap fit uses these six draws, not six distinct cases.

Suppose the reference labels on the six original cases are \((A,A,A,B,B,B)\), while the bootstrap fit, evaluated on all six original cases, gives labels \((1,1,2,2,2,2)\). The overlap table, with rows \(A,B\) and columns \(1,2\), is \(\begin{pmatrix}2&1\\0&3\end{pmatrix}\). Matching \(A\) to 1 and \(B\) to 2 gives five agreements; the swapped match gives one. The matched agreement is therefore \(5/6\). Cases 3 and 5 still count in this comparison even though they were omitted from the resample, because evaluation uses the same original cases for both fits.

Summarizing replicates and interpreting results

Repeat the procedure for \(B\) bootstrap replicates. A practical report includes the distribution or mean and spread of matched agreement, the distribution of Jaccard similarity for each reference cluster, and the number of successful fits. For example, if four replicates give matched agreements \(0.90,\ 0.85,\ 0.80,\ 0.95\), their mean is \((0.90+0.85+0.80+0.95)/4=3.50/4=0.875\). The range, 0.80 to 0.95, also communicates that stability varies across resamples.

This summary describes sensitivity of the fitted partition to case resampling, conditional on the chosen model and fitting procedure. It is not automatically a confidence interval for a population quantity: finite-mixture estimation can be nonregular, and stability scores are themselves functions of fitted labels. Nor does high stability establish that the clusters are scientifically meaningful. A misspecified model can repeatedly produce the same partition.

Fitting details are part of the sensitivity analysis. Mixture likelihoods can have local optima, so a replicate that converges to a different solution because of initialization may appear unstable even when the data perturbation is not the cause. Use a consistent, sufficiently robust initialization policy; record convergence failures; and do not silently discard failed replicates. Report whether the same preprocessing and constraints were used in every fit.

This conditional procedure keeps \(K\) and the covariance family fixed. If the goal is instead to assess the entire analysis pipeline, model selection must also be repeated within each resample, and the number of components may change. That question requires explicit handling of unmatched, split, or merged clusters; the equal-\(K\) permutation score defined here is not adequate by itself.

Common pitfall

Common mistake: “The bootstrap fit called the same group component 2 rather than component 1, so the clusters are unstable.” This conclusion confuses arbitrary component labels with case assignments. First evaluate both fits on a common set, then find the label permutation that maximizes overlap. Conversely, a high matched score should not be described as proof that the clustering is valid: it only indicates that this fitted procedure is reproducible under the resampling perturbation used.

Check Your Understanding

Use these questions to check whether you can distinguish resampling, matching, and interpretation.

  1. Why should each bootstrap fit be evaluated on the same cases as the reference fit rather than compared in bootstrap-row order?
  2. For an overlap table \(N\), what quantity is maximized to choose the label permutation, and why does that quantity give the largest possible agreement?
  3. Explain why a bootstrap sample with repeated observations can be fitted using case multiplicities in the log-likelihood.
  4. What could a high overall matched agreement conceal, and how does a cluster-specific Jaccard score help reveal it?
  5. Why is stability conditional on a fixed \(K\) and covariance model not the same as stability of the full model-selection procedure?
Clinical Biostats