Tutorials › Regression Analysis (Undergraduate) › Counting Independent Clusters, Not Just Observations

Grouped Data and Dependence Awareness · Tutorial 872 of 991

Counting Independent Clusters, Not Just Observations

Learn to distinguish the total number of observations from the number of independent clusters, and assess what each contributes to regression information.

Advanced 9 min read

What You'll Learn

  • Distinguish total observations from independent clusters and cluster sizes.
  • Use the equal-size design effect to compare effective information in simple examples.
  • Explain why repeated measurements of a cluster-level predictor do not create new independent predictor values.
  • Compare studies with the same participant count but different numbers of clusters.
  • Identify what cluster counts should be reported when describing a regression analysis.

Why Count Clusters?

A data set can contain hundreds or thousands of rows while drawing on only a small number of independent sources of information. For example, many patients may be observed at each of a few clinics, or many measurements may be recorded for each person. Rows from the same group can be related, so they do not necessarily contribute as much independent information as the same number of observations from separate groups.

For cluster-aware regression, it is therefore important to count both the observations and the clusters. A large total sample size does not, by itself, establish that there are many independent replications. The number of clusters matters especially when a predictor varies only from cluster to cluster, and it is a key feature to report when describing the data and interpreting the scope of the available information.

Definition: A cluster is a group of observations that may be dependent on one another, such as patients from the same clinic. Let \(G\) be the number of clusters, let \(n_g\) be the number of observations in cluster \(g\), and let \(N=\sum_{g=1}^{G} n_g\) be the total number of observations. The cluster count \(G\) and total count \(N\) describe different features of the data.

For the usual cluster-aware reasoning in this tutorial, clusters are treated as independent of one another, while observations within a cluster may be dependent. This is a statement about the dependence structure, not a claim that every observation in a cluster is identical. Within-cluster observations can still provide information about variation among individuals and about predictors that vary within clusters.

Counting clusters is not a replacement for examining the design, the predictors, or the pattern of dependence. It is a first check on how many separate groups contribute information. Two data sets with the same \(N\) may have very different \(G\), and thus may not support the same strength of cluster-level inference.

Cluster Size and the Design Effect

When clusters have equal size \(m\), a familiar summary of the loss of information from within-cluster similarity is the design effect. If the within-cluster intraclass correlation is \(\rho\), then for a mean under the standard equal-size, common-correlation setup, the design effect is \(1+(m-1)\rho\). The corresponding effective sample size is approximately the total count divided by that factor. These are summaries for that setup, not universal replacements for \(G\) in every regression problem.

$$ N=Gm,\qquad \text{design effect}=1+(m-1)\rho,\qquad N_{\mathrm{eff}}\approx\frac{N}{1+(m-1)\rho} $$

The formula highlights why adding observations to existing clusters may yield less information than adding clusters. When \(\rho\) is positive, increasing \(m\) increases the design effect: observations in the same cluster share some information. At the same time, \(N_{\mathrm{eff}}\) is an approximate summary for a specified purpose, not a literal count of independent clusters. In regression, the information available also depends on which predictors vary within clusters and which vary only between clusters.

Worked Example: Same Total, Different Cluster Counts

Suppose two hypothetical studies each observe \(N=500\) people. In Study A, there are 10 clinics with 50 people per clinic. In Study B, there are 50 clinics with 10 people per clinic. Assume, for this illustration, equal cluster sizes and a common within-clinic intraclass correlation of \(\rho=0.10\). Compare their effective sample sizes for a mean.

For Study A, \(G=10\) and \(m=50\). The design effect is \(1+(50-1)(0.10)=1+4.9=5.9\), so \(N_{\mathrm{eff}}\approx500/5.9=84.75\).

For Study B, \(G=50\) and \(m=10\). The design effect is \(1+(10-1)(0.10)=1+0.9=1.9\), so \(N_{\mathrm{eff}}\approx500/1.9=263.2\).

Under the stated assumptions, Study B has the larger approximate effective sample size for the mean, even though both studies observe 500 people. It has more separate clinics and fewer people per clinic, so less of the total is concentrated in similar observations within the same clinic. The calculation does not imply that Study A literally has 84.75 independent clinics: it has 10. Nor does this mean that a single effective-sample-size calculation answers every regression question. It illustrates why reporting \(N\) without \(G\) can conceal an important difference.

When a Predictor Varies Only Between Clusters

Cluster counts have a particularly direct interpretation when a predictor is constant within each cluster. Examples include a clinic-level policy or a school-level characteristic. If there are six clinics, then that predictor has at most six distinct clinic-level values, even if each clinic contributes many patient records. More rows repeat the same predictor value; they do not create more independent clinics at which the predictor was observed.

A short calculation makes the distinction clear. Suppose each of \(G\) clusters has the same size \(m\), and \(x_g\) is a predictor value shared by all observations in cluster \(g\). The overall mean of the observation-level predictor equals the mean of its cluster values, \(\bar{x}\). Its sum of squared deviations across the \(N\) rows is \(\sum_{g=1}^{G}\sum_{i=1}^{m}(x_g-\bar{x})^2 =m\sum_{g=1}^{G}(x_g-\bar{x})^2\). Thus repeating each cluster’s value multiplies this row-level sum by \(m\), but it does not add new distinct values or independent clusters. Treating the multiplied sum as if it came from \(mG\) independent predictor settings would mistake repetition for independent replication.

This does not mean that within-cluster observations are useless. They can help describe outcomes within a clinic and reduce uncertainty about that clinic’s average outcome. But the evidence for a relationship involving a clinic-level predictor must ultimately come from how outcomes and predictor values differ across clinics. The number of distinct clusters places a practical limit on that source of information.

Worked Example: Many Rows, Only Six Predictor Values

Imagine a hypothetical data set from six clinics, each contributing 30 patients. A clinic-level predictor \(x_g\) has values \(0,1,2,3,4,5\), and the six clinic mean outcomes are \(10,12,13,16,17,20\) units. There are \(N=6(30)=180\) patient records, but only six clinics and six distinct predictor values. Find the slope in a simple regression of the six clinic mean outcomes on the predictor.

The predictor mean is \(\bar{x}=(0+1+2+3+4+5)/6=2.5\), and the outcome mean is \(\bar{y}=(10+12+13+16+17+20)/6=88/6=14.667\). The sums used for the slope are \(S_{xx}=\sum_g(x_g-\bar{x})^2=17.5\) and \(S_{xy}=\sum_g(x_g-\bar{x})(\bar{y}_g-\bar{y})=34.0\). Therefore, the slope is \(S_{xy}/S_{xx}=34.0/17.5=1.943\) outcome units per one-unit increase in the predictor.

The calculation uses six clinic-level pairs, not 180 independent clinic-level predictor values. If the same predictor value is copied onto all 30 patient rows in a clinic, those rows still represent only six independent settings of this predictor. The slope describes the pattern in these hypothetical clinic averages; the calculation alone does not establish a causal effect or determine the appropriate uncertainty for a regression analysis.

Cluster Counts as Independent Replications

The number of clusters also helps describe the amount of independent replication for a comparison that is applied or measured at the cluster level. For example, if an intervention is assigned to clinics, patients within one clinic share the same assigned condition. A study with many patients but only a few clinics in each condition has few independent clinic-level replications. Counting patients alone would hide that feature.

The count should be accompanied by the allocation of clusters across the groups being compared. A total of 12 clusters has a different interpretation if six contribute to each group than if 11 contribute to one group and one to the other. The cluster count does not itself tell us whether a comparison is unbiased, whether the regression model is appropriate, or how to calculate an uncertainty interval. It makes the independent units visible so those questions are not answered as though every row were independent.

Worked Example: The Number of Group-Level Replications

Consider a hypothetical study comparing two clinic-level programs. Twelve clinics contribute 25 patients each, for \(N=12(25)=300\) patients. Six clinics are in each program group. The clinic mean outcomes in the first group are \(10,11,9,10,10,10\), and those in the second group are \(12,13,11,12,12,12\), measured in a common outcome unit. Calculate the difference between the average clinic means.

The first group’s average clinic mean is \((10+11+9+10+10+10)/6=60/6=10\) units. The second group’s average clinic mean is \((12+13+11+12+12+12)/6=72/6=12\) units. The difference, second group minus first group, is \(12-10=2\) units.

This descriptive contrast is based on six clinic means per group, or 12 independent clinics in total under the stated cluster-independence setup. The 300 patient records describe outcomes within those clinics; they do not amount to 300 independently assigned clinics. The calculation does not provide a standard error or a test, but it identifies the replication count that an uncertainty analysis would need to respect.

What to Count and Report

A useful description of clustered regression data gives readers enough information to distinguish rows from groups. At a minimum, report the number of clusters \(G\), the total number of observations \(N\), and how observations are distributed across clusters. If cluster sizes differ, a mean cluster size alone can conceal whether a small number of clusters contain most observations, so the range or a concise summary of the size distribution is useful.

Also identify whether a predictor varies within clusters, between clusters, or both. This matters because a predictor observed at the individual level can vary across many people within a clinic, whereas a clinic-level predictor supplies only one value per clinic. These are different sources of information, even when they appear as columns in the same data table.

QuantityWhat it tells youWhy it matters
\(N\), total observationsHow many rows or measurement records are presentDescribes the overall data volume, but not the number of independent groups
\(G\), clustersHow many separate groups contribute observationsShows the number of independent cluster-level replications under the assumed structure
Cluster sizes \(n_g\)How observations are distributed across groupsReveals whether a large total is concentrated in a few clusters
Predictor variationWhether values differ within clusters, between clusters, or bothIdentifies which level supplies information about a predictor’s association with the outcome

Common Mistake: Treating Rows as Independent Replications

A common mistake is to reason, “There are 1,000 observations, so there are 1,000 independent pieces of evidence.” This is not justified when many observations come from the same clusters and may be related. The correction is to count both \(N\) and \(G\), describe cluster sizes, and determine the level at which each predictor varies. Neither the total row count nor the cluster count alone is a complete description, but omitting \(G\) can substantially overstate how many independent groups support a conclusion.

A second mistake is to equate an approximate effective sample size with the number of clusters. The design-effect calculation for a mean may yield an effective sample size larger than \(G\), because observations can contribute information about individual-level variation. That does not create additional independent clinics, schools, or other clusters. For a cluster-level predictor, the independent variation in its values remains tied to the number and spread of cluster-level values.

Key takeaway: Always separate the number of observations from the number of independent clusters. Many observations within a few clusters can improve within-cluster description, but they cannot manufacture additional independent cluster-level replications.

Check Your Understanding

Use the distinction between total observations and independent clusters to answer these questions.

  1. A hypothetical data set has 240 patients from 8 clinics. What are \(N\) and \(G\), and what additional count would describe how the observations are distributed?
  2. Two studies each have 600 observations and the same positive intraclass correlation. One has 12 equal-sized clusters and the other has 60. Under the equal-size design-effect setup, which has the larger effective sample size for a mean, and why?
  3. A school-level predictor is recorded for 400 students attending 10 schools. How many distinct school-level predictor values are represented at most?
  4. Why is an effective sample size calculated for a mean not necessarily the number of independent clusters?
  5. A report gives \(N=900\) but not the number of clinics. Explain why that information is insufficient to describe the independent cluster-level replications.