Part 15 · Knowledge and Science
Statistics and Probability
How to make sense of numbers that vary — harvests, measurements, sick and healthy patients — with averages, spread and chance. With a pencil and these few methods you can tell a real improvement from luck, judge a whole batch from a sample, and keep the quality of your work steady.
- Difficulty
- ●●●●●
- Time
- An evening for averages and chance; a week of practice to use the methods with confidence
- Steps from zero
- 2 prerequisites →
You need first
Arithmetic and FractionsThis unlocks
—The full path from nothing — 2 steps before this one
- Writing and Numbers
- Arithmetic and Fractions
- Statistics and Probability
Do them roughly in this order. See it on the tech tree →
Why it matters
Nothing in the real world comes out the same twice. Two plots of beans sown the same day give different harvests. Ten bricks from one kiln weigh slightly different amounts. Some patients recover from a fever with no treatment at all. If you judge from single results, you will be fooled again and again — by luck that looks like skill, and by real improvements that look like nothing.
Statistics is a small set of methods for reasoning about numbers that vary. Probability is the arithmetic of chance underneath it. Together they let you:
- Say whether a new seed, fertiliser or medicine really works, or whether the difference is luck (The Scientific Method, Saving Seed and Breeding Plants, Making Medicines).
- Judge a whole granary, a whole batch of bricks or nails, from a few samples (Granaries and Food Storage, Precision and Interchangeable Parts).
- Know how far to trust a measurement, and how many times to repeat it (Measurement from Scratch).
- Keep a workshop's output steady, catching a drifting machine or kiln before it makes a hundred bad parts.
- Plan for the future: how much grain to store against a bad year, how many children will need a school (Planning a Settlement, Organising a Community).
All of it needs only the arithmetic in Arithmetic and Fractions: adding, dividing, squares and square roots.
How it works
Three ideas carry nearly everything:
- The average tells you the typical value.
- The spread tells you how much single results wander around it.
- Averages of many results wander much less than single results — by a predictable amount. So with enough repeats, a small real effect stands out clearly from the random wandering.
What you need
| Item | Use |
|---|---|
| A notebook and pencil | Record every result as it happens (The Scientific Method) |
| A table of squares and square roots (Units, Conversions and Mathematical Tables) | Or work them out (Arithmetic and Fractions); a slide rule speeds things up (Calculating Aids) |
| Two dice, a coin, or numbered pebbles in a bag | Making random choices fairly |
| Squared paper | Drawing tallies, histograms and charts |
Averages
The mean (what most people call "the average"): add up all the values and divide by how many there are.
The median: put the values in order and take the middle one (with an even number, halfway between the middle two). It is not pulled about by one wild value.
The mode: the value that turns up most often. Useful for things like shoe sizes.
Example. Five families' weekly milk, in litres: 6, 7, 7, 8, 32 (one family has a dairy cow).
- Mean = (6 + 7 + 7 + 8 + 32) ÷ 5 = 60 ÷ 5 = 12 litres.
- Median = 7 litres.
- Most families get about 7; the mean of 12 describes nobody. When a few values are far out, report the median, or both.
Spread
The range — highest minus lowest — is quick, but depends on the two most unusual values.
The standard deviation (written SD) is the standard measure of spread: roughly, the typical distance of a value from the mean. To calculate it:
- Find the mean.
- Subtract the mean from each value (the deviations).
- Square each deviation (this makes them all positive).
- Add the squares, and divide by one less than the number of values.
- Take the square root.
Worked example: bean harvests. Five plots without ash gave 12, 15, 11, 14 and 13 kg.
| Plot | Yield | Deviation from 13 | Squared |
|---|---|---|---|
| 1 | 12 | −1 | 1 |
| 2 | 15 | +2 | 4 |
| 3 | 11 | −2 | 4 |
| 4 | 14 | +1 | 1 |
| 5 | 13 | 0 | 0 |
| Mean = 65 ÷ 5 = 13 | Sum = 10 |
10 ÷ (5 − 1) = 2.5; √2.5 = 1.58 kg. So a typical plot is about 1.6 kg above or below 13 kg.
Why divide by one less than the number? Because the deviations were measured from the sample's own mean, which sits a little closer to the values than the true mean would; dividing by n − 1 corrects for that. With large numbers it hardly matters.
The bell curve
When a result is the sum of many small, independent causes — a harvest affected by a little more rain here, a little less sun there, a stone, a mole — the values pile up in a bell-shaped pattern around the mean, called the normal distribution. Heights of people, weights of bricks from one kiln, errors in measuring a length: all come close to it.
For a bell-shaped spread:
| Within | Fraction of values |
|---|---|
| 1 SD of the mean | about 68% — two in three |
| 2 SD | about 95% — 19 in 20 |
| 3 SD | about 99.7% — all but 3 in 1,000 |
So a value more than 3 SD from the mean is a warning sign: something unusual has happened.
Draw a tally first. Before calculating anything, mark each value on a line of squared paper as a stroke above its place and look at the shape. Two humps mean two different things mixed together (two clays, two seed lots, two measuring sticks). A long tail on one side means the median is the better average.
The error of an average
Single plots of beans wander by about 1.6 kg. The average of five plots wanders less. The rule:
Standard error of a mean = SD ÷ √(number of values)
For the beans: 1.58 ÷ √5 = 1.58 ÷ 2.24 = 0.71 kg. So "the mean yield is 13 kg" is good to roughly ±1.4 kg (two standard errors), 19 times in 20.
This is the most useful formula in the chapter. It says that to halve the uncertainty, you need four times as many repeats. Ten repeats are much better than one; a hundred are only about three times better than ten.
Fair comparisons
Now the five plots that did get wood ash: 15, 17, 14, 16 and 18 kg. Mean 16 kg, SD 1.58 kg (check it yourself as above). The ash plots did 3 kg better on average. Real, or luck?
- Standard error of each mean: 1.58 ÷ √5 = 0.71 kg.
- Standard error of the difference between two means: √(0.71² + 0.71²) = √(0.50 + 0.50) = 1.0 kg.
- Divide the difference by its standard error: 3 ÷ 1.0 = 3.0.
- Rule of thumb: if this ratio is more than about 2, the difference is probably real — luck alone would give a ratio this big less than 1 time in 20.
With small groups, luck wanders more, so the bar is higher. Use the number from this table, where "degrees of freedom" is the total number of values minus 2:
| Degrees of freedom | 4 | 6 | 8 | 10 | 15 | 20 | 30 or more |
|---|---|---|---|---|---|---|---|
| Ratio needed (1 in 20) | 2.78 | 2.45 | 2.31 | 2.23 | 2.13 | 2.09 | 2.0 |
Here there are 10 − 2 = 8 degrees of freedom; 3.0 is more than 2.31. The ash works. (This is the test William Gosset worked out for brewing trials, which he published under the name "Student".)
But only if the test was fair. No formula rescues a comparison where the treated plots had better soil, or the healthier patients got the medicine. Use the rules in The Scientific Method: divide the field into matched blocks, let a coin decide which plot in each block gets the treatment, treat everything else the same, and decide what you will measure before you start.
Comparing proportions: a medical example
A village tries willow-bark tea for a fever outbreak (Medicinal Plants). By drawing lots, 40 patients get the tea and 40 get the usual care. Of the tea group, 6 are still sick after a week (15%); of the others, 14 (35%).
- Standard error of a proportion p from n people: √(p × (1 − p) ÷ n).
- Tea: √(0.15 × 0.85 ÷ 40) = √0.0032 = 0.056. Others: √(0.35 × 0.65 ÷ 40) = √0.0057 = 0.075.
- Standard error of the difference: √(0.056² + 0.075²) = √(0.0031 + 0.0057) = 0.094.
- Difference ÷ its error: 0.20 ÷ 0.094 = 2.1.
Just over 2. Probably a real effect — but only just. The honest report is: "promising; repeat with more patients before relying on it." Never stop a trial early because the numbers look good on one day.
Chance and probability
A probability is a number from 0 (impossible) to 1 (certain). If something can happen in several equally likely ways, the probability of an event is:
(number of ways it can happen) ÷ (total number of equally likely ways)
A fair die: the chance of a six is 1/6.
And — multiply. The chance of two independent things both happening is the product of their chances. Two sixes from two dice: 1/6 × 1/6 = 1/36.
Or — add, if they cannot both happen. A five or a six on one die: 1/6 + 1/6 = 1/3.
At least once — use "not". The chance of at least one six in four throws is 1 minus the chance of no six at all: 1 − (5/6)⁴ = 1 − 0.482 = 0.518. Just better than even — the bet that started the mathematics of chance in 1654.
Expected value. Multiply each outcome by its probability and add. If a field gives 2,000 kg of grain in a good year (chance 0.6), 1,200 kg in a poor year (0.3), and 300 kg in a drought (0.1), the long-run average is 2,000 × 0.6 + 1,200 × 0.3 + 300 × 0.1 = 1,200 + 360 + 30 = 1,590 kg a year. But you cannot eat an average: the store must carry you through the drought year.
Runs of bad luck. If a drought comes 1 year in 10, the chance of two in a row is 1/100, but over a lifetime of 50 years the chance of at least one double drought is about 1 − (99/100)⁴⁹ ≈ 0.39. Plan stores for it (Preserving Food).
The trap of rare diseases
A test for a disease catches 90% of people who have it, and wrongly flags 5% of healthy people. One person in 100 has the disease. Someone tests positive. How likely are they to be ill? Most people guess 90%. Count it out for 1,000 people:
| Ill (10) | Healthy (990) | |
|---|---|---|
| Test positive | 9 | about 50 |
| Test negative | 1 | about 940 |
Of the 59 positives, only 9 are ill: about 15%. When a condition is rare, most positive results are false. Confirm with a second, different test before acting drastically (Examining a Patient).
Sampling
You cannot test every seed, weigh every brick or ask every person. A sample stands for the whole — if it is chosen fairly.
- Random means by lot, not by hand. Number the sacks, put numbered pebbles in a bag, and draw. Never pick "a few from the top": the top of a grain heap is the driest; the bricks you can reach are from the coolest part of the kiln.
- Spread it out. For a grain store, take a cupful from the top, middle and bottom of every tenth sack, mix, and test the mixture.
How sure is a proportion? In a germination test, 170 of 200 seeds sprout: 85%. The standard error is √(0.85 × 0.15 ÷ 200) = √0.00064 = 0.025, so the true rate for the whole seed lot is 85% ± 5% (two standard errors): between 80% and 90%, 19 times in 20. To narrow that to ±2.5%, test four times as many seeds.
Acceptance sampling. You buy nails in lots of 1,000 and check 20 from each lot. If a lot has 10% bad nails, the chance that all 20 of your sample are good is 0.9²⁰ = 0.12. So a rule of "accept if none of 20 is bad" catches a 10%-bad lot 88 times in 100 — and lets 12 through. Decide on the rule in advance, and tighten it (check 50) if bad lots are costly.
Errors in measurement
Every measurement has two kinds of error (Measurement from Scratch, Forces, Energy and Heat):
- Random error — your eye, the wobble of the rope, the gust of wind. Different each time, sometimes high, sometimes low. Averaging repeats reduces it, by the √n rule.
- Systematic error — a stretched measuring rope, a balance with one arm longer, a thermometer whose zero is off. The same every time. Averaging does nothing; only checking against a standard finds it. Swap the pans on a balance, measure a length with two different ropes, check a thermometer in melting ice.
Example. You measure a beam five times: 412.3, 412.6, 412.1, 412.5, 412.4 cm. Mean 412.38, SD 0.19, standard error 0.19 ÷ √5 = 0.09. Report 412.4 ± 0.2 cm — and do not give more decimals than that, which would be claiming knowledge you do not have.
Quality control
A workshop that measures a few items every day can see trouble coming. Make a control chart:
- While the process is known to be working well, take samples — say 5 bricks a day for 20 days — and weigh them. Work out the overall mean (say 3.00 kg) and the SD of single bricks (say 0.12 kg).
- The average of each day's 5 should stay within 3 standard errors of the overall mean: 3 × 0.12 ÷ √5 = 0.16 kg. So the control limits are 2.84 and 3.16 kg.
- Draw the chart: days across, daily average up, with lines at 3.00 (centre), 2.84 and 3.16.
- Every day, plot the day's average.
Act when:
- One point falls outside the limits.
- Seven points in a row fall on the same side of the centre line (a slow drift — a mould wearing, clay from a new pit).
- Points climb or fall steadily six times in a row.
Do not act on ordinary wobbles inside the limits. Adjusting a process every time it wanders by chance makes it worse, not better.
Two things that move together
Do fields with more manure give more grain? Plot each field as a dot: manure across, yield up. If the dots lie roughly along a line, the two are correlated.
The best straight line (the method of least squares). For values x and y:
- Find the means, x̄ and ȳ.
- Slope = (sum of (x − x̄) × (y − ȳ)) ÷ (sum of (x − x̄)²).
- The line passes through (x̄, ȳ).
Example. Manure (cartloads per field): 1, 2, 3, 4, 5. Grain (hundreds of kg): 2, 4, 5, 4, 5. Means: 3 and 4. Products of deviations: (−2)(−2) + (−1)(0) + (0)(1) + (1)(0) + (2)(1) = 4 + 0 + 0 + 0 + 2 = 6. Squares of x deviations: 4 + 1 + 0 + 1 + 4 = 10. Slope = 0.6: each extra cartload goes with about 60 kg more grain.
Correlation is not cause. The best farmers may both manure more and weed more. To know whether manure itself causes the gain, run a fair, randomised trial (The Scientific Method, Compost and Manure).
How to tell it worked
- Check arithmetic by a second route: the deviations from the mean must add to zero; the sum of the values must equal the mean times their number.
- Make a picture. A tally or a plot shows mistakes and oddities that a column of numbers hides.
- Test your methods on chance itself. Throw a die 60 times: you should get roughly 10 of each face, with typical wobbles of about ±3. If your "significance" rule regularly declares a coin biased, it is too loose.
Note Common mistakes. A "big effect" from a few results → small samples wander a lot; use the table of ratios and repeat the trial. Running many comparisons and reporting the one that "worked" → one in twenty will pass by luck. Decide the comparison before you start, or repeat any surprise. Comparing groups that differed from the start → assign by lot. Averaging away a mistake → a wildly different value may be a slip of the pen or a real event; find out which before dropping it. Reporting too many decimals → round to the size of your standard error.
Dangers
- False confidence kills. A remedy "proven" on ten patients can cost lives when hundreds rely on it. State uncertainty plainly, and repeat important trials.
- Rare-disease and rare-fault traps (above): never take drastic action on one positive test.
- Averages hide people. "The average family has enough grain" can be true while some families starve. Look at the lowest values, not only the mean (Organising a Community).
- Numbers can be bent. Choosing which results to count, or which groups to compare, after seeing the data is the commonest way that honest people fool themselves and dishonest people fool others. Write the plan down first.
Going further
- Life tables: counting births and deaths by age to plan food, schools and care (Planning a Settlement).
- Experimental design: Latin squares and factorial trials test several factors at once on the same field (Saving Seed and Breeding Plants, Farming from Seed).
- Reliability: how often machines fail, and how many spares to keep (Machine Tools).
- Calculus turns the bell curve and probability into exact formulas (Calculus).
How it was first done
Gamblers' questions started it: Gerolamo Cardano in Italy wrote on dice in the 1560s, and in 1654 Blaise Pascal and Pierre de Fermat worked out, in letters, how to divide stakes fairly in an unfinished game. In 1662 the London haberdasher John Graunt analysed the city's weekly lists of deaths by cause and age and drew up the first rough life table. Jacob Bernoulli proved in 1713 that averages settle down as trials increase, and Abraham de Moivre found the bell curve in 1733. Adrien-Marie Legendre (1805) and Carl Friedrich Gauss (1809) gave the method of least squares for fitting lines to astronomical measurements. In the 1850s Florence Nightingale used statistics and diagrams to show that soldiers were dying of disease in dirty hospitals, not of wounds, and changed army medicine. William Sealy Gosset, a chemist at the Guinness brewery in Dublin, published the small-sample test as "Student" in 1908. Walter Shewhart at Bell Telephone in America invented the control chart in 1924, and Ronald Fisher at the Rothamsted farm station in England set out randomised field experiments in the 1920s.
Source: content/entries/knowledge/statistics.md