Contents/ Part XXVIII · Capstone Projects: Sampling & Data Collection/ Chapter 178

Schools and Students

Capstone 18. There is no list of students, only a list of schools. That one administrative fact forces a design that is cheap to run and expensive in precision. The cost shows up in the standard error, which is the last place most analyses look.

โฑ๏ธ ~19 min read
๐ŸŽฏ Cluster sampling
๐Ÿ“Š Chapter 178

Six hundred students took a reading assessment and every paper was scored. The district average they produce is about as precise as eighty-six students drawn at random would have given. This chapter is about where the other five hundred went.

The brief
Setting
A school district of 120 schools and 8,184 sixth-grade students. There is no list of students, only a list of schools, so 24 schools were drawn and 25 students tested inside each.
The question
What is the district's mean reading score, and how precise is that estimate really?
Why it matters
The figure will be compared against a state standard and used to target support money. An interval that is too narrow makes a gap look real when it is not.
What we do
Measure the intra-class correlation, compute the design effect, calculate three different standard errors for the same number, and run a coverage simulation to settle which of them is telling the truth.
ρ
The design effect is how much a design inflates the variance of an estimate compared with simple random sampling. For a cluster sample it is 1 + (m − 1)ρ, where m is the cluster size and ρ is the intra-class correlation, the share of variation that sits between clusters rather than within them.
โญ
The finding, up front

With an ICC of 0.25 and 25 students per school, the design effect is 6.93: 597 students carry the precision of 86. Ignoring the clustering understates the standard error by a factor of 2.6, and an interval labeled 95 percent then covers the truth 57 percent of the time.

1

The Frame Chose the Design

The target population is every sixth-grade student in the district's 120 public schools, 8,184 of them. There is no central list of students. There is a complete list of schools, with enrollment counts.

That settles it before any statistical argument begins. Students can only be reached through schools, so the design is a two-stage cluster sample: draw 24 schools from the 120, then draw 25 sixth-grade students inside each. Six hundred assessments in twenty-four buildings.

Cluster sampling is chosen for cost, never for precision

Testing 600 students spread across 24 schools is affordable. Testing 600 students scattered across all 120 schools would cost several times as much in travel, proctoring and scheduling, for exactly the same number of tests. That trade is entirely reasonable.

What is not reasonable is taking the cheap design and then analyzing it as though it had been the expensive one. Every standard error in this chapter has to know that school_id is not a label but the sampling unit.

2

Look at the Clusters First

The whole question is whether students in the same school resemble each other. A picture answers it faster than any statistic. Cleaning removed two duplicates, one impossible score of 155 and two students absent on test day, leaving 597 students across 24 schools.

A strip plot with 24 schools along the x axis sorted by mean score. Each school shows about 25 individual student scores as scattered dots with a horizontal bar at the school mean. The school means climb steadily from about 46 to about 81, while individual scores within each school spread widely around their own school's bar.
Each column is a school, each dot a student, each horizontal bar a school mean. Those means run from 46.4 to 81.0, a spread of nearly 35 points. Knowing a student's school tells you a great deal before you know anything else about them.
WHAT THE INTRA-CLASS CORRELATION MEASURES HIGH ICC · clustering costs you ICC NEAR ZERO · clustering is free the 25th student in a school repeats the first 24 every student is as informative as a fresh draw
Same number of observations, very different amount of information. On the left the clusters sit at different levels and their members hug those levels, so most of what a student tells you is really about their school. On the right the clusters are indistinguishable, and a cluster sample is as good as a random one. This district's schools look like the left panel: ICC = 0.25.
3

The Design Effect: What the Clustering Costs

QuantityValueMeaning
Mean square between schools2,256.20Variation from school to school
Mean square within schools244.71Variation from student to student
Intra-class correlation0.248425% of variation is between schools
Design effect6.931 + (24.9 − 1) × 0.2484
Effective sample size86.1597 students, the precision of 86

An ICC of 0.25 is high and entirely ordinary for schools, because intake, teaching and neighborhood all travel together. The consequence is stark: roughly 510 of the 597 tests we scored added almost nothing to the estimate.

THE MULTIPLIER GROWS WITH CLUSTER SIZE, NOT WITH SAMPLE SIZE design effect = 1 + (m − 1) × 0.25 2.0 5 per school 3.2 10 per school 4.5 15 per school 6.9 25 per school 9.8 36 per school 13.2 50 per school this study
Doubling the students per school nearly doubles the penalty. Sampling one more school costs travel; sampling one more student in a school you are already visiting costs almost nothing, which is precisely why the temptation is to test more children in fewer buildings. The multiplier is what that temptation costs.
4

Three Standard Errors for One Number

Sample mean
61.41
true value 60.55
Naive SE
0.73
assumes independence
Corrected SE
1.93
design effect applied
Understated by
2.6×
if clustering ignored
MethodSE95% CICovers truth?
Naive, assumes independence0.73559.97 to 62.85yes, narrowly
Design-effect corrected1.93457.61 to 65.20yes
Ultimate cluster (24 school means)1.94257.60 to 65.21yes

The two corrected methods agree to the third decimal, which is reassuring because they get there differently. The ultimate-cluster estimator discards the individual students entirely and treats the 24 school means as the data. That it lands within a hair of the design-effect correction confirms the underlying fact: this study really carries 24 independent pieces of information, not 597.

Left: three horizontal confidence intervals for the mean reading score against a dashed line at the true value. The naive interval is much shorter than the two corrected ones. Right: a bar chart of effective sample size for five designs at fixed 600 tests, rising from 46 for twelve schools of fifty students to 301 for 120 schools of five.
Left: the same estimate with three standard errors. The naive interval happens to contain the truth here, which is the sort of luck that lets bad practice survive. Right: what the same 600 tests are worth under different designs.
5

Does a 95 Percent Interval Cover 95 Percent of the Time?

One sample cannot answer that. A thousand can. The real study cannot be re-run, but a population with the same variance structure the sample just revealed can be built and the design re-run on it as often as we like.

Naive interval, stated
95%
what it claims
Naive interval, actual
56.9%
over 1,000 replicates
Corrected, actual
96.6%
as advertised
Real error rate
43%
against a stated 5%
This is the argument, and it is not a rounding issue

An interval labeled 95 percent contains the truth about 57 percent of the time when the clustering is ignored. Two studies in five would publish a confidence interval that does not contain the value they set out to estimate, while stating a 5 percent error rate.

Nothing about the correction is exotic. It is one multiplication by the square root of the design effect. The cost of skipping it is a real error rate eight times the stated one.

6

The Question to Ask Before Fieldwork

The design effect depends on the cluster size, and cluster size is a choice. For the same 600 students, visiting more schools and testing fewer in each buys back most of the lost precision.

Design (same 600 tests)Design effectEffective nRelative precision
12 schools × 50 students13.1745.60.73×
24 schools × 25 students6.9686.21.00× (used)
40 schools × 15 students4.48134.01.25×
60 schools × 10 students3.24185.51.47×
120 schools × 5 students1.99301.01.87×

More clusters beats bigger clusters, every time, on statistical grounds alone. Sixty schools of ten students would have delivered an effective sample of 186 rather than 86, from exactly the same number of assessments.

The study did not do that because of cost, and that is a legitimate answer. But it is a decision to be made deliberately with the precision consequence in front of you. The right time to compute a design effect is while planning the fieldwork, not while writing up.

7

Proportions Cluster Too

260 of the 597 students met the expected standard, 43.6 percent against a true 41.4 percent. The correction applies exactly as before, and nothing in standard survey software will apply it for you.

Interval95% CIWidth
Naive Wilson39.6% to 47.6%7.9 points
Cluster-corrected34.1% to 53.0%18.9 points

The ICC for the binary outcome is 0.196 and the design effect 5.68, so the honest interval is more than twice as wide. Wilson intervals, exact binomial intervals and every other textbook formula for a proportion assume independent observations. Applied to a cluster sample they are too narrow by the same square-root-of-the-design-effect factor, and they will do it silently.

8

What to Watch

9

Clustering in Data Science & AI

Clustered data is the norm, not the exception, and the failure mode is identical every time: rows are counted as independent when they are not.

Where it appearsThe cluster
Repeated events per userThe user. A million sessions from ten thousand people is not a million observations
Cross-validation splitsSplit by cluster, not by row, or the same user appears in train and test
A/B tests randomized by accountThe account. Randomizing by account and analyzing by session inflates significance
Annotated datasetsThe annotator. Labels from one person share that person's idiosyncrasies
Sensor or panel dataThe device or site, measured repeatedly over time
Practice note

The most common version in applied machine learning is splitting a dataset by row when it should be split by group. If the same user, patient or document appears on both sides of the split, the test set is not independent of the training set and the reported score is optimistic. It is the same arithmetic as this chapter viewed from the other end: GroupKFold exists for precisely the reason school_id matters here. An A/B test randomized at account level and analyzed at session level makes the identical error, and will declare significance at several times the stated rate.

๐Ÿ

The full project, step by step

The companion notebook explains why the frame forced the design, plots the clusters before computing anything, decomposes the variance into between-school and within-school components, derives the ICC and the design effect, and puts three standard errors side by side against the known population mean. It then runs a thousand-replicate coverage experiment on a simulated district with the same variance structure, works through the cluster-size trade at fixed cost, and applies the same correction to a proportion.

๐Ÿ““ View Notebook (code & outputs) โ–ถ Open in Colab โฌ‡ View / Download on GitHub
Read the reports & get the data

The dataset (capstone-cluster-sampling-schools.xlsx) holds the 600 sampled students with their school identifiers, the district's school frame, the written sampling plan, and the true population values. Two written reports accompany it: a plain-language brief for a research lead, and a technical report covering the variance decomposition, the coverage experiment and the design trade.

๐ŸŽ“ Key Takeaways

  • โœ“The design effect is 1 + (m − 1)ρ. It grows with cluster size, not sample size, so bigger clusters cost precision fast.
  • โœ“597 students, effective n of 86. An ICC of 0.25 with 25 students per school gives a design effect of 6.93.
  • โœ“A 95% interval that ignores clustering covers 57% of the time. The real error rate is eight times the stated one.
  • โœ“More clusters beats bigger clusters. The same 600 tests are worth 3.5× the effective sample size spread across 120 schools instead of 24.
  • โœ“Proportions cluster too, and Wilson intervals will not tell you. The corrected interval here is more than twice as wide.
10

Quiz: Test Yourself

Eight questions on clustering, design effects and what they do to a confidence interval. Answer them, hit Check Answers, and keep refining until you score 100%. Your progress is saved.