 
			Do Small Towns Provide Better Education? A UK Detective Story
The Mystery
I recently came across a fascinating article with dataset from the UK Office for National Statistics (ONS) asking: “Why do children and young people in smaller towns do better academically than those in larger towns?”
The data seemed clear: small towns consistently outperform large towns on education metrics. The ONS article explored various factors—coastal location, regional differences, university presence, income differences—but something felt incomplete. They’d identified a pattern but hadn’t answered the fundamental question: Why?
As someone learning causal inference, I wanted to dig deeper. What I found completely upended the conventional wisdom.
What the Data Shows (At First)
Looking at over 1,100 UK towns, the education attainment pattern is undeniable:
- Small towns: Score +0.30 above the national average
- Medium towns: Score -0.25 below average
- Large towns: Score -0.81 below average
 
Small towns win – on average they achieve better education attainment. Education attainment here is a composite index taking into account the same children’s key stage exam results through the ages of 11 to their degree programs (if they went to university) As noted, there are multiple reasons that explain factors that are related to the high-performing towns – correlations between town characteristics and education attainment.
The Income Question
However, there’s one correlation in the ONS article that caught my attention: small towns in the UK are dramatically wealthier than large towns.
When I broke down income deprivation by town size, the pattern was striking:
 
- Small towns: Only 36% of towns classified as ‘high-deprivation’ (small towns are predominantly wealthy)
- Large towns: 69% ‘high-deprivation’ (struggling)
The above disparity is particularly noteworthy because the income gap between ‘wealthy’ and ‘poor’ towns is absolutely massive.
Looking at average education scores by income level:
- Wealthy towns (low deprivation): +2.76 points
- Poor towns (high deprivation): -2.42 points
- Total gap: 5.18 points
To put this in perspective: this 5.18-point difference represents roughly two standard deviations—moving a child from the 50th percentile to the 85th percentile in income.
So we have to ask: Is the “small town advantage in education attainment” real, or is it just a wealth story in disguise?
Drawing the Causal Map
To answer this properly, I needed to map out how these factors actually cause each other, not just correlate. This is where causal diagrams come in—a powerful tool that makes your assumptions explicit and testable.

Here’s what I mapped out:
- Region ‘rgn11nm’ directly affects both town size AND income (some regions have larger towns, some have wealthier)
- Town size ‘size_numeric’ directly affects income levels and education (small towns tend to be wealthier, with better schools)
- Income ‘income_flag’ affects education outcomes (wealth provides massive advantages as we will see)
- Coastal location ‘coastal’ affects income (many coastal towns are economically struggling)
The critical insight: income sits between town size and education. It’s not just a side factor—it’s potentially the entire mechanism through which town size appears to matter.
The Analysis
Using causal inference methods (specifically the DoWhy Python library implementing Judea Pearl’s framework), I measured the effect of town size while properly accounting for confounding factors like region and coastal location.
First, the total effect: small towns score 0.62 points higher in education attainment than large towns on average (per size category: Small → Medium → Large).
But then I asked the crucial question: What happens if we compare towns with the same income level?
This is called mediation analysis—decomposing the total effect into:
- Direct effect: Does town size matter independently?
- Indirect effect: How much works through the income pathway?
And the results…
When comparing towns with equal income levels, large towns actually score 0.34 points HIGHER than small towns.
The effect completely reverses.
Here’s the full breakdown:
Total effect: -0.62 points (small towns appear better) Direct effect: +0.34 points (large towns actually better when income is equal!) Indirect effect through income: -0.96 points per size category
Multiply by 2 to get the full Small town → Large town effect:
- Total apparent advantage of small towns: 1.24 points
- Actually working through income: 1.92 points
- True effect of being small (when income is equal): -0.68 points (large towns better!)
Education Inequality: It’s all about Wealth
The “small town advantage” as noted by the ONS study, is entirely about wealth.
When you compare towns with similar income levels, large towns actually offer clear advantages:
- Better school resources and facilities
- Larger pools of qualified teachers
- More educational infrastructure
- Greater school choice and competition
- Economies of scale in education
But in the real world, these advantages are completely overwhelmed by a stark reality: large towns are much, much poorer than small towns.
Remember that 5.18-point gap between wealthy and poor towns? That’s the real story. Town size creates a 1.92-point education attainment difference purely through income sorting—wealthy people cluster in small towns, poor people cluster in large towns. The direct effect of town size itself is tiny (0.34 points) and actually favours large towns!
Income effects (shown in red in below graph) is massively more important than town size (shown in green in below graph), and works in the opposite direction. The overall effect is showing in navy blue in below graph which is the dampened effect found in the ONS article.
 
The Coastal Story
One fascinating detail emerged: the town size effect is three times stronger for coastal towns than inland towns.
- Coastal towns: -1.61 points per size category
- Non-coastal towns: -0.52 points per size category
Why? Large coastal towns in the UK are often declining seaside resorts facing severe economic challenges. Small coastal towns tend to be wealthy retirement communities. The income gap—and thus the education gap—is much wider in coastal areas. It’s another piece of evidence that this is fundamentally about economics, not community factors.
Why This Matters
For policymakers:
The conventional narrative is dangerous.
If you believe “small towns are better for education,” you might invest in promoting small-town values, community programs, or rural education initiatives.
This would miss the point entirely.
The real crisis is economic decline in large urban areas. Former industrial cities are struggling with poverty, unemployment, and deprivation—and this is devastating educational outcomes. The solution isn’t to make cities more like small towns. It’s to address urban poverty and economic decline head-on.
A 5.18-point income gap between wealthy and poor towns is a national crisis. It represents 10-15 percentage point differences in students achieving basic academic milestones. This has lifetime consequences for earnings, employment, and social mobility.
For parents:
The good news is simpler than you might think: find a wealthy area.
Whether it’s a small town or large city matters very little (0.34 points—barely noticeable). What matters enormously is the economic health of the community (5.18 points—life-changing).
If you can afford a nice neighborhood in a city, your kids will likely do just as well—or slightly better—than in a wealthy small town, with the added benefits of urban resources, diversity, and opportunities.
For researchers:
This is exactly why causal inference matters. The ONS article, while well-intentioned, identified a correlation but completely missed the mechanism.
They saw that small towns correlate with better education and asked “why are small towns better?”
The better question was: “Are small towns actually better, or are they just wealthier?”
Answer: They’re just wealthier.
Without causal analysis, you might invest years and millions of pounds addressing the wrong problem.
How I Did This (The Technical Part)
I used DoWhy, a Python library implementing Judea Pearl’s causal inference framework:
- Built a causal model (DAG) based on domain knowledge about how region, income, town size, and coastal location interact
- Identified confounders using the backdoor criterion—region and coastal location create spurious correlations that need to be controlled
- Estimated the total causal effect using backdoor adjustment—properly accounting for confounding while leaving mediators (income) unblocked
- Decomposed the effect using mediation analysis—controlling for income to separate direct effects from indirect effects through the income pathway
- Validated with sensitivity tests—all three tests passed, confirming the effects are robust
The analysis revealed something statistically fascinating: a suppression effect. Regional differences were actually hiding part of the true relationship, making the naive correlation weaker than the true causal effect. This is relatively rare and shows why proper causal modeling matters.
This analysis was conducted using publicly available data from the UK Office for National Statistics via TidyTuesday. The findings were validated using multiple sensitivity tests and are robust to various modeling assumptions. Full methodology and code available upon request.
