Research Workflow

Choose the Clustering Level for Robust Uncertainty

Identify the source of dependence

Observations may share outcomes or disturbances because they come from the same person, clinic, household or other group. A cluster-robust covariance method allows a specified within-cluster dependence structure while relying on appropriate independence across clusters. The clustering variable is therefore a design decision, not a cosmetic software option.

The statsmodels covariance documentation describes cluster covariance settings and degrees-of-freedom adjustments. Record the method and corrections explicitly, because identical coefficients can accompany different inferential conventions.

Count independent groups

List the number of clusters, their size distribution and whether a few clusters dominate the sample. One thousand observations in ten clinics do not provide the same independent information as one thousand unrelated observations. Very few clusters can make conventional cluster-robust inference unreliable even when the total row count looks large.

Check whether the clustering level matches treatment assignment, sampling and plausible residual dependence. Repeated visits nested within patients and patients nested within clinics may require more thought than selecting the smallest identifier available.

Audit a hypothetical dataset

Suppose 200 participants contribute four visits each, creating 800 rows. If dependence is within participants and participants are otherwise independent for the intended analysis, the relevant count is 200 participant clusters, not 800 independent observations.

If those participants are instead grouped within ten randomized clinics with clinic-level shared effects, clustering only by participant can miss clinic dependence. The same 800 rows then belong to ten clinic clusters. This does not mechanically determine the best model, but it exposes why row count alone cannot justify the uncertainty calculation.

Preserve design and method choices

Confirm that the clustering variable has no missing or accidentally merged identifiers. Report cluster counts before and after model exclusions. A complete-case restriction can remove entire clusters or change their balance, so inspect the actual fitted sample.

When the cluster count is small, seek a method justified for that setting rather than relying on a generic robust label. Sensitivity analyses should state which assumptions or corrections differ. The final output should name the clustering level, number of clusters, estimator and reference distribution, making it possible to assess whether the reported precision reflects the study’s independent units rather than the number of spreadsheet rows.

Source verification: 6 November 2026. Examples are hypothetical.

Related reading

Reading path: Analyze data. Guide 51 of 89. Choose any guide to suit your project.

Research Workflow

Choose the Bootstrap Resampling Unit Before Generating Replicates

Preserve pairs, clusters, and other dependence structures when estimating uncertainty by resampling.

Research Workflow

Choose change scores or follow-up analysis deliberately

Separate the scientific target from the choice of baseline adjustment in repeated continuous measurements.

Browse this reading pathTools for this stageGuides and downloads for this stage