| Count | |
|---|---|
| Schools with a KS4 result | 4,631 |
| Of which state-run | 3,250 |
| Variables in the full release | 700+ |
| Local authorities covered | 153 |
Adam Dennett - a.dennett@ucl.ac.uk
18 September 2026
CASA0007 Quantitative Methods
Nobody pours concrete without surveying the ground first. The same logic applies to everything we do this term — the model is only ever as sound as what it is built on.
Survey before you build in statistics is more formally known as exploratory data analysis - we’ll cover it in two weeks.
This week is deliberately the concrete one. Every single example comes from one real dataset, which we meet next.
By the end of this lecture you will:
| Count | |
|---|---|
| Schools with a KS4 result | 4,631 |
| Of which state-run | 3,250 |
| Variables in the full release | 700+ |
| Local authorities covered | 153 |
| School | Type | Ofsted | Pupils | Attainment 8 | % disadvantaged |
|---|---|---|---|---|---|
| King’s School | Academy | Good | 789 | 54.3 | 16 |
| Portslade Aldridge Community Academy | Academy | Good | 953 | 44.8 | 26 |
| Brighton Aldridge Community Academy | Academy | Requires improvement | 838 | 36.2 | 45 |
It is a raw score. It takes no account of who a school admits — which is exactly the problem we spend weeks 6 to 8 solving.
| Nominal | Ordinal | Interval | Ratio | |
|---|---|---|---|---|
| Categorizes and labels variables | ✔ | ✔ | ✔ | ✔ |
| Ranks categories in order | ✔ | ✔ | ✔ | |
| Has known, equal intervals | ✔ | ✔ | ||
| Has a true or meaningful zero | ✔ |
In our data: school type, religious character, region, admissions policy.
In our data: Ofsted rating.
Interval — differences are meaningful, but the zero is arbitrary
Ratio — a true, non-arbitrary zero, so ratios are meaningful
Progress 8 compares the progress pupils made with similar pupils nationally, each year.
| Data type | Possible values | Level of measurement | Common distributions | Common model |
|---|---|---|---|---|
| binary | 0, 1 | nominal | Bernoulli | logistic, probit |
| categorical | “name1” … “nameK” | nominal | categorical | multinomial logit / probit |
| ordinal | ordered categories | ordinal | categorical | ordered logit / probit |
| binomial | 0, 1, …, N | interval | binomial, beta-binomial | binomial regression |
| real-valued additive | any real number | interval | normal — symmetric | standard linear regression |
| count | 0, 1, 2, … | ratio | Poisson, negative binomial | Poisson / neg. binomial regression |
| real-valued multiplicative | positive real | ratio | log-normal, gamma, exponential — skewed | GLM with a logarithmic link |
Adapted from Statistical data type, Wikipedia (CC BY-SA)
| Data type | Variable | What it is |
|---|---|---|
| binary | single sex / mixed | Is the school single sex? |
| categorical | MINORGROUP | School type |
| ordinal | OFSTEDRATING | Ofsted rating |
| binomial | TFSM6CLA1A out of TPUP | Disadvantaged pupils out of the cohort |
| real-valued additive | P8MEA | Progress 8 |
| count | TOTPUPS | Pupils on roll |
| real-valued multiplicative | PERCTOT | % of sessions missed |
| Statistical type | Programming type | In R | In Python / pandas |
|---|---|---|---|
| real-valued (interval or ratio) | floating point | numeric / double |
float64 |
| count | integer | integer |
int64 |
| binary | Boolean | logical |
bool |
| categorical | enumerated type | factor |
category |
| ordinal | ordered enumerated type | ordered factor |
Categorical(ordered=True) |
| random vector | list or array | vector |
ndarray / Series |
| random matrix | two-dimensional array | matrix |
2-D ndarray |
Left two columns adapted from Statistical data type, Wikipedia (CC BY-SA)
| school_id | region | ofsted | parent_survey | attainment8 |
|---|---|---|---|---|
| 101248 | 3 | 4 | 5 | 51.2 |
| 101319 | 7 | 2 | 3 | 43.8 |
| 101422 | 1 | 5 | 5 | 58.6 |
| 101507 | 3 | 1 | 2 | 37.1 |
| 101663 | 9 | 3 | 4 | 46.9 |
region is a nominal code. ofsted and parent_survey are ordinal codes. school_id is a label. Only attainment8 is a measurement.
Five numeric columns. One number.
Still ordinal. Storing something as a number does not make the gaps equal — and nothing in the file will tell you which is which.
read_csv sees 1, 2, 3, 4, 5 and hands you a numeric columnAttainment 8 across all English schools
| Schools (n) | Mean | Median | Std. dev. | Minimum | Maximum |
|---|---|---|---|---|---|
| 4,631 | 39.8 | 43.6 | 17.5 | 0.0 | 87.6 |
A frequency distribution lets you see the full shape of your data - and all of it’s quirks.
The same 4,631 schools and the same Attainment 8 scores, four times over. Three of these show you that the data has more than one hump. One of them does not.
| What it shows you | What it hides | Reach for it when | |
|---|---|---|---|
| Histogram | the full shape, every bump and gap | no summary statistics marked | exploring one variable properly |
| Boxplot | median, quartiles, outliers — five numbers | the shape, completely | comparing many groups at once |
| Violin | the full shape, mirrored | individual points, and how many there are | comparing a few groups where shape matters |
| Raincloud | shape, summary and every observation | gets crowded fast | one or two groups, when you want to show everything |
All four are answering the same question — how many observations fall where? They differ only in how much they summarise before they show you.
The boxplot on the last slide looked perfectly ordinary. The data it was drawn from has three separate humps — special schools, independent schools and mainstream schools, piled on top of each other. A boxplot will never tell you that. Always look at the shape before you summarise it.
Five counts, one axis. Each cloud is the distribution, the box the quartiles, the rain below it the schools themselves.
Hold that thought. Is a school with 120 disadvantaged pupils more unusual than one with 900 boys on roll? You cannot answer that from this chart — the units are different and so are the spreads. Later today we fix it, by converting both to standard scores.
Six real schools, each with roughly twice the share of the one before. The jump from 3% to 6% and the jump from 48% to 96% are the same size — as multiples. A logarithmic axis is simply an axis that agrees.
Next week. Bea takes this apart properly — exponentials, logarithms, and when to reach for them. For now, just notice that changing the spacing changed the shape.
| If your outcome is… | …the model you need is | Covered in |
|---|---|---|
| real-valued additive | linear regression | weeks 6, 7 |
| real-valued multiplicative | linear regression on logged data | weeks 6, 7 |
| grouped / nested | linear mixed effects | week 8 |
| binary | logistic regression | week 8 |
| ordinal | ordered logistic regression | week 8 |
| count | Poisson regression | week 8 |
| Schools (n) | Mean | Median | Std. dev. | Minimum | Maximum |
|---|---|---|---|---|---|
| 4,631 | 39.8 | 43.6 | 17.5 | 0.0 | 87.6 |
| School type | n | Mean | Median | Std dev |
|---|---|---|---|---|
| Special school | 585 | 6.5 | 4.7 | 6.3 |
| College | 13 | 12.7 | 12.2 | 9.1 |
| Independent school | 783 | 35.6 | 35.9 | 18.9 |
| Academy | 2600 | 46.9 | 45.8 | 9.7 |
| Maintained school | 650 | 46.9 | 45.8 | 7.9 |
| School type | Schools | |
|---|---|---|
| Dropped | Independent school | 783 |
| Dropped | Special school | 585 |
| Dropped | College | 13 |
| Kept | Academy | 2,600 |
| Kept | Maintained school | 650 |
Recall the first slides: a sample only tells you about the population it was drawn from. The moment you filter, you have redefined that population — so say which one you mean.
Next week. Representative data, selection bias, and what happens to your conclusions when the cases you dropped are not like the ones you kept.
Variance is the average squared distance from the mean: \[\sigma^2 = \frac{\sum_{i=1}^{n} (y_i - \bar{y})^2}{n}\] \(y_i\) = value for any given school in our dataset
\(\bar{y}\) = the average value across all schools
Standard deviation is its square root: \[\sigma = \sqrt{\sigma^2}\]
| School type | Mean | Variance | Std dev |
|---|---|---|---|
| Academy | 46.87 | 93 | 9.65 |
| Maintained school | 46.91 | 63 | 7.94 |
Same mean. The variance of academy scores is close to half again as large.
Squaring also means outliers count heavily — a school 30 points from the mean contributes 900, not 30.
We are borrowing something here. “Roughly normal” and “about two thirds” are properties of a specific distribution that we have not defined. Next week Bea makes both precise — for now, take the two-thirds rule on trust and notice what it buys you.
A count answers “how many?” — and mostly tells you how big the place is.
A rate divides that count by something that makes it comparable:
\[\text{rate} = \frac{\text{numerator}}{\text{denominator}}\]
TFSM6CLA1A is the count, TPUP is the denominator, and PTFSM6CLA1A is the rate they produceChoosing the denominator is a decision about what you mean, not an administrative detail. Per pupil, per school, per head of population and per square kilometre answer different questions.
| Variable | Mean | Std dev |
|---|---|---|
| Attainment 8 | 46.9 | 9.3 |
| % sessions missed | 9.2 | 2.6 |
| % disadvantaged | 26.7 | 14.4 |
| % low prior attainment | 22.2 | 10.0 |
| Pupils on roll | 1085.2 | 397.7 |
A school is 3 points above average on Attainment 8 and 300 pupils above average in size. Which is the more unusual? On the raw numbers the question is meaningless — the units are different.
\[z = \frac{x - \bar{x}}{\sigma}\]
Subtract the mean, divide by the standard deviation.
Weeks 9 and 10 standardise every variable before PCA and clustering — otherwise “pupils on roll”, with a standard deviation of 398, would drown out “% sessions missed”, with a standard deviation of 2.6.
The DfE does not leave blanks — it publishes codes:
| Code | Meaning |
|---|---|
SUPP |
Suppressed, because the number of pupils is too small to publish safely |
NP |
Not published |
NE |
No entries |
LOWCOV |
Low coverage — too few pupils for a reliable figure |
NEW |
School too new to have results |
SUPP is disclosure control, not an error. A missing value here tells you the school is small — which is information, and it is not missing at random.
| Variable | Missing |
|---|---|
| Attainment 8 | 0.0% |
| Progress 8 | 21.9% |
| Pupils on roll | 0.3% |
| % disadvantaged | 21.9% |
| Ofsted rating | 16.0% |
| Overall absence | 22.0% |
SUPP means suppressed because the numbers are small — so a gap is telling you the school is smallAlways look at which cases are missing before you decide what to do about them.
| Type | Source | Handling |
|---|---|---|
| Error Outliers | Mistakes in collection, entry or measurement — e.g. a temperature sensor reading 500 °C | Should be corrected or removed |
| Irregular Pattern Outliers | Genuinely occur, but do not follow the general pattern — e.g. a spike in sales on Black Friday | May indicate events worth investigating. If studying the overall pattern, remove |
| Influential Outliers | Appear extreme but are integral to the underlying pattern — e.g. a special school in our attainment data | Keep them; removing them distorts the analysis or hides something important |
Two standard rules, and they are just conventions:
The standard score
Use the \(z\) we met earlier, and flag anything with \(|z| > 3\) — or 2, or 2.5, depending on who you ask.
\(z\) measures how far from average a value is. The threshold is what turns that into a claim about outliers.
Tukey’s fences
Flag anything below \(Q_1 - 1.5 \times IQR\) or above \(Q_3 + 1.5 \times IQR\).
Widen to \(3 \times IQR\) for “far out” values.
| Rule | Schools flagged | % of schools |
|---|---|---|
| |z| > 2 | 165 | 5.1% |
| |z| > 3 | 62 | 1.9% |
| Tukey 1.5 x IQR | 136 | 4.2% |
| Tukey 3 x IQR | 7 | 0.2% |
Four rules, four answers, on the same 3,250 schools. “Outlier” is a choice, not a fact — so say which rule you used.
| School | Local authority | Attainment 8 | z |
|---|---|---|---|
| The Henrietta Barnett School | Barnet | 87.6 | +4.36 |
| Wilson’s School | Sutton | 86.4 | +4.23 |
| Queen Elizabeth’s School, Barnet | Barnet | 85.5 | +4.14 |
| St Olave’s and St Saviour’s Grammar School | Bromley | 84.4 | +4.02 |
| Kendrick School | Reading | 84.3 | +4.01 |
Delete your outliers and you would have deleted the evidence that selection matters enormously — which is exactly the question weeks 6 to 8 are about.
| Dataset | Lower fence | Upper fence | Flagged as outliers |
|---|---|---|---|
| All schools | 10.9 | 73.8 | 660 |
| Mainstream secondaries only | 25.3 | 66.9 | 136 |
Exploratory data analysis, part 1 — what have we got?
Everything today was descriptive — statements about the 3,000-odd schools actually in front of us. Next week Bea turns that around.
Same two weeks, same question — can I trust what this data seems to be telling me?
You will do all of that again yourself, on the same data, slicing it a different way.
Bring questions. The last task is the one the rest of this course exists to answer.
© CASA | ucl.ac.uk/bartlett/casa