Statistics Easy Read · Complete bookTip: in the print dialog choose “Save as PDF”.
Statistics · Easy Read edition

Statistics

Easy Read edition · all 14 chapters · by Dr. Akash Garg
Statistics Easy Read · Chapter 1

What Statistics Is

Statistics is not a branch of math that exists to punish you. It is a set of honest habits for one stubborn fact about the world: things vary. Two people on the same diet lose different amounts of weight. Two machines that are the same make slightly different parts. Two polls of the same election disagree by three points. Statistics is the skill of describing that variation clearly. It is also the skill of deciding what a small pile of data does, and does not, let you conclude about the much larger world it came from. This chapter builds the words that every later chapter leans on. It does so with math no harder than splitting a restaurant bill.

By the end of this chapter you can

  • Explain what statistics is and why variation makes it needed.
  • Tell descriptive statistics apart from inferential statistics, and say which one a given claim uses.
  • Define population, sample, parameter and statistic. Use the right symbols (μ, σ, N versus x̄, s, n).
  • Explain why we sample. Tell sampling error apart from sampling bias.
  • Sort a variable as qualitative or quantitative, and sort quantitative variables as discrete or continuous.
  • Place a variable at its level of measurement: nominal, ordinal, interval or ratio. Say which sums that level allows.
  • Work out and explain a mean, a median and a range. Explain when the mean misleads.
  • Read a claim built on statistics with a critical eye. Name the most common ways numbers are used to mislead.

Section 1Why statistics: turning data into decisions

An annotated box plot showing median, quartiles, whiskers, and outliers
Reference. A labeled box plot. A whole data set is squeezed into a center, a spread and a few unusual points. Source and license: see the figure credits

Variation is the reason this subject exists

If every patient responded to a drug in the same way, you would need one patient to test it. If every light bulb failed at exactly 1,200 hours, you would need one bulb to write the warranty. Nothing behaves that way. Measurements of the same thing differ. People differ from one another. Repeating a study gives slightly different answers each time. Statistics is the science of collecting, organizing, summing up and drawing conclusions from data when that variation is present.

The practical payoff is decisions. Think of a hospital deciding whether to change a protocol. Think of a company deciding which of two web pages to keep, or a city deciding where to put a bus route. All of them face the same problem. They have some data. The data are noisy. The data cover only part of the situation. And a choice still has to be made. Statistics is how you make that choice one you can defend, not just one you feel sure about.

The field splits cleanly in two. Knowing which half you are in is most of the battle. Descriptive statistics sums up the data you actually have. Inferential statistics uses those data to make a claim about a larger group you did not measure. It also attaches an honest statement of uncertainty to that claim.

Descriptive statistics: making a pile of numbers speak

Say you record your trip to work, in minutes, on nine workdays:

22, 25, 19, 31, 24, 27, 21, 88, 23

Nine numbers is already too many to hold in your head. Descriptive statistics squeezes them down. Start with the mean (the arithmetic average). It is written x̄ and read “x-bar”:

x̄ = Σx ÷ n

The symbol Σ (capital sigma) just says “add them all up.” And n is how many values you have. Adding: 22 + 25 + 19 + 31 + 24 + 27 + 21 + 88 + 23 = 280, and n = 9, so

x̄ = 280 ÷ 9 = 31.1 minutes

Now the median, the middle value once the data are sorted. Sorted, the nine values are 19, 21, 22, 23, 24, 25, 27, 31, 88. With n = 9, the middle position is the 5th. So the median is 24 minutes. And the range, the roughest measure of spread, is largest minus smallest: 88 − 19 = 69 minutes.

Look at what those three numbers show. The mean says 31.1 minutes. The median says 24. They disagree because of one day, the 88, when something went badly wrong. Delete that one day, and the other eight add up to 192. That gives a mean of 192 ÷ 8 = 24.0 minutes, exactly the same as the median. One unusual value dragged the average up by seven minutes. If you planned 31 minutes for your trip, you would be early almost every single day.

That is the first real lesson of the subject. A summary is a choice, and different summaries answer different questions. The median answers “what is a typical day?” The mean answers “what happens on average over many days?” That is the right question if you are adding up the hours lost to the trip over a year.

Inferential statistics: from the part to the whole

Descriptive work stops at the data in front of you. The moment you say “and so the population is like this,” you have crossed into inference. Say 640 of 1,000 voters surveyed favor a measure. The descriptive fact is that 64% of those 1,000 favored it. The inferential claim is “about 64% of all voters favor it, give or take three points.” That is a leap. Inference is the machinery that makes the leap safely. It also measures how far off target the leap might land.

Two tools do most of that work. Both are often described wrongly, so meet them correctly now, even though the details come later. A confidence interval is a range built from your sample by a method with a known success rate over the long run. “95% confidence” describes the method. It means that if the study were repeated over and over, about 95% of the intervals made that way would contain the true value. It does not mean there is a 95% chance that the one interval in front of you contains it. A p-value is the chance of getting data at least as extreme as yours if a stated “nothing is going on” hypothesis were true. It is firmly not the chance that the hypothesis is true.

Both tools come with conditions, and the conditions are the part most often skipped. Their promised performance, the 95% and the p-value, holds only under three conditions. The sample must truly be drawn at random from the population being described. The observations must not depend on one another (they must be independent). And the model behind the math must fit the data reasonably well. Feed either method a sample that picked itself, and it will still give back a neat interval and a crisp p-value. Those numbers just will not mean what they claim to. Assumptions are not fine print added on after a result. They are the wall holding up the result. Every later chapter will state them before it states a conclusion.

 Descriptive statisticsInferential statistics
QuestionWhat do these data look like?What does the larger group look like?
Scope of claimOnly the cases measuredBeyond the cases measured
Typical toolsMean, median, range, standard deviation, tables, histograms, box plotsConfidence intervals, hypothesis tests, regression, margin of error
UncertaintyNone to report: the numbers are what they areMust be reported: it is the whole point
Example“The 30 students in this class averaged 78 on the exam.”“Students taught this way score about 5 points higher, 95% CI 2 to 8.”
Descriptive statements cannot be wrong; inferential ones can. Say you worked out the mean of your 30 students correctly. No future data can prove it wrong. It is a fact about those 30 people. But the claim that all students taught this way gain 5 points is a bet about people you never measured. It can be flatly wrong. Every argument about statistics is really an argument about that second kind of statement.
Interactive Draw real samples from a simulated city of 20,000 heart rates: describing the sample gives exact facts, while inferring about the population produces a confidence interval whose long-run capture rate you can watch converge on 95%. Open full ↑
Key points
  • Statistics exists because measurements and people vary. Its job is turning noisy data into decisions you can defend.
  • Descriptive statistics sums up the data you have. Inferential statistics reaches beyond them and reports the uncertainty.
  • The mean (x̄ = Σx ÷ n) is pulled by extreme values. The median is not. Report both when they disagree.
  • “95% confident” describes how the method behaves over the long run. It is not the chance that this one interval is right.

Section 2Population and sample

Diagram contrasting a large population with a smaller sample drawn from it
Reference. Population versus sample. The sample is the handful we measure. The population is the whole we want to describe. Source and license: see the figure credits

The whole group and the piece you can afford

A population is the whole collection of people, objects or measurements you actually want to know about. A sample is the part of that population you manage to observe. Notice that “population” does not have to mean people. It can be every weld on a bridge, every sale last quarter or every possible roll of a die. The question you are asking defines the population. If you want to know about licensed electricians in Ohio, that is your population. A study of the electricians who work for one Ohio contractor is a sample from it, and possibly a poor one.

Measuring every member of a population is a census. It is the ideal, and it is most often impossible. Populations may be too big, too costly to reach or too spread out. They may still be forming, since next year's customers do not exist yet. Or measuring may destroy them. You cannot crash test every car you plan to sell, or taste test every jar of sauce. A well chosen sample of 1,200 people can describe a nation of 300 million to within a few percentage points. It costs only a few days of phone calls. That efficiency is the whole reason sampling exists.

Parameter versus statistic

This difference carries the rest of the book, so learn it once and learn it well. A parameter is a number that describes a population. A statistic is a number that describes a sample. The parameter is what you want. The statistic is what you can get. Each has its own symbols. Mixing them up is the most common symbol error in a first course.

QuantityPopulation parameterSample statisticStatus
SizeNnCounts
Meanμ (mu)x̄ (x-bar)μ is fixed and unknown; x̄ varies by sample
Standard deviationσ (sigma)sσ is fixed and unknown; s varies
Proportionpp̂ (p-hat)p is fixed and unknown; p̂ varies

Here is a memory hook that really works. Population goes with Parameter and with Greek letters. Sample goes with Statistic and with ordinary Roman letters. Greek for the truth you cannot see, Roman for the estimate you can work out.

Worked example: one parameter, many statistics

Take a tiny population of five workers whose years on the job are 2, 4, 6, 8 and 10. This population is small enough to measure fully. So we can work out the parameter directly:

μ = (2 + 4 + 6 + 8 + 10) ÷ 5 = 30 ÷ 5 = 6 years

The population standard deviation uses σ = √[ Σ(x − μ)2 ÷ N ]. The gaps (deviations) from 6 are −4, −2, 0, 2, 4. Squaring gives 16, 4, 0, 4, 16, which add up to 40. So σ2 = 40 ÷ 5 = 8 and σ = √8 ≈ 2.83 years.

Now pretend we could only afford to look at three workers. Different samples of three give different answers:

Sample of n = 3Sumx̄Σ(x − x̄)2s2 = Σ(x − x̄)2 ÷ (n − 1)s
2, 4, 6124.04 + 0 + 4 = 88 ÷ 2 = 42.00
2, 6, 10186.016 + 0 + 16 = 3232 ÷ 2 = 164.00
6, 8, 10248.04 + 0 + 4 = 88 ÷ 2 = 42.00

The parameter μ never moved. It is 6, for good. The statistic x̄ came out 4.0, 6.0 and 8.0. That spread of answers is sampling error. It is the difference between a sample statistic and the population parameter that cannot be avoided. It comes only from looking at a part instead of the whole. Sampling error is not a mistake, and it cannot be wiped out. It can only be measured and shrunk. Larger samples make it smaller.

Notice also the n − 1 in the sample variance. Gaps are measured from x̄, which is itself pulled toward the sample's own values. So the squared gaps come out a little too small on average. Dividing by n − 1 instead of n fixes that tilt. Then s2 neither overestimates nor underestimates σ2 in a steady way. Population variance divides by N. Sample variance divides by n − 1.

Sampling bias is a whole different animal. Bias is a steady tilt in how the sample was chosen. It pushes the statistic away from the parameter in the same direction each time. Examples are surveying only people who answer landlines, only customers who bothered to leave a review, or only patients well enough to come back for follow-up. The defense against sampling error is a bigger sample. The defense against bias is a properly random one, in which every member of the population has a known chance of being picked that is not zero.

A biased sample does not get better by getting bigger. In 1936, the Literary Digest mailed ten million straw ballots and got about 2.4 million back. That was a huge sample. It confidently predicted that Alf Landon would beat Franklin Roosevelt. Roosevelt won in a landslide. The magazine took its addresses from car registrations, phone books and its own subscriber list. In the Depression, these leaned toward wealthy people. And only people who cared a lot mailed the ballot back. Two and a half million wrong people are still the wrong people. Size fixes sampling error. Only good design fixes bias.
Interactive Draw real random samples from a fully visible population of 400 and watch the sample mean miss the population mean every time, then hide the population to see the honest view of research. Open full ↑
Key points
  • A population is everyone or everything you want to describe. A sample is the part you observe. A census measures the whole population.
  • Parameters (μ, σ, p, N) describe populations. They are fixed but unknown. Statistics (x̄, s, p̂, n) describe samples. They change from sample to sample.
  • We sample because a census costs too much, takes too long, cannot reach everyone or destroys what it measures.
  • Sampling error is the natural wobble from sample to sample. It shrinks with a larger n. Sampling bias is a steady tilt from poor selection. It shrinks only with better design.

Section 3Types of data

Bar graphs displaying counts across several categories
Reference. Bar graphs: the standard display for qualitative data. The bars name groups (categories), not points along a scale. Source and license: see the figure credits

Qualitative versus quantitative

A variable is any trait that can differ from one person or thing to the next. The recorded values are the data. The first fork in the road is whether the variable names a quality or measures an amount.

Qualitative variables (also called categorical variables) put each person or thing into a group (a category). Examples are blood type, brand of phone, county where you live and whether a part passed inspection. The values are labels. You can count how many fall in each group and work out percentages. But the labels themselves cannot be added, averaged or subtracted.

Quantitative variables (also called numerical variables) record an amount or a count. Examples are height, salary, number of brothers and sisters, and reaction time in milliseconds. Their values are real numbers, and math on them means something. Here is a useful test. Ask "how much" or "how many." If the answer is a number you would sensibly add up, the variable is quantitative.

Discrete versus continuous

Quantitative variables split again. A discrete variable can take only separate values, most often from counting. You can list the choices, and there are gaps between them. The number of children in a household is 0, 1, 2, 3, …. No household has 2.4 children. A continuous variable can take any value in a range, most often from measuring. Between any two possible values there is always another. A person's weight might be 68 kg, 68.4 kg or 68.4173 kg. The only limit is how precise the scale is.

The rule of thumb: things you count are discrete, and things you measure are continuous. Money is the classic gray case. Strictly it is discrete, because it comes in cents. But it has so many closely spaced values that we treat it as continuous in practice.

VariableQualitative or quantitative?Discrete or continuous?Why
Blood type (A, B, AB, O)Qualitative-A label, not an amount
Eye colorQualitative-A category
Number of siblingsQuantitativeDiscreteCounted; only whole numbers occur
Cars sold per dayQuantitativeDiscreteCounted; gaps between values
Body temperatureQuantitativeContinuousMeasured; any value in a range
Time to finish a raceQuantitativeContinuousMeasured; limited only by the clock
ZIP codeQualitative-Digits used as a name for a place

Numbers that are not quantities

Plenty of data look like numbers but are not amounts. ZIP codes, jersey numbers, patient ID numbers and phone numbers are made of digits. But the digits work as names. The average ZIP code of your customers is a meaningless number that a spreadsheet will happily work out for you. The same trap shows up when groups are coded for a computer. Entering 1 = single, 2 = married, 3 = divorced does not make marital status quantitative. A “mean marital status of 1.8” is nonsense. Always ask what the number stands for, not what it looks like.

Here is a worked point on the discrete side that trips people up. An average of a discrete variable need not be a possible value. Take five households with 1, 2, 0, 3 and 2 children. The sum is 1 + 2 + 0 + 3 + 2 = 8, and n = 5, so

x̄ = 8 ÷ 5 = 1.6 children per household

No household has 1.6 children, and that is fine. The mean sums up the group. It does not describe any one member. “The average family has 1.6 children” is a correct statement about families as a group. It is an absurd statement about any one family.

Ask what the number means before you do math on it. A spreadsheet will average ZIP codes, jersey numbers and coded groups without complaint. That is because software checks the data type, not the meaning. You are the only safeguard. If adding two values gives something that cannot exist, such as ZIP 12345 plus ZIP 67890, the variable is qualitative, no matter how much it looks like a number.
Interactive Classify eight real columns from a 120-household survey as qualitative or quantitative, discrete or continuous, with a live dot plot and a measuring-precision slider that reveals which variables keep splitting into new values and which stay frozen on the whole numbers. Open full ↑
Key points
  • Qualitative (categorical) data name groups. Quantitative (numerical) data measure amounts or counts.
  • Quantitative data are discrete (counted, separate values) or continuous (measured, any value in a range).
  • Digits are not always amounts. ZIP codes and coded groups are qualitative.
  • The mean of a discrete variable can be a value no one has (1.6 children). A summary describes the group, not a member.

Section 4Levels of measurement

A chart showing countries arranged in rank order
Reference. A ranked order: the key picture of ordinal data. The position matters, but the gaps between positions are not equal. Source and license: see the figure credits

Four levels, each adding one property

Sorting data as qualitative or quantitative is a good first cut. But it is too rough to tell you which sums are fair to do. The levels of measurement refine it into four rungs. Each rung keeps everything the rung below has and adds exactly one new ability. So the ladder is easy to remember.

Nominal is the bottom rung: groups with no natural order. Examples are blood type, religion, marital status and department. You can count and compare how often each comes up, and that is all. The only measure of center you can use is the mode, the most common group.

Ordinal adds order. Groups can be ranked, but the distances between ranks are unknown or unequal. Examples are class rank, military rank, letter grades, survey answers from “strongly disagree” to “strongly agree,” and cancer stage I-IV. First, second and third place tell you who beat whom, but not by how much. The winner may have finished a tenth of a second ahead of second place. Second place may have been five minutes ahead of third. The mode and the median can be used. The mean is doubtful.

Interval adds equal, meaningful distances. The gap between 20 and 30 is the same size as the gap between 70 and 80. So adding and subtracting are fair. What interval scales lack is a true zero. Their zero is a chosen landmark, not the absence of the thing. Temperature in Celsius or Fahrenheit is the standard example. Calendar years and IQ scores are others. The mode, the median and the mean can all be used, but ratios cannot.

Ratio adds the true zero, where 0 really means “none of it.” Examples are height, weight, age, income, distance, reaction time and counts of anything. Because zero is real, ratios finally mean what they say. 40 kg is twice 20 kg. A 60 minute task takes three times as long as a 20 minute task. Every summary statistic is allowed.

LevelCategories?Ordered?Equal intervals?True zero?ExamplesCenter you may use
NominalYesNoNoNoBlood type, ZIP code, eye colorMode only
OrdinalYesYesNoNoLetter grade, cancer stage, race placingMode, median
IntervalYesYesYesNoCelsius, Fahrenheit, calendar year, IQMode, median, mean
RatioYesYesYesYesHeight, weight, income, time elapsedAll, plus meaningful ratios

The zero test, worked out in numbers

The line between interval and ratio is the one students really get wrong. One calculation settles it. Is 20°C twice as hot as 10°C? At first glance, 20 ÷ 10 = 2, so it looks that way. Test that claim. Write the same two temperatures on a different scale and work out the ratio again.

Change to Fahrenheit with °F = (9 ÷ 5) × °C + 32:

10°C → (9 ÷ 5)(10) + 32 = 18 + 32 = 50°F
20°C → (9 ÷ 5)(20) + 32 = 36 + 32 = 68°F
Ratio: 68 ÷ 50 = 1.36

Change to kelvin, which does have a true zero, with K = °C + 273.15:

10°C → 283.15 K
20°C → 293.15 K
Ratio: 293.15 ÷ 283.15 = 1.035

The same two physical states give ratios of 2, 1.36 and 1.035, depending on which scale you write them in. If "twice as much" changes when you change units, it is not really a ratio at all. The kelvin figure is the honest one. That is because 0 K is the real absence of heat energy, while 0°C is just the freezing point of water, a handy landmark someone chose. Differences, however, survive the change perfectly. 20°C − 10°C = 10 Celsius degrees, and 293.15 K − 283.15 K = 10 kelvins. That is exactly what “interval level” means. Differences can be trusted. Ratios cannot.

Why the level dictates the arithmetic

Think of four patients who rate their pain on a 0 to 10 scale as 2, 3, 3 and 8. The mean is (2 + 3 + 3 + 8) ÷ 4 = 16 ÷ 4 = 4.0. The median is the average of the two middle values, (3 + 3) ÷ 2 = 3.0. Which should you report? A pain rating people give themselves is ordinal. Nothing promises that the step from 2 to 3 hurts as much as the step from 7 to 8. And one patient's 8 is not another's 8. The mean of 4.0 quietly assumes equal spacing that the scale does not give. It has also been dragged up by the one 8. The median of 3.0 assumes only that the ratings can be ranked, which is true. So it is the safer summary.

In practice, researchers do sometimes average ordinal scales. Averaging Likert answers is nearly universal. It is often fair when there are many groups and they are spaced about evenly. But it is a modeling assumption, not a right given by math. It should be made on purpose. The general rule holds: statistics worked out at a higher level than your data support will give numbers that look exact and mean nothing.

The zero test in one question. Ask: does 0 on this scale mean “none of the thing”? If yes, the scale is ratio, and “twice as much” is a real statement. If 0 is just a handy marker, such as 0°C, the year 0 or an IQ of 0, the scale is interval. You may add and subtract, but never divide one value by another.
Interactive Re-number, re-space and re-scale four real variables in ways each one actually permits, and watch live which statistics survive, the mode, the median, the mean, the difference, the ratio, and which were only ever artifacts of the numbers you chose. Open full ↑
Key points
  • The four levels are nominal → ordinal → interval → ratio. Each adds one property: order, then equal gaps, then a true zero.
  • Nominal allows only counts and the mode. Ordinal adds the median. Interval adds the mean. Ratio adds ratios that mean something.
  • Interval scales lack a true zero. So 20°C is not twice as hot as 10°C. The same pair gives ratios of 2, 1.36 or 1.035, depending on the unit.
  • Averaging ordinal data assumes equal spacing the scale does not promise. The median is the safer summary.

Section 5How statistics mislead

A chart showing two unrelated time series that track each other closely, a spurious correlation
Reference. A false (spurious) correlation: two unrelated series that rise and fall together. It proves only that coincidence is common. Source and license: see the figure credits

Correlation is not causation

Two variables are correlated when they move together. That fact alone allows four very different explanations, and the math cannot tell them apart. A may cause B. B may cause A. (Hospitals are full of sick people, but hospitals do not cause sickness.) A third factor, a confounding variable, may cause both. Or it may be coincidence, which is far more common than you would guess. Sift enough data series against enough other series, and you will find pairs that track each other beautifully and have nothing to do with each other.

The classic confounding example: ice cream sales and drownings rise and fall together across the year. Ice cream does not drown anyone. Hot weather drives both, each on its own. The way to break a confound is a randomized experiment. Here the researcher assigns the treatment by chance. Then all other factors, known and unknown, are balanced across groups on average. Data from just watching (observational data) can suggest causes. Randomization is what lets you claim one.

The standard repertoire of tricks

Most misleading statistics are not made up. They are true numbers shown in a way that leads a reasonable reader to a false conclusion. A short list covers most of what you will meet.

The trickWhat it looks likeThe question that defeats it
Truncated axisA bar chart whose y-axis starts at 94 instead of 0, turning a 2% gap into a cliffWhere does the axis start, and how big is the change really?
Cherry-picked window“Crime is up 30%” measured from an unusually quiet yearWhy that start date? What does the full series look like?
Relative risk alone“Doubles your risk” with no baseline givenDoubles it from what to what, in absolute terms?
Missing denominator“More accidents happen within 5 miles of home”Out of how many trips? Is the rate actually higher?
Survivorship bias“Our graduates earn six figures” measured only on those who repliedWho is missing from this data, and why?
Average hides the spread“Average wait 12 minutes” when half wait 2 and half wait 40What is the median? What is the spread? Show me the distribution.
Selective outcome reportingTwenty outcomes measured, the one “significant” result publishedHow many things were tested? Was this planned in advance?
Tiny or unstated sample“80% of users preferred it” (from ten users)What is n? Who were they? How were they chosen?
Precision theater“Satisfaction rose to 73.62%” from a survey of 200Do the data support that many digits? Where is the margin of error?

The relative risk trick deserves the math, because it is the one that changes real decisions. Say a condition affects 2 in 1,000 untreated people. A new drug cuts that to 1 in 1,000. Two headlines are possible, and both are true:

Relative risk reduction = (0.002 − 0.001) ÷ 0.002 = 0.001 ÷ 0.002 = 0.50 = 50%: “the drug halves your risk.”

Absolute risk reduction = 0.002 − 0.001 = 0.001 = 0.1 percentage points: one fewer case per thousand people treated.

The absolute figure gives you the number needed to treat: NNT = 1 ÷ 0.001 = 1,000. One thousand people must take the drug for one to benefit. “Cuts your risk in half” and “999 out of 1,000 people get no benefit” describe the very same study. Marketing prints the first. A fair report prints both. Whenever you see a percent change in a risk, find the starting point (the baseline) before you react.

Reading a claim critically

You do not need advanced methods to catch most bad statistics. You need a short list of questions, asked again and again.

Two readings are worth nailing down for good, because they are misstated all the time, even in published work. A p-value of 0.03 means this. If there were truly no effect, data at least as extreme as ours would turn up about 3% of the time. It does not mean there is a 3% chance the effect is absent. It does not mean a 97% chance the finding is real, or that the effect is large. The mirror image error is just as common and just as harmful. A large p-value, say 0.40, does not show that there is no effect. Failing to find strong evidence against a hypothesis is not the same as showing it is true. A small or noisy study often misses real effects. “We did not reject it” means only that these data fit with it. Absence of evidence is not evidence of absence. And a 95% confidence interval of 2 to 8 points describes a method. Used again and again across many studies, the method catches the true value about 95% of the time. For the single interval printed in front of you, the true value is either inside it or it is not. The 95% belongs to the method, not to this one result.

Be as doubtful of numbers you like as of numbers you don't. The hardest failure to catch is the study that confirms what you already believe. You stop asking questions the moment you agree. Run the same checklist on both. Statistics is not a tool for winning arguments. It is a discipline for finding out that you were wrong before someone else does.
Interactive Seven real-looking statistical claims, each wired to a live simulation, drag the axis baseline, cherry-pick a window, move the outlier, isolate the confounder, until the flaw computes itself into the open. Open full ↑
Key points
  • Correlation allows four explanations: cause, reverse cause, confounding or coincidence. Only a randomized experiment singles out cause.
  • Common tricks: cut off axes, cherry picked starting points, relative risk without the absolute, missing denominators, survivorship bias, and averages that hide the spread.
  • A 50% relative cut can mean a 0.1 percentage point absolute cut and an NNT of 1,000. Always ask for the baseline.
  • A p-value is not the chance the hypothesis is true. A 95% confidence interval describes the method over the long run, not this one interval.

The chapter in one breath

  • Statistics exists because things vary. It turns noisy, partial data into decisions you can defend.
  • Descriptive statistics sums up the data in hand. Inferential statistics reaches out to a population and must report its uncertainty.
  • The mean is pulled by extreme values and the median is not. Nine trips that averaged 31.1 minutes had a median of just 24.
  • A population is what you want to know about. A sample is what you can afford. Parameters (μ, σ, p) are fixed and unknown. Statistics (x̄, s, p̂) vary from sample to sample.
  • Sampling error is a wobble you cannot avoid, and it shrinks with larger samples. Sampling bias is a design flaw that a bigger sample does not touch. Extra data only pin down the wrong value more exactly.
  • Data are qualitative (groups) or quantitative. Quantitative data are discrete (counted) or continuous (measured). Digits alone do not make an amount.
  • The four levels of measurement are nominal, ordinal, interval and ratio. Each adds one property, and they decide which sums are fair. Without a true zero, “twice as much” means nothing.
  • Most misleading statistics use true numbers framed badly. Ask what was measured, on whom, compared with what, out of how many, and who is missing.

ReferenceWords worth knowing

A quick reference for the terms in this chapter. Skim it now to see the shape of the words. Then come back whenever a word in a later chapter will not sit still.

Bias (sampling bias)
A steady tendency for a way of sampling to give statistics that miss the parameter in the same direction. Unlike sampling error, a larger sample does not reduce it.
Categorical (qualitative) variable
A variable whose values are labels that put each person or thing into a group, such as blood type or county. Counts and percentages mean something. Math on the labels does not.
Census
A study in which every member of the population is measured. It gives parameters directly instead of estimating them.
Confidence interval
A range of likely values for a parameter. It comes from a method with a stated success rate over the long run. “95% confidence” describes how often the method catches the truth across many repeats. It is not the chance that one particular interval does.
Confounding variable
An outside factor linked to both variables being studied. It can make the two seem linked (correlated) even when neither causes the other.
Continuous variable
A quantitative variable that can take any value within a range, limited only by how precisely it is measured: height, time, temperature.
Correlation
A tendency for two variables to move together. A correlation fits four different situations: one variable causing the other, the reverse, a confounding variable driving both, or coincidence. The number itself cannot tell them apart. Only a randomized experiment allows a claim about cause.
Descriptive statistics
Methods for organizing and summing up the data actually collected. They make no claim about anyone not measured.
Discrete variable
A quantitative variable whose possible values are separate, most often from counting: number of children, cars sold per day.
Inferential statistics
Methods for drawing conclusions about a population from a sample. They always come with a statement of uncertainty.
Interval level
A level of measurement with ordered groups and equal, meaningful distances, but no true zero. Differences mean something; ratios do not. Celsius temperature and calendar years are examples.
Mean
The arithmetic average: Σx ÷ n for a sample and Σx ÷ N for a population. It uses every value. That is why one extreme value can pull it far from most of the data.
Median
The middle value of a sorted data set. When the count is even, it is the average of the two middle values. How extreme the extreme values are does not affect it. So it is the more honest summary of a lopsided (skewed) distribution.
Mode
The value or group that comes up most often. It is the only measure of center you can use for nominal data.
Nominal level
The lowest level of measurement: groups with no order. Only counts, proportions and the mode mean something.
Ordinal level
A level of measurement whose groups can be ranked, but with unknown or unequal distances between ranks. The median fits. The mean needs an added assumption.
Parameter
A number that describes a population, such as μ or σ. Its value is fixed and, in practice, unknown.
Population
The whole collection of people, objects or measurements that a question is about.
P-value
The chance of seeing data at least as extreme as those found, worked out assuming a stated null hypothesis is true. It is not the chance that the hypothesis is true.
Quantitative (numerical) variable
A variable that records an amount or a count. Math on it means something.
Random sample
A sample picked by chance, in which every member of the population has a known chance of being picked that is not zero. It is the main defense against bias.
Range
The largest value minus the smallest. It is the simplest measure of spread, and the most fragile, since the two most extreme values decide it fully.
Ratio level
The highest level of measurement: ordered, equally spaced and with a true zero that means “none.” Ratios such as “twice as much” mean something. Weight, income and time passed are examples.
Sample
The part of a population that is actually observed and measured.
Sampling error
The natural difference between a sample statistic and the population parameter. It comes only from looking at a part instead of the whole. It shrinks as the sample size grows.
Statistic
A number that describes a sample, such as x̄ or s. It can be worked out from data, and it is different for every sample drawn.
Variable
Any trait that can differ from one person or thing to another. The recorded values of a variable are the data.

Check yourself

1. A researcher reports, “The 48 patients in our clinic averaged a systolic pressure of 134 mmHg.” Is this descriptive or inferential? What would have to change to make it the other kind?
Descriptive. The claim stays with the 48 people actually measured. So it cannot be wrong if the math is right. It becomes inferential the moment it reaches further. For example: “patients at clinics like ours average about 134 mmHg, 95% CI 130 to 138.” That is a claim about people who were never measured. So it needs a statement of uncertainty.
2. Seven workers' trip times to work, in minutes, are 15, 18, 20, 22, 24, 27 and 94. Work out the mean and the median. Say which better shows a typical trip.
Mean = 31.4 minutes; median = 22 minutes. The median is the better summary of a typical day. Sum: 15 + 18 + 20 + 22 + 24 + 27 + 94 = 220, and n = 7, so x̄ = 220 ÷ 7 = 31.43. The data are already sorted. With n = 7, the median is the 4th value, 22. Six of the seven trips are below the mean, because the one 94 pulls it up. So the median describes a typical day better. The mean is still the right number for working out total time spent on the trip.
3. Match each symbol to what it describes: μ, s, p̂, N. Which are parameters and which are statistics?
μ = population mean (parameter); s = sample standard deviation (statistic); p̂ = sample proportion (statistic); N = population size (parameter). Greek letters and capital N belong to populations. They are fixed but unknown. Roman letters with hats or bars belong to samples. They change every time you draw a new one.
4. A population has the values 3, 5, 7, 9. Work out μ and σ. Then work out x̄ and s for the sample 3, 9.
μ = 6, σ ≈ 2.24; x̄ = 6, s ≈ 4.24. Population: sum = 3 + 5 + 7 + 9 = 24, so μ = 24 ÷ 4 = 6. The gaps −3, −1, 1, 3 square to 9, 1, 1, 9, which add up to 20. So σ2 = 20 ÷ 4 = 5 and σ = √5 ≈ 2.24 (divide by N). Sample {3, 9}: x̄ = 12 ÷ 2 = 6. The gaps −3 and 3 square to 9 and 9, which add up to 18. So s2 = 18 ÷ (2 − 1) = 18 and s = √18 ≈ 4.24 (divide by n − 1). The sample mean happened to hit μ exactly. The sample standard deviation is far off, which is just what small samples do.
5. An online poll on a news site draws 500,000 answers. A professional phone poll surveys 1,100 adults picked at random. Which gives the better estimate of national opinion, and why?
The random sample of 1,100. The online poll is a sample of people who picked themselves (a self-selected convenience sample). Only visitors to that site who feel strongly enough to click are counted. That is a steady tilt, sampling bias. More answers shrink sampling error but do nothing to the bias. So a huge biased sample estimates the wrong thing very exactly. Random selection is what makes the small sample stand for the whole.
6. Explain the difference between sampling error and sampling bias. Give the fix for each.
Sampling error is the natural wobble of a statistic around the parameter from sample to sample. Sampling bias is a steady tilt built into how the sample was picked. Sampling error cannot be avoided. It is not a mistake, and it shrinks as n grows. Bias is a design flaw. It does not average out, and a larger sample does not help. The fix is proper random selection and high response rates.
7. Sort each variable as qualitative, quantitative discrete or quantitative continuous: (a) number of emergency room visits last month, (b) patient ID number, (c) blood cholesterol in mg/dL, (d) shirt size (S, M, L).
(a) Quantitative discrete; (b) qualitative; (c) quantitative continuous; (d) qualitative. Visits are counted, so only whole numbers occur. An ID number is digits used as a name, so averaging it means nothing. Cholesterol is measured and can take any value in a range. Shirt size is a group. It is an ordinal one, since S < M < L.
8. Six households report 2, 1, 0, 4, 2 and 3 pets. Work out the mean. Is it a possible value for any one household, and does that matter?
Mean = 2.0 pets. Here it happens to be a possible value, but that is a coincidence. Sum = 2 + 1 + 0 + 4 + 2 + 3 = 12, and n = 6, so x̄ = 12 ÷ 6 = 2.0. Had one household reported 5 instead of 4, the sum would be 13 and the mean 13 ÷ 6 ≈ 2.17. That is not a possible count for any household. The mean of a discrete variable need not be a value any one member can have, because it sums up the group instead of describing a member.
9. Name the level of measurement for each: (a) jersey number, (b) finishing place in a race, (c) year of birth, (d) weight in kilograms. Explain your answer for (c).
(a) Nominal, (b) ordinal, (c) interval, (d) ratio. Year of birth is interval. The gap between 1990 and 2000 really is the same length as the gap between 2000 and 2010, so differences mean something. But the year 0 is a custom of history, not the start of time, so ratios do not. The year 2000 is not “twice” the year 1000.
10. A coworker says a 30°C day is “three times as hot” as a 10°C day. Show with numbers why this is wrong.
Celsius is an interval scale with no true zero, so the ratio depends fully on the unit chosen. In Fahrenheit: 10°C = (9 ÷ 5)(10) + 32 = 50°F and 30°C = (9 ÷ 5)(30) + 32 = 86°F. That gives a ratio of 86 ÷ 50 = 1.72. In kelvin, which does have a true zero: 283.15 K and 303.15 K. That gives 303.15 ÷ 283.15 = 1.07. Three different “multiples” (3, 1.72, 1.07) for the same two days prove the ratio is not a real property. The difference, 20 degrees, is the same in Celsius and kelvin. It is the only comparison you can trust.
11. A supplement is advertised as cutting the risk of a condition by 40%. In the trial, the condition occurred in 5 of 1,000 controls and 3 of 1,000 treated people. Work out the relative risk reduction, the absolute risk reduction and the number needed to treat.
RRR = 40%, ARR = 0.2 percentage points, NNT = 500. The risks are 5 ÷ 1,000 = 0.005 and 3 ÷ 1,000 = 0.003. Relative: (0.005 − 0.003) ÷ 0.005 = 0.002 ÷ 0.005 = 0.40, so the advertised 40% is honest math. Absolute: 0.005 − 0.003 = 0.002, or 0.2 percentage points. NNT = 1 ÷ 0.002 = 500. Five hundred people must take it for one to avoid the condition. Both figures describe the same trial. Quoting only the relative one makes a small effect sound large.
12. A study reports a difference between two teaching methods with p = 0.02 and a 95% confidence interval of 1 to 9 points. Two coworkers say: “There's a 98% chance the method works,” and “There's a 95% chance the true gain is between 1 and 9.” Correct both.
Both are wrong, and both make the same error. They attach a probability to the hypothesis or the parameter, instead of to the method. p = 0.02 means this. If the two methods truly did not differ, data at least this extreme would turn up about 2% of the time. It says nothing directly about the chance that the method works, and nothing at all about how large the effect is. The interval 1 to 9 comes from a method that catches the true value in about 95% of repeated uses. For this one interval, the true gain is either inside it or outside it. A fair reading: the data are hard to square with “no difference.” But gains anywhere from a trivial 1 point to a large 9 points still fit the evidence. That range is wide enough that the practical value of the method is still undecided.
Statistics Easy Read · Chapter 2

Sampling & Data Collection

Almost every number you will meet in a report, a news story or a research paper came from a sample. A few people stand in for many. That fact should make you nervous until you see why it works. And it works far better than most people expect. A well chosen sample of a thousand can describe a nation of three hundred million to within a few percentage points. The catch is the phrase well chosen. A sample earns its trust from how it was picked, never from how big it is. The worst failures in the history of statistics were huge samples gathered badly. This chapter shows where good data come from and how data go wrong. It also shows how to tell a study that can prove a cause from one that can only spot a pattern.

By the end of this chapter you can

  • Tell a population apart from a sample, and a parameter apart from a statistic.
  • Explain why a sample picked at random stands for its population. Explain why precision depends on n, not on the size of the population.
  • Work out and explain the standard error of a sample mean, σ/√n.
  • Describe and carry out simple random, stratified, cluster and systematic sampling. Say why convenience sampling is not a probability method.
  • Tell sampling error apart from bias, and sampling error apart from nonsampling error.
  • Spot undercoverage, voluntary response, nonresponse and response bias in a study that is described to you.
  • Tell an observational study from an experiment. State just what each one lets you conclude.
  • Plan a simple experiment using control, randomization, replication, blinding and a placebo.

Section 1Why sampling works

Diagram showing a large population with a smaller sample drawn from inside it
Reference. Population versus sample. The sample is the handful we actually measure. The population is everyone we want to describe. Source and license: see the figure credits

Population, sample, parameter, statistic

The population is every person or thing you want to say something about. Examples are every registered voter, every bag of chips off the line, or every patient with a certain diagnosis. The sample is the part you actually measure. A number that describes the population is a parameter. A number worked out from your sample is a statistic. Parameters are fixed and almost always unknown. Statistics are known. And they wobble, because a different sample would have given different numbers.

Keeping the two straight is the most useful habit in this book. The whole subject is one long answer to one question: how close is my statistic to the parameter I care about? The symbols help. Greek letters stand for the truth. Roman letters stand for the estimate.

QuantityParameter (population)Statistic (sample)Known?
Meanμx̄μ unknown; x̄ computed
Standard deviationσsσ unknown; s computed
Proportionpp̂p unknown; p̂ computed
SizeNnBoth usually known

A census measures the whole population, so it gives parameters directly. We sample instead of taking a census for four reasons. One is cost. One is time. One is that some people are hard to reach (inaccessibility). You cannot find every homeless person in a city. The last is destruction. Testing whether a fuse blows destroys the fuse. A census of fuses would leave none to sell.

Why a random sample looks like its population

You cannot judge by eye whether a sample stands for the population (is representative). A sample "looks representative" to a person only after that person has decided which traits matter. And the traits that matter are most often the ones nobody thought of. Random selection solves this without knowing anything about the population. Say every person has the same chance of being drawn. Then every trait shows up in the sample in about its population share, on average. That covers age, income, opinion and blood type. It covers the traits you measured and the ones you never imagined. Randomness does not promise a good sample every time. It promises that the misses are not tilted (unbiased). And, most important, it lets you work out how big the misses are.

That last point makes sampling a science and not a hope. The wobble from sample to sample has a name, sampling variability. It also has a size you can measure, the standard error. Take a sample mean drawn from a population with standard deviation σ. Then

SE(x̄) = σ ÷ √n

That formula comes with conditions. They are worth naming now, because every method later in this book carries them too. The observations must be independent. In practice, that means the people were drawn at random. It also means the sample is no more than about 10% of the population, so taking out one unit barely changes the odds for the next. Break either rule and the formula gives the wrong wobble. Sample a large slice of a small population, and the real standard error is smaller than σ/√n. Use a cluster design, where neighbors are like neighbors, and it is larger. A standard error from a convenience sample is not cautious or rough. It is meaningless, because the chances it is built from do not exist.

A worked example: how precision grows

Say trip times to work in a large city have a standard deviation of σ = 12 minutes. We want to estimate the mean trip time μ.

Read the pattern. To cut the standard error in half, you must make the sample four times as big (quadruple it). That is because n sits under a square root. Going from 36 to 144 people is four times the work. It buys you twice the precision, not four times. This law of shrinking returns (diminishing returns) rules every survey budget ever written.

It also tells you how far off a typical sample lands. That needs one more assumption: the sampling distribution of x̄ is about normal. That is exact when the population itself is normal. By the Central Limit Theorem, it is about true for a large enough n, whatever the shape of the population. Grant that. Say the true mean trip is μ = 24 minutes and n = 36. Then about 95% of samples give an x̄ within about 2 standard errors of the truth. That is between 24 − 2(2.0) = 20 minutes and 24 + 2(2.0) = 28 minutes. Notice what is random here. It is the sample, not μ. The population mean sits still. Our estimate is what moves. The "95%" describes how often the method lands close, across all the samples we might have drawn. It is never a statement of chance about μ, which has no probability distribution at all.

Now look hard at that formula. N, the size of the population, is not in it. Say the sample is a small part of the population. Then a sample of 1,000 is about as precise for a country of 300 million as for a town of 30,000. This is the true fact in a first statistics course that is hardest to believe. It is why national polls of about 1,000 people are not absurd. Think of tasting soup. You need a big enough spoonful, not a spoonful that grows with the size of the pot. But the soup must be stirred.

Size never fixes a bad method. In 1936, the Literary Digest mailed about 10 million straw ballots for president. It got back about 2.4 million. Then it predicted a landslide for Alf Landon. Roosevelt won in one of the largest landslides on record. The mailing lists came from car registrations, phone books and magazine subscribers. In the Depression, that meant wealthy people. And only about a quarter of the people mailed a ballot bothered to reply. George Gallup polled a few tens of thousands of people. He chose them on purpose to mirror the voters, and he got it right. Two and a half million badly chosen people lost to fifty thousand well chosen ones. Stirring beats scooping.
Interactive Draw real random samples from a city of millions and watch the estimates pile up around the true 62%, then discover that precision comes from sample size, not city size, and that a convenience sample converges just as tightly on the wrong answer. Open full ↑
Key points
  • A parameter (μ, σ, p) describes the population and is unknown. A statistic (x̄, s, p̂) is worked out from the sample and varies.
  • Random selection makes a sample stand for the population on every trait at once. That includes the traits you never measured.
  • SE(x̄) = σ/√n. Making n four times as big cuts the standard error in half.
  • Precision depends on n, and mostly not on the size of the population. A bigger badly chosen sample just gives a wrong answer with more confidence.

Section 2Sampling methods

Diagram of stratified sampling: a population split into strata with units drawn from each stratum
Reference. Stratified sampling. The population is split into groups, and a sample is drawn from inside every group. Source and license: see the figure credits

The sampling frame comes first

Before you can pick anybody, you need a sampling frame. That is the actual list of units you will draw from. The frame is where good plans quietly die. You may want "all adults in the county." But your frame may be "all landline numbers in the county," and those are not the same population. Every method below is only as good as the frame it runs on. So write down your frame plainly, and ask who is missing from it.

The four probability methods

A probability sample is one in which every person has a known chance of being picked that is not zero. Only probability samples support the tools for drawing conclusions (inference) in the rest of this book.

A simple random sample (SRS) of size n is chosen so that every possible group of n people is equally likely to be the sample. In practice, you number the frame 1 to N. Then a computer draws n different numbers. Read the definition with care. It asks for more than "everyone has an equal chance." Systematic sampling also gives everyone an equal chance. Yet most groups of size n can never be picked by it. So it is not an SRS.

Stratified sampling splits the frame into strata. These are groups whose members are alike, such as class year, region or age band. Then it takes a separate random sample inside every stratum. When the strata truly differ from one another, this beats an SRS of the same size. That is because you have removed the variation between groups from your estimate by force, instead of leaving it to luck. It also makes sure you will not draw zero seniors by accident.

Cluster sampling also splits the frame into groups, but the logic runs the other way. Clusters are bundles that occur naturally, such as city blocks, clinics or classrooms. Ideally, each one is like the whole population in miniature. You pick whole clusters at random. Then you measure everyone inside the chosen ones. This is a way to save money. Visiting 30 blocks and talking to every household costs far less than chasing 600 addresses spread across a city. The price is precision. Neighbors are like neighbors. So 600 people from 30 blocks carry less independent information than 600 people drawn at random.

Systematic sampling takes every kth unit after a random start, with k = N/n. It is fast and needs no numbered list. You can do it at a factory exit or a store door. Its one real danger is periodicity, a list that repeats in a cycle. If the cycle matches k, the sample locks onto one part of the cycle. For example, say you sample every 7th day of hospital admissions. Then every observation falls on the same day of the week.

A worked example: proportional allocation and a systematic plan

A student body of N = 12,000 has 4,200 first year students, 3,300 sophomores, 2,700 juniors and 1,800 seniors (4,200 + 3,300 + 2,700 + 1,800 = 12,000 ✓). We want n = 400 students, shared out in proportion (proportional allocation). So each stratum gives nh = n × (Nh / N). Since 400/12,000 = 1/30, we just divide each stratum by 30:

Check the total: 140 + 110 + 90 + 60 = 400 ✓. Each student's chance of being picked is 140/4,200 = 1/30 for a first year student and 60/1,800 = 1/30 for a senior. They are the same, and that is just the point of proportional allocation.

Now pick the same 400 by systematic sampling. Here k = 12,000 ÷ 400 = 30. Draw a random start between 1 and 30, say 17. Then take students 17, 47, 77, 107 and so on, each one 30 further down the list. The jth pick is 17 + 30(j − 1). So the 400th is 17 + 30(399) = 17 + 11,970 = 11,987, safely inside the list ✓. It is fast, tidy and perfectly fine here, unless the student list happens to repeat every 30 names.

MethodHow it worksBest whenMain risk
Simple randomEvery group of size n equally likelyYou have a clean, complete frameCostly to reach a scattered sample
StratifiedSplit into similar groups, sample within every groupGroups differ from each otherNeeds stratum sizes known in advance
ClusterSplit into mini-populations, sample whole groupsTravel or contact cost dominatesLess precise per person; clusters must be internally diverse
SystematicRandom start, then every k-th unit, k = N/nUnits arrive in a stream; no list existsHidden periodicity in the ordering
ConvenienceWhoever is easy to reachNever, for inferenceBias of unknown size and unknown direction

Convenience sampling means surveying the people already in front of you. Its cousin is voluntary response sampling, in which people pick themselves by calling in or clicking a link. Neither one is a probability method at all. Nobody's chance of being picked is known. So no standard error can be worked out, and no margin of error means anything. These samples are useful for coming up with ideas to test (hypotheses) and for trying out a survey form first. They are useful for nothing else. Real surveys often chain methods together into a multistage design. They might cluster on counties, then on blocks, then take an SRS of households, and then pick one adult at random inside each household.

Stratified versus cluster, settled in one line. Stratified takes some from every group. Cluster takes everyone from some groups. And the ideal makeup inside each group is the opposite. Strata should be alike inside and different from each other. Clusters should each be mixed inside, like little copies of the whole population.
Interactive Draw simple random, stratified, cluster, systematic and convenience samples from the same town of 300 households, and watch the exact standard errors, design effects and bias shift with every choice you make. Open full ↑
Key points
  • Define the sampling frame first. Anyone missing from the frame cannot be seen by your study.
  • An SRS makes every group of size n equally likely. That asks for more than equal chances for each person.
  • Stratified samples from every group and is most often more precise. Cluster samples whole groups and is most often cheaper but less precise.
  • Systematic uses k = N/n after a random start. Watch for periodicity.
  • Convenience and voluntary response samples support no valid inference at any size.

Section 3Bias and error

Illustration contrasting statistical bias with random statistical noise using target patterns
Reference. Bias versus noise. Scatter around the target is random error. A group of shots centered away from the bullseye is bias. Source and license: see the figure credits

Two completely different ways to be wrong

Every estimate misses the truth. But there are two unrelated reasons why. Mixing them up is the most costly mistake in applied statistics. Sampling error is the ordinary gap between a sample statistic and the population parameter. It cannot be avoided. It happens just because you measured some people instead of all of them. It is random and centered on zero. And it shrinks in a way you can predict as n grows. That is the σ/√n from Section 1.

Bias is steady (systematic). It is a tendency for your method to miss in the same direction, sample after sample. Bias does not shrink as n grows. Gather ten times as much data with the same flawed method, and you get the same wrong answer. It just comes with a tighter, more convincing error bar. Think of target shooting. Random error is a wide group of shots. Bias is a tight group of shots centered off the bullseye. More bullets tighten the group. Only fixing the sights moves it.

The named biases, and where they come from

Undercoverage happens when part of the population cannot appear in the frame at all. Examples are a landline only poll in a cell phone world, or a mall survey that misses everyone who does not shop at malls. Voluntary response bias arises because people who take the trouble to reply hold stronger opinions than those who do not. Those opinions are most often negative. Nonresponse bias strikes after the sample is picked. Your sample was chosen properly, but a large share did not answer. And the ones who answered differ from the ones who did not. Response bias is about the measuring itself. Causes include how a question is worded ("Do you support wasteful spending on X?") and wanting to look good (social desirability). People report drinking less than they do, and voting and flossing more than they do. Other causes are the effect of the interviewer and faulty memory (recall).

ProblemWhat goes wrongDirectionDoes a bigger n help?
Sampling errorLuck of the drawRandom, averages to zeroYes: shrinks in proportion to 1/√n
UndercoverageFrame excludes part of the populationSystematicNo
Voluntary responsePeople select themselves inSystematic (strong opinions over-represented)No
NonresponseSelected people do not answerSystematicNo
Response biasAnswers are inaccurate as givenSystematicNo
Processing / measurementBad instrument, data-entry or coding errorsEitherNo

The last five rows are nonsampling error. That is every source of error that has nothing to do with which people you picked. Nonsampling error is why a census can still be wrong. The U.S. census reaches for everybody, and it still misses people and records some answers wrong. In most real surveys, nonsampling error is larger than sampling error. And it is the part nobody reports.

A worked example: bias dwarfs the margin of error

A researcher picks 1,000 adults at random. She asks whether they exercise at least three times a week. Only 400 reply, and 260 of those say yes:

p̂ = 260 ÷ 400 = 0.65, or 65%

The reported 95% margin of error for a proportion is about 1.96 × √(p̂(1 − p̂) / n). Before using it, check what it assumes. It needs a random sample of independent people. It also needs enough of both outcomes for the normal approximation to be trusted. The usual rule of thumb is at least 10 successes and 10 failures. Here we have 260 yes and 140 no ✓, so the math is fair. Still, watch what happens next. Step by step:

Now say a strong follow up reaches the 600 people who did not reply (nonrespondents). It finds that only 25% of them exercise three times a week. That is 0.25 × 600 = 150 people. The truth across all 1,000 adults picked is

(260 + 150) ÷ 1,000 = 410 ÷ 1,000 = 0.41, or 41%

The estimate was off by 0.65 − 0.41 = 0.24, which is twenty four percentage points. Yet the stated uncertainty was under five. The bias is five times the whole margin of error. And here is the sting. Repeat the study with 10,000 adults picked, at the same 40% response rate. The estimate stays near 65%, while the margin of error falls to about ±1.5 points. You will have bought a far more precise copy of the same wrong number.

A margin of error is a budget for chance error, nothing more. It counts only the randomness of who got drawn. It assumes the frame was complete, everyone answered and everyone answered honestly. It says nothing at all about whether those things were true. Read "±3 points" as "±3 points if the method was clean." Read it correctly, too. The 95% belongs to the method across many possible samples. It is not a 95% chance that this one interval has caught the truth.
Interactive Switch nonresponse and voluntary-response bias on and off in a live survey simulation, and watch the estimate walk away from a truth that never moves: discovering that the bias is set by the ratio of response rates, that more data never repairs it, and that a margin of error cannot see it. Open full ↑
Key points
  • Sampling error is random and shrinks in step with 1/√n. Bias is steady (systematic) and does not shrink at all.
  • Nonsampling error can strike even a full census. It covers coverage, nonresponse, response and processing errors. It is most often larger than sampling error.
  • Nonresponse bias depends on who is missing. So a low response rate is a warning sign that no sample size can cure.
  • A margin of error measures chance variation only, never bias.

Section 4Observational studies versus experiments

Diagram of a confounding variable linked to both the explanatory and response variables
Reference. Confounding: a hidden third variable linked to both the explanatory variable and the response variable. Source and license: see the figure credits

One question separates them

The dividing line is very simple: who decided who got what? In an observational study, the researcher measures people as they already are. She records an exposure that the people (or life) chose for them. In an experiment, the researcher assigns the explanatory variable. She uses a chance method to decide which subjects get which treatment. Then she compares the outcomes.

Observational studies come in a few familiar shapes. A cross-sectional study takes a snapshot at one point in time. A prospective cohort study finds people now and follows them forward, waiting for outcomes to appear. A retrospective case-control study starts with people who already have the outcome. It matches them to people who do not. Then it looks back in time for differences in exposure. All three watch. None of them assigns.

Why observation cannot prove cause

A confounding variable (also called a lurking variable) is a third factor. It is linked to the explanatory variable and related to the response. So its effect cannot be pulled apart from the effect you care about. People sort themselves into the exposed and unexposed groups, and they do so for all sorts of hidden reasons. So groups you only watch differ in a thousand ways besides the exposure.

Watch how badly this can go, with exact numbers. Take 1,000 coffee drinkers, of whom 600 smoke. Take 1,000 people who do not drink coffee, of whom 200 smoke. Let lung cancer strike 10% of smokers and 1% of nonsmokers. And let coffee itself do nothing at all.

Coffee drinkers get lung cancer at 6.4% versus 2.8%. That is a rate ratio of 6.4 ÷ 2.8 ≈ 2.3. So a headline could truthfully say that coffee drinkers are more than twice as likely to get lung cancer. Every number above is real and worked out correctly. Yet the story about cause is pure fiction, made up by smoking. That is confounding. No amount of extra data removes it, because more data means more of the same tangle.

So when you see a link between X and Y, five explanations compete. X may cause Y. Y may cause X (reverse causation). Do sneakers cause fitness, or do fit people buy sneakers? A confounder may cause both. The link may be a fluke of sampling. Or the study may have been biased. Watching alone cannot decide among them.

What each design licenses you to say

Two kinds of randomization do two different jobs, and people mix them up all the time. Random sampling is how subjects got into the study. It lets you generalize to the population. Random assignment is how subjects got sorted once inside. It lets you draw conclusions about cause. They are separate choices, so there are four cases.

Random assignmentNo random assignment
Random sampleCausal conclusion, generalizable to the population (the gold standard, and rare)Association only, generalizable to the population (a good survey or cohort study)
No random sampleCausal conclusion, but only for subjects like these (most clinical trials)Association only, and only for subjects like these (a convenience study)

Observational studies are not second class. They are often the only ethical or workable choice. You cannot assign people at random to smoke for thirty years. Without an experiment, what tips the balance toward cause is a pattern that builds up. That pattern includes a large effect and a dose-response gradient, where more exposure brings more effect. It includes the same result across many populations and designs, the right order in time, and a believable way it could work (a plausible mechanism). That is just how the case against tobacco was built.

The rule for reading observational studies. Sometimes an observational finding is reported with a verb about cause, such as cuts, boosts, prevents or triggers. In your head, rewrite it with "is linked with" (is associated with). Then ask who chose the exposure and what else those people have in common. If the researchers did not assign the exposure, the cause verb was added by the headline writer. The data did not earn it.
Interactive Plant a known effect in a walking program, then run the study two ways, let people choose or let a coin choose, and watch a lurking variable manufacture a benefit that only randomization erases. Open full ↑
Key points
  • Observational study: the exposure is watched. Experiment: the researcher assigns the exposure.
  • A confounder is linked to both the explanatory and the response variables. It makes a link impossible to read.
  • Random sampling → you can generalize; random assignment → you can claim cause. They are separate promises.
  • Observational studies show association. Only a randomized experiment shows causation directly.

Section 5Designing an experiment

Line graph of mean words recalled plotted against assigned drug dose
Reference. A dose-response result from a designed experiment. Mean recall is plotted against the dose each group was assigned. Source and license: see the figure credits

The vocabulary, then the four principles

The people or things in an experiment are experimental units. They are called subjects when they are people. A factor is an explanatory variable you control. Its settings are levels. A treatment is one mix of levels. The response is what you measure. Think of a study of two drug doses given at two times of day. It has two factors, each at two levels. So it has 2 × 2 = 4 treatments.

A good experiment rests on four ideas. Control means keeping other conditions the same across groups. Above all, it means having a control group. This is a comparison arm that gets no treatment, a placebo or the current standard of care. Without a comparison group, you cannot separate the treatment's effect from other things. Time passes. Illness clears up on its own. Patients drift back toward their usual state (regression). Randomization assigns units to treatments by chance. Replication means having enough units per treatment that ordinary variation averages out. It does not mean just repeating one measurement. Blocking groups similar units together and then randomizes within each block. It is the experiment's cousin of stratified sampling.

Randomization needs its own paragraph, because it is the whole reason experiments can prove things. It is not there to be fair. It is there to make the treatment groups the same, on average, in every way. That means age, how severe the illness is, genes, diet, outlook, and the hundred variables nobody thought to record. Then, when the outcomes differ, the only steady difference left is the treatment. Matching on known variables cannot do this, because you can only match on what you thought of.

Placebo and blinding

A placebo is a fake copy of the treatment that does nothing (it is inert). Examples are a sugar pill, a salt water (saline) shot or a sham procedure. It exists because the placebo effect is real and often large. People get better because they believe they are being treated. Say the control group gets nothing at all. Then the treatment group's gain mixes the drug's effect with the belief's effect, and you cannot pull them apart. A placebo control makes the belief equal in both arms. So the difference shows the drug alone.

Blinding keeps people from knowing who got what. In a single-blind study, the subjects do not know. In a double-blind study, neither the subjects nor the people who deal with them and judge the outcome know. Double blinding matters because hopes leak in. A keen assessor who knows a patient got the new drug may rate that patient's "moderate" gain as "marked." Whoever measures the response should always be blind.

PrincipleWhat it doesWhat breaks without it
Control groupProvides the comparison baselineImprovement from time, healing, or regression is credited to the treatment
RandomizationBalances known and unknown variables across armsGroups differ systematically; confounding returns
ReplicationGives enough units for variation to average outOrdinary noise is mistaken for a real effect
BlockingRemoves a known nuisance variable's influenceA big known source of variation hides the effect
PlaceboEqualizes the psychological effect of being treatedBelief effects are counted as drug effects
Double-blindingRemoves expectation from subjects and assessorsReporting and rating drift toward what people expect

A worked example: building the design

We want to compare a new headache drug with the standard drug and with a placebo. We have 180 volunteers.

Completely randomized design. Number the volunteers 1 to 180. Use a computer to shuffle them into three arms of 180 ÷ 3 = 60 each. Every subject gets a capsule that looks the same. So nobody can tell the arms apart, not the subject, the nurse or the assessor. That makes it double blind. Measure the minutes until real relief. Say the group means come back as placebo 42 minutes, standard drug 30 and new drug 26. The standard drug is 42 − 30 = 12 minutes faster than the placebo. The new drug is 30 − 26 = 4 minutes faster than the standard. Assignment was random. So no difference that existed before the study can explain those gaps in a steady way. The question left is whether a gap this size could come from chance alone. The inference tools later in this book are built to answer that.

Now block it. Say how bad the headache is at the start (baseline severity) strongly affects recovery time. First split the 180 into blocks, say 108 with moderate headaches and 72 with severe ones. Then randomize within each block. That gives 108 ÷ 3 = 36 moderate per arm and 72 ÷ 3 = 24 severe per arm. And 36 + 24 = 60 per arm as before, 180 in total ✓. Every arm now has the same mix of severity by design, not by luck. So severity can no longer muddy the comparison. And the leftover variation that the treatment effect must stand out from is smaller.

Two design warnings are worth carrying forward. Keep hidden differences out of the procedure. Say the new drug is given in a quiet private room and the placebo in a crowded hallway. Then the room is confounded with the drug. And beware of people leaving the study (attrition). Subjects who drop out are most often the ones doing worst. So leaving them out of the analysis quietly brings back the very selection bias that randomization was meant to destroy.

Randomization is not about fairness. It is about the unknown. Any careful researcher can balance the groups on age and sex. Only chance can balance them on the variables nobody has heard of yet. That is just why a randomized experiment supports a claim about cause, and a matched observational study does not. The experiment controls for the confounders you have not imagined.
Interactive Assemble a clinical trial one safeguard at a time, control group, randomization, blinding, and watch each one delete a specific, named slab of bias from what the study reports, across 240 genuinely simulated studies. Open full ↑
Key points
  • The four pillars are control, randomization, replication and, when useful, blocking.
  • A placebo makes the mental effect of treatment equal. Double blinding takes hopes out of the picture for both subjects and assessors.
  • Random assignment balances unmeasured variables. That is what allows a conclusion about cause.
  • Blocking removes a known nuisance variable. It is stratification used for assignment instead of selection.

The chapter in one breath

  • A parameter describes the population and is unknown. A statistic comes from the sample and varies from sample to sample.
  • Random selection, not sample size, is what makes a sample stand for the population. It balances every variable, including the ones you never measured.
  • SE = σ/√n. Make the sample four times as big to cut the error in half. The size of the population barely matters.
  • The probability methods are simple random, stratified (some from every group), cluster (everyone from some groups) and systematic (every kth after a random start). Convenience and voluntary response samples support no inference.
  • Sampling error is random and shrinks as n grows. Bias is steady and never shrinks. A bigger bad sample only gives a wrong answer with more confidence.
  • Nonsampling error covers coverage, nonresponse, response and processing errors. It strikes even a census, and a margin of error counts none of it.
  • Observational studies show association and are haunted by confounding. Only experiments, which assign the treatment, show causation.
  • Good experiments use a control group, random assignment, enough replication, a placebo where it fits, and double blinding.

ReferenceWords worth knowing

A quick reference for the terms in this chapter. Skim it now, or come back whenever a word trips you up.

Bias
A steady tendency for a method to miss the truth in the same direction. Unlike random error, it does not shrink as the sample grows.
Blinding
Keeping the treatment a secret from the people in the study (single-blind), or from them and the researchers who judge them (double-blind).
Blocking
Grouping similar experimental units together and randomizing treatments within each group. Then a known nuisance variable cannot bend the comparison.
Census
An attempt to measure every member of a population instead of a sample. It can still suffer from nonsampling error.
Cluster sample
A sample made by picking whole groups that occur naturally, at random, and measuring everyone inside them.
Confounding variable
A third variable linked to the explanatory variable and related to the response, so that their effects cannot be pulled apart.
Control group
The comparison arm of an experiment. It gets no treatment, a placebo or the current standard of care.
Convenience sample
A sample of whoever is easiest to reach. The chances of being picked are unknown, so no valid inference is possible.
Experiment
A study in which the researcher assigns the explanatory variable to units, ideally at random, and then compares the responses.
Margin of error
Half the width of an interval estimate. It measures chance variation from sampling only, never bias or nonsampling error.
Nonresponse bias
A skew that arises when people who were picked do not take part, and they differ in a steady way from those who do.
Nonsampling error
Any error that has nothing to do with which people were chosen. It includes coverage gaps, nonresponse, wrong answers, and mistakes in measuring and processing.
Observational study
A study that records an exposure the subjects already have, instead of assigning it. It shows association, not causation.
Parameter
A fixed number that sums up a population, such as μ, σ or p. It is almost always unknown.
Placebo
A fake copy of a treatment that does nothing (inert). It is used so that the control group believes it is treated as much as the treatment group does.
Population
Every person or thing you want to draw a conclusion about.
Random assignment
Using chance to place subjects in treatments. It balances known and unknown variables, and it is what allows conclusions about cause.
Replication
Giving each treatment enough units that ordinary variation averages out. It is not the same as repeating one measurement.
Response bias
Skew in the answers themselves. It can come from how a question is worded, wanting to look good (social desirability), the effect of the interviewer, or faulty memory.
Sample
The part of the population that is actually measured.
Sampling error
The random gap between a sample statistic and the population parameter. It comes from measuring only part of the population.
Sampling frame
The actual list of units a sample is drawn from. Anyone not on it cannot be picked.
Simple random sample (SRS)
A sample chosen so that every possible group of n people is equally likely to be picked.
Standard error
The typical wobble of a statistic from sample to sample. For a sample mean, it is σ/√n, assuming the observations are independent.
Statistic
A number worked out from a sample, such as x̄, s or p̂. It varies from sample to sample.
Stratified sample
A sample made by splitting the population into groups of similar members (strata) and drawing a random sample from inside every stratum.
Systematic sample
A sample taken by choosing every kth unit after a random start, with k = N/n. It can go wrong if the list repeats in a cycle (periodicity).
Undercoverage
A coverage gap in which part of the population cannot appear in the sampling frame at all. So it can never be picked.
Voluntary response bias
A skew that arises when people pick themselves for a sample. People with strong opinions end up with too large a share.

Check yourself

1. A college reports that the mean GPA of its 12,000 students is 3.11. A researcher surveys 250 of them and finds a mean GPA of 3.04. Name the population, the sample, the parameter and the statistic.
Population = all 12,000 students; sample = the 250 surveyed; parameter = μ = 3.11; statistic = x̄ = 3.04. The parameter is fixed. The statistic would change if a different 250 students had been drawn.
2. Household incomes in a region have σ = $24,000. Work out the standard error of the sample mean for n = 100 and for n = 900. Say what the comparison shows.
SE = 24,000/√100 = 24,000/10 = $2,400; SE = 24,000/√900 = 24,000/30 = $800. Nine times the data gave three times the precision. That is because n sits under a square root. It is the classic shrinking return.
3. A student objects that a poll of 1,000 people cannot describe a country of 300 million. The reason given is that it is "only about 0.0003% of the population." What is wrong with the objection?
Precision depends on n, not on the share of the population sampled. The size of the population is not in σ/√n. Say the sample is a small part of the population. Then 1,000 people picked at random give about the same precision for a nation as for a town. What matters is that the picking was random, not that it was in proportion.
4. A hospital has 900 nurses, 300 physicians and 300 technicians. It wants a stratified sample of 150 with proportional allocation. Work out the numbers.
Total N = 1,500, and 150/1,500 = 1/10. So take 90 nurses, 30 physicians and 30 technicians. Check: 90 + 30 + 30 = 150 ✓. And each person's chance is 1/10 in every stratum.
5. Name each design. (a) A researcher picks 20 of a district's 400 classrooms at random and surveys every student in them. (b) A researcher picks a random start between 1 and 8. Then she takes every 8th patient off an appointment list.
(a) Cluster sampling: whole groups are picked, and everyone inside is measured. (b) Systematic sampling with k = 8. Neither is a simple random sample. In (a), students in classrooms not chosen have no chance of appearing. In (b), only 8 of the huge number of possible groups of that size can ever occur.
6. Explain the difference between stratified and cluster sampling. Include how each type of group should ideally be made up.
Stratified takes some units from every group. Cluster takes all units from some groups. Strata should be alike inside and different from each other, which is what buys precision. Clusters should each be mixed inside, like little copies of the whole population.
7. A morning show invites viewers to text in their opinion. It gets 84,000 replies, and 71% of them oppose a new policy. Name the flaw. Explain why the large number of replies does not rescue it.
Voluntary response bias. People picked themselves, and those with strong (most often negative) feelings are far more likely to act. Bias is steady, so it does not shrink as n grows. The 84,000 texts from people who chose to reply estimate the opinions of people who text in. They do not estimate the opinions of the population, no matter how large the count grows.
8. A sample of 500 people is drawn properly. It gets 300 replies (respondents), and 195 of them report owning a pet. That gives p̂ = 0.65. A follow up finds that only 30% of the 200 nonrespondents own pets. Work out the true proportion among all 500 and the size of the bias.
Nonrespondent owners = 0.30 × 200 = 60; total = (195 + 60)/500 = 255/500 = 0.51. The bias is 0.65 − 0.51 = 0.14, or 14 percentage points. The reported margin of error for n = 300 would be 1.96 × √(0.65 × 0.35 / 300) ≈ 0.054, about ±5.4 points. That is far smaller than the bias it fails to catch. No amount of extra sampling would close that gap.
9. Tell sampling error apart from nonsampling error. Give one nonsampling error that would still occur in a complete census.
Sampling error is the random gap caused by measuring only part of the population. Nonsampling error is every other source of error. Even a census suffers from people it cannot reach, people who answer wrongly, and mistakes in entering or coding data. None of these has anything to do with which people were picked.
10. Researchers find that adults who eat breakfast weigh less than those who skip it. A headline says that "breakfast cuts weight." What kind of study is this, and what is the flaw?
It is an observational study, so it can only report an association. The researchers did not assign anyone to eat breakfast. Breakfast eaters may well differ in exercise, sleep, income and smoking. Any of these could confound the comparison. Reverse causation is also possible, since people trying to lose weight skip meals. Only random assignment would earn the verb "cuts."
11. A trial assigns 240 patients at random to a new inhaler or a placebo inhaler. Neither the patients nor the clinicians who judge them know which is which. State the purpose of the placebo, the purpose of the blinding, and how many patients are in each arm.
240 ÷ 2 = 120 per arm. The placebo makes the mental effect of being treated equal, so the difference shows the drug, not the belief. Double blinding keeps the hopes of both subjects and assessors from tilting the reported outcomes. Blinding the assessor matters most, since the assessor is the one who scores the response.
12. Why is random assignment said to control for variables the researchers never measured? What would matching on age and sex fail to do?
Placing people by chance makes the arms the same on average for every trait at once, measured or not. So the treatment is the only steady difference left. Matching balances only the variables you thought of. Any variable no one noticed could stay unbalanced and confound the result. Examples are genes, diet, how severe the illness is and motivation. That is just why observational studies cannot close the gap to cause.
Statistics Easy Read · Chapter 3

Displaying Data

A column of two hundred numbers tells you almost nothing. The same two hundred numbers drawn as a picture tell you almost everything in about four seconds. That is the whole promise of this chapter; you will learn to sort raw data into a frequency table. You will learn to choose the right picture for the kind of variable you have. Bars and pies are for groups (categories). Histograms and dot plots are for measurements, and you will learn to read the shape that the picture shows. You will also learn the other half of the skill, the half that protects you. A perfectly honest set of numbers can be drawn in a way that lies, and you will learn to spot it. No formula in this chapter is harder than dividing one number by another. So if math makes you nervous, this is a friendly place to start.

By the end of this chapter you can

  • Build a frequency, relative frequency and cumulative frequency table from raw data; check that each column adds up correctly.
  • Build a grouped frequency distribution. Choose how many classes to use, work out the class width and find the class midpoints.
  • Answer “how many” and “what share” questions straight from a cumulative column.
  • Show qualitative data with a bar chart, a Pareto chart or a pie chart. Work out the angle of each slice.
  • Show quantitative data with a histogram, a stem-and-leaf plot or a dot plot. Say when each is the better choice.
  • Explain just why histogram bars touch and bar chart bars do not.
  • Sort a distribution as symmetric, skewed left, skewed right or uniform. Describe how many peaks it has (its modality).
  • Spot a truncated axis or a distorted scale. Measure how much it overstates the change.

Section 1Frequency distributions

A cumulative frequency curve rising from zero to the total number of observations
Reference. A cumulative frequency graph; the running total climbs from zero on the left to the full sample size on the right. Source and license: see the figure credits

From a pile of numbers to a table

Raw data come as a list; a frequency distribution is just a table. For each possible value, or each range of values, it says how many times that value came up. That count is the frequency, written f. All the frequencies add up to the sample size, n. So the first thing you do after building a frequency table is add up the column; check that it equals n. If it does not, you miscounted, and every number after that is wrong.

Two more columns turn a bare count into something you can reason with. The relative frequency is the share of the data in that row:

relative frequency = f ÷ n

Relative frequencies always add up to 1, or to 100% if you write them as percentages. A tiny rounding wobble is fine; they matter because they let you compare groups of different sizes. Take 12 out of 40 and 30 out of 100; they tell the same story (0.300 either way), but the raw counts 12 and 30 are not easy to compare at all.

The cumulative frequency is a running total; it is the number of observations at or below that row. It answers “how many were at most this much?” with no more math. Its last entry must equal n; that gives you a second free check for errors.

A worked example, start to finish

A survey asked n = 40 adults, “On how many of the past seven days did you exercise?” The answers are whole numbers from 0 to 7, so each value gets its own row. Here is the full table, with every column worked out.

Days (x)Frequency fRelative f ÷ nPercentCumulative fCumulative relative
066÷40 = 0.15015.0%60.150
188÷40 = 0.20020.0%140.350
21010÷40 = 0.25025.0%240.600
377÷40 = 0.17517.5%310.775
455÷40 = 0.12512.5%360.900
522÷40 = 0.0505.0%380.950
611÷40 = 0.0252.5%390.975
711÷40 = 0.0252.5%401.000
Total401.000100.0%--

Check the two totals. 6 + 8 + 10 + 7 + 5 + 2 + 1 + 1 = 40 ✓. And 0.150 + 0.200 + 0.250 + 0.175 + 0.125 + 0.050 + 0.025 + 0.025 = 1.000 ✓. Now read answers straight off the table. What share exercised at most 3 days? Look at the cumulative relative entry in the “3” row: 0.775, or 77.5%. What share exercised more than 3 days? Take the rest (the complement): 1 − 0.775 = 0.225; check it the long way. 5 + 2 + 1 + 1 = 9 people, and 9 ÷ 40 = 0.225 ✓. The two routes agree; that is just what a well built table should promise.

Grouped distributions: when values do not repeat

The table above worked because there were only eight different values. Measurements such as trip times, weights or incomes rarely repeat. So a table with one row per value would be as long as the data set, and just as useless. The fix is a grouped frequency distribution. Sort the values into a handful of classes that do not overlap, then count how many fall into each. Five to ten classes is most often about right. With too few, you flatten the pattern into a plain block. With too many, you break it into noise.

To find the class width, take the range and divide by the number of classes you want. Then always round up to a handy number:

class width ≈ (maximum − minimum) ÷ (number of classes), rounded up

Rounding up is a must. If you round down, the classes together cover less than the data do, then the largest value has nowhere to go.

Worked example. Here are thirty trip times to work, in minutes, sorted: 5, 7, 8, 11, 12, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 28, 29, 31, 33, 35, 38, 40, 42, 47, 52, 58. The minimum is 5 and the maximum is 58, so the range is 58 − 5 = 53. Aim for 6 classes: 53 ÷ 6 = 8.83, which rounds up to a width of 9. Start at the minimum, 5. The classes are 5 to 13, 14 to 22, 23 to 31, 32 to 40, 41 to 49 and 50 to 58. The midpoint (or class mark) of a class is the average of its two limits.

Class (min)MidpointFrequency fRelative fCumulative f
5 to 13(5+13)÷2 = 966÷30 = 0.2006
14 to 22(14+22)÷2 = 1899÷30 = 0.30015
23 to 31(23+31)÷2 = 2777÷30 ≈ 0.23322
32 to 40(32+40)÷2 = 3644÷30 ≈ 0.13326
41 to 49(41+49)÷2 = 4522÷30 ≈ 0.06728
50 to 58(50+58)÷2 = 5422÷30 ≈ 0.06730
Total-301.000-

The cumulative column ends at 30 = n ✓. Read it. 22 of the 30 workers travel 31 minutes or less; that is 22 ÷ 30 ≈ 0.733, or about 73%. Plot cumulative frequency against the upper class limit and join the points; that gives a rising curve called an ogive; it is the figure at the top of this section.

Classes must not overlap, and they must not leave gaps. Writing classes as 5 to 13, 13 to 22 and 22 to 31 is a common trap. A value of exactly 13 belongs to two classes at once. Then your frequencies stop being a valid count, and the column will not add up to n. Every observation must land in just one class, no more and no less.

Interactive Turn raw data into a real frequency table one column at a time, frequency, relative frequency, and both cumulative columns, with a dot plot, histogram, and ogive that recompute live as you change the class width, the sample size, or draw a fresh sample. Open full ↑
Key points
  • Frequency is a count; the frequency column must add up to n.
  • Relative frequency = f ÷ n; the column adds up to 1 (100%) and lets you compare groups of different sizes.
  • Cumulative frequency is a running total; it answers “how many at most?” and must end at n.
  • For measurements, use a grouped table; use 5 to 10 classes. Width = range ÷ classes, rounded up. Classes must not overlap or leave gaps.

Section 2Displaying qualitative data

Bar graphs comparing the frequency of several categories
Reference. Bar graphs: separate bars whose heights show the count or percentage in each group. Source and license: see the figure credits

Bar charts: the workhorse

Qualitative (categorical) data record which group something belongs to. Examples are blood type, major, way of getting to work and favorite brand; there is no math to do on the groups themselves; the only number in the room is how many landed in each; a bar chart shows just that. It has one bar per group, and the bar's height is in proportion to the frequency or relative frequency.

Three rules make a bar chart honest. First, the bars are separated by gaps; that is because the horizontal axis is a list of names, not a measuring scale. There is no space “between” Bus and Bicycle to fill in. Second, all bars are the same width, so height is the only thing carrying information. Third, the frequency axis starts at zero. In Section 5, we will see just how much damage is done when it does not.

Groups have no natural order, so you are free to sort them. Sort the bars from tallest to shortest, and you get a Pareto chart; it makes the biggest groups jump out. It is the default choice whenever the question is “what are the biggest contributors?”

Pie charts: parts of one whole

A pie chart shows the same information as shares of one circle; each group gets a wedge. Its angle at the center is its relative frequency times the full 360 degrees:

slice angle = (f ÷ n) × 360°

Worked example. Two hundred workers (n = 200) named their main way of getting to work. Every column below is worked out from the count.

ModeFrequency fRelative fPercentPie angle
Car8484÷200 = 0.4242%0.42 × 360° = 151.2°
Bus4646÷200 = 0.2323%0.23 × 360° = 82.8°
Bicycle3030÷200 = 0.1515%0.15 × 360° = 54.0°
Walk2828÷200 = 0.1414%0.14 × 360° = 50.4°
Other1212÷200 = 0.066%0.06 × 360° = 21.6°
Total2001.00100%360.0°

Every check passes; the counts add up to 200 = n. The relative frequencies add up to 1.00. And the angles add up to 151.2 + 82.8 + 54.0 + 50.4 + 21.6 = 360.0° ✓. Notice that the rows of this table are already in order from largest to smallest. So charting them as listed gives you a Pareto chart for free.

When a pie chart is the wrong tool

A pie chart has one strict rule that people break all the time; the groups must be mutually exclusive and exhaustive. Every observation must be in exactly one slice, and all the slices together must make one complete whole. Data from a “check all that apply” question fail this right away. Say 200 people can each name two hobbies. Then the counts add up to more than 200, and the percentages add up to more than 100%. A pie chart of them is not just ugly; it is a false statement about the data; use a bar chart instead.

Even when a pie is allowed, it is often the weaker display. Human eyes compare lengths far more exactly than angles or wedge areas. So a 14% slice and a 15% slice look about the same, while the matching bars do not. Pies also fall apart with more than about five or six groups, and comparing two pies side by side is close to hopeless; here is a good habit. Reach for a pie only when you have a few groups and your point really is “this piece is about half of everything.” Otherwise, reach for bars.

Never add a third dimension to a pie. A tilted “3D” pie chart shows slices near the front with more area than slices of the same size at the back. The angle of view, not the data, decides which group looks biggest. That means the chart misreports, even though every number behind it is correct.

Interactive The same live-sampled categorical data drawn both ways at once: sliders resample the data and morph the category shares while an eyeball test hides the bar chart and asks you to rank two close categories from the pie alone, revealing the gap in both percentage points and degrees of arc, and a multiple-response dataset shows when a pie chart is simply the wrong tool. Open full ↑
Key points
  • Bar charts use bars of equal width separated by gaps; that is because the horizontal axis lists groups, not measurements.
  • A Pareto chart is a bar chart sorted from tallest to shortest; it is best for “which groups are biggest?”
  • Pie slice angle = (f ÷ n) × 360°, and the angles must add up to 360°.
  • Pies need mutually exclusive, exhaustive groups. They fail on data where people give more than one answer, and on more than about six groups.

Section 3Displaying quantitative data

A stem-and-leaf plot beside the histogram of the same data set
Reference. A stem-and-leaf plot and the histogram of the same data; they have the same shape, but the stemplot keeps every original value. Source and license: see the figure credits

Histograms

A histogram is the picture of a grouped frequency distribution; the horizontal axis is the measured variable on a real number scale; each class becomes a bar. The bar's height is the frequency (or relative frequency) in that class; the horizontal axis is continuous, so the bars touch; that one detail is the whole difference between a histogram and a bar chart, and it shows a real difference in the data. In a bar chart, the gap says “these are separate groups.” In a histogram, the shared edge says “this class ends just where the next one begins.”

Worked example. Here are twenty five resting pulse rates, in beats per minute: 58, 61, 62, 64, 65, 67, 68, 68, 70, 71, 72, 72, 73, 74, 75, 76, 77, 78, 80, 81, 83, 85, 88, 91, 96. Use classes of width 10:

Class (bpm)BoundariesFrequency fRelative f
50 to 5949.5 to 59.511÷25 = 0.04
60 to 6959.5 to 69.577÷25 = 0.28
70 to 7969.5 to 79.51010÷25 = 0.40
80 to 8979.5 to 89.555÷25 = 0.20
90 to 9989.5 to 99.522÷25 = 0.08
Total-251.00

Both checks pass: 1 + 7 + 10 + 5 + 2 = 25 = n ✓, and 0.04 + 0.28 + 0.40 + 0.20 + 0.08 = 1.00 ✓. The class boundaries in the middle column are the halfway points between one class's upper limit and the next class's lower limit. You draw the bars against them; that is how the bars touch without overlapping; the tallest bar sits over 70 to 79 and holds 40% of the data. The bars fall away more slowly on the right than on the left. The far left bar holds 1 observation, while the far right bar holds 2. The maximum (96) sits 17 beats above the peak class; the minimum (58) sits only 12 beats below it; that stretched right side is mild right skew, and the math agrees. The mean of these 25 rates is 1855 ÷ 25 = 74.2; the median (the 13th sorted value) is 73.0; the mean is above the median, with the tail to the right. That is a hint about shape that we build on in the next section.

One warning about histograms; the picture depends on choices you made. Change the number of classes, and the same data can look smooth, spiky or two peaked (bimodal). That is not a flaw to hide. It is a reason to try two or three bin widths before you believe any feature you see.

Stem-and-leaf plots

A stem-and-leaf plot (or stemplot) gives you a histogram's shape and keeps every original number. Split each value into a stem (the leading digits) and a leaf (the final digit). List the stems in a column, then write each leaf beside its stem, from smallest to largest. For the pulse data, the stem is the tens digit:

StemLeavesCount
581
61 2 4 5 7 8 87
70 1 2 2 3 4 5 6 7 810
80 1 3 5 85
91 62
TotalKey: 6 | 4 means 64 bpm25

Turn that plot ninety degrees counterclockwise. You are looking at the histogram from the last table, with the same counts: 1, 7, 10, 5, 2; the gain is that nothing was thrown away. You can still read off the minimum (58), the maximum (96) and any repeated value (72 appears twice). Every stemplot needs a key, because “6 | 4” could just as well mean 6.4 in another data set. Stemplots are great for about 15 to 60 values. Beyond that, they get hard to manage.

Dot plots

A dot plot is the simplest display of all. Draw a number line. Stack one dot above each value for every time it comes up; take the exercise days data from Section 1; the column above 0 is 6 dots tall, and above 1 is 8 dots. Above 2 is 10 dots, and so on down to a single dot above 6 and above 7. With n = 40, the whole distribution fits on one line. And, like a stemplot, no information is lost.

Dot plots shine for small data sets, for counts of whole numbers (discrete counts) and for spotting outliers. A lone dot far out on the line is impossible to miss; a histogram might hide it inside a wide bin. Past about 50 observations, dot plots turn into an unreadable smear, then a histogram is the better tool.

Gaps carry meaning; they are not decoration. Say you draw a histogram with gaps between the bars. You have told your reader that the variable is made of groups (categorical) when it is not. Say you draw a bar chart with the bars touching; you have hinted that Bus flows smoothly into Bicycle. Readers take in that signal at once, without thinking, so get it right.

Interactive Drag the bin width and the bin offset and watch one fixed data set change shape, with a six-width comparison strip, a live peak counter, an optional overlay of the true population, and the square-root, Sturges, Scott and Freedman-Diaconis rules computed from the data on screen. Open full ↑
Key points
  • A histogram plots classes on a continuous axis, so its bars touch at the class boundaries. The shape depends on the bin width you choose.
  • A stem-and-leaf plot shows the same shape while keeping every original value; it always needs a key.
  • A dot plot stacks one dot per observation on a number line. It is ideal for small or discrete data and for spotting outliers.
  • A rough guide by sample size: a dot plot for under about 50, a stemplot for 15 to 60, and a histogram for anything larger.

Section 4The shape of a distribution

Curves showing right-skewed, symmetric, and left-skewed distributions
Reference. Skewed distributions; the long tail points in the direction the distribution is said to be skewed. Source and license: see the figure credits

Symmetric, skewed right, skewed left

Once you have a display, describe it in three words: shape, center and spread. Chapter 4 handles center and spread. Shape is this section. A distribution is symmetric when you could fold the picture down the middle and the two halves would about match. The bell shaped curve is the famous case, but a flat distribution is symmetric too.

When one side stretches further than the other, the distribution is skewed; here is the naming rule that trips up nearly everyone. A distribution is named for the direction of its long tail, not for where the pile of data sits. A skewed right (positively skewed) distribution has most of its data bunched on the left. A thin tail trails off to the right. Incomes, house prices and hospital stays all look like this; a skewed left (negatively skewed) distribution is the mirror image; the bunch is on the right, and a tail drags to the left. Examples are scores on an easy exam, or age at death in a wealthy country.

Worked example: right skew. Here are ten yearly salaries at a small firm, in thousands of dollars: 32, 34, 35, 36, 38, 40, 42, 44, 46, 253; the last one is the owner. The sum is 32 + 34 + 35 + 36 + 38 + 40 + 42 + 44 + 46 + 253 = 600. So the mean is

x̄ = Σx ÷ n = 600 ÷ 10 = 60.0 thousand

With n = 10, the median is the average of the 5th and 6th sorted values: (38 + 40) ÷ 2 = 39.0 thousand. The mean sits 21 thousand above the median, because one huge value pulls it there. Nine of the ten workers earn less than the “average” salary; the long right tail did that.

Worked example: left skew. Here are ten scores on an easy exam: 45, 62, 78, 85, 88, 90, 91, 93, 94, 96. The sum is 822, so x̄ = 822 ÷ 10 = 82.2. The median is (88 + 90) ÷ 2 = 89.0; now the mean falls below the median; the low outlier at 45 drags it down. That is the mark of a left tail.

ShapeWhere the tail pointsTypical mean vs. medianEveryday example
SymmetricNeither side; both tails similarMean ≈ medianAdult heights within one sex
Skewed rightTo the right (high values)Mean usually > medianHousehold income, home prices
Skewed leftTo the left (low values)Mean usually < medianScores on an easy exam
UniformFlat: no tail at allMean ≈ medianA fair die rolled many times

Treat that third column as a reliable rule of thumb, not a proven law (theorem). For most real data with one peak, it holds, and it is truly useful. If someone reports a mean far above the median, picture a right tail before you see the graph. But mathematicians have built skewed distributions where the order flips, so check with the picture instead of trusting the rule blindly.

Uniform distributions and modality

A uniform distribution has about the same frequency in every class, so the histogram looks like a flat plateau. Rolling a fair die a few thousand times gives one. So does the last digit of a well mixed set of ID numbers. Uniform is worth naming because it is a strong claim. It says no value in the range is any more common than any other.

Modality counts the peaks; a unimodal distribution has one clear peak; a bimodal distribution has two. Anything with three or more is multimodal. Modality is the most telling feature you can read off a histogram. That is because two peaks most often mean two populations have been mixed together. Think of a clinic that has both walk in and scheduled visits; its waiting times will often be bimodal, so will heights in a group of mixed adults and children. When you see two peaks, do not sum up the data as one. Split the data and describe each group on its own. A mean worked out across a bimodal distribution can land right in the valley between the peaks. Then it describes a value that almost nobody has.

“Skewed right” feels backwards until it clicks. In a right skewed distribution, most of the data are on the left. That is why so many people name it the wrong way. Anchor on the tail. Point at the thin, stretched out end of the picture. Whichever way your finger points is the name. Tail right, skewed right.

Interactive Simulate symmetric, skewed-right, skewed-left, uniform and bimodal data, watch the mean, median and skewness recompute live from the values on screen, then test yourself on fresh unlabelled histograms. Open full ↑
Key points
  • Describe every display by shape, center and spread. Shape comes first.
  • Skew is named for the tail. Tail to the right = skewed right. Tail to the left = skewed left.
  • As a rule of thumb, right skew pulls the mean above the median, and left skew pulls it below. The exact math here agrees (60.0 vs. 39.0; 82.2 vs. 89.0).
  • Uniform means flat. Bimodal most often means two populations are mixed and should be studied apart.

Section 5Misleading graphs

The same data plotted on a linear scale and on a logarithmic scale
Reference. The same values drawn on a linear scale and on a logarithmic scale. The choice of scale changes the story the picture seems to tell. Source and license: see the figure credits

The truncated axis

Every method in this chapter can be turned against the reader; the most common weapon by far is the truncated axis; that is a frequency or value axis that starts somewhere above zero. On a bar chart, this is close to fatal. A bar speaks through its length, and length only means something when it is measured from zero. Cut off the bottom, and the bar you see no longer stands for the amount at all. It stands for the amount minus whatever number you chose to hide.

Worked example. A company's sales for each quarter, in millions of dollars, are Q1 = 98, Q2 = 100, Q3 = 102 and Q4 = 104. The real change from Q1 to Q4 is

(104 − 98) ÷ 98 = 6 ÷ 98 = 0.0612, or about 6.1%

Draw it on an axis running from 0 to 110. The Q4 bar is 104 ÷ 98 = 1.061 times the Q1 bar; it is a bit taller, and honestly modest; now cut off (truncate) the axis so it starts at 97. The bar heights you see become 98 − 97 = 1, 100 − 97 = 3, 102 − 97 = 5 and 104 − 97 = 7 units. The Q4 bar is now seven times the height of the Q1 bar. That looks like a rise of (7 − 1) ÷ 1 = 6.00, or 600%. Nothing in the data changed; one number on one axis changed. And a 6% drift across the whole year became an explosion.

Edward Tufte gave this overstatement a name and a formula. The lie factor is the size of the effect shown in the picture divided by the size of the effect in the data:

lie factor = (apparent effect) ÷ (actual effect) = 6.00 ÷ 0.0612 ≈ 98

A truthful graph has a lie factor near 1; this one overstates the growth about a hundredfold. So bar charts and histograms must begin at zero, with no exceptions. Line graphs are different when the amount never comes near zero, such as body temperature or a stock index. They may fairly start elsewhere, because a line speaks through its slope, not its length. Even then, the axis must be clearly labeled and the break made obvious. And you should still ask whether the slope you see is truly dramatic or just zoomed in.

Distorted scales, distorted areas

The second family of tricks bends the scale itself, not its starting point; here are a few worth knowing:

Warning signWhat it does to the readerWhat to ask
Value axis not starting at zeroMultiplies apparent differences (here, 6% looked like 600%)Where does the axis actually begin?
Axis with no numbers or unitsMakes any slope unverifiablePercent of what? Per what?
Icons resized in two dimensionsTurns a doubling into a 4× or 8× impressionIs length or area encoding the number?
Unequal histogram class widthsInflates the widest barAre all the classes the same width?
Unevenly spaced time axisFabricates accelerationAre the gaps between labels equal in time?
3D bars, tilted pies, drop shadowsAdds visual area unrelated to dataDoes the decoration carry any information?
Truncated or cherry-picked date rangeHides the trend outside the windowWhat happened just before and just after?

Assume a mistake before you assume a lie, then check anyway. Most misleading charts come from default software settings, not from liars. Spreadsheet programs will happily cut off an axis for you and call it “auto.” The reader cannot tell a trick from an accident, and neither can be defended. Read every axis before you read the picture, and set your own axes on purpose.

Interactive Slide the y-axis baseline off zero and watch a real difference of a fraction of a percent balloon into a landslide, with the true difference, the difference as drawn, and the exaggeration factor all computed live from the seeded sample the page plots, beside a permanent zero-baseline chart of the very same numbers. Open full ↑
Key points
  • Bar charts and histograms must start at zero. Length only means something when measured from zero.
  • A truncated axis can turn a 6.1% change into what looks like a 600% change. That is a lie factor of about 98.
  • Scaling an icon in two directions inflates a 2× change to 4× by area and 8× by apparent volume.
  • Unequal class widths, uneven time spacing, dual axes and log scales with no label all distort without changing a single data value.
  • Read the axes first. Always.

The chapter in one breath

  • A frequency distribution counts how often each value or class comes up; the counts must add up to n. The relative frequencies (f ÷ n) must add up to 1; the cumulative column must end at n.
  • For measurements, group into 5 to 10 classes of equal width that do not overlap. Width = range ÷ number of classes, rounded up.
  • Qualitative data get bar charts, with gaps between bars, equal widths and an axis from zero. Sort them into a Pareto chart when you want the biggest groups to stand out.
  • Pie charts need mutually exclusive, exhaustive groups. Slice angle = (f ÷ n) × 360°, and the angles must add up to 360°.
  • Quantitative data get histograms, whose bars touch because the axis is continuous. They also get stem-and-leaf plots, which show shape plus every original value, with a key. Or they get dot plots, with one dot per observation, best for small or discrete data.
  • Describe any display by shape, center and spread. Skew is named for the tail. Right tail = skewed right, and then the mean is most often pulled above the median.
  • Bimodal almost always means two populations are mixed. Split them instead of summing them up together.
  • A truncated axis or a distorted scale misleads without changing a single number; read the axes before you read the picture.

ReferenceWords worth knowing

A quick reference for the terms in this chapter. Skim it now, or come back whenever a word trips you up.

Bar chart
A display of qualitative data using bars of equal width separated by gaps. Bar height is in proportion to frequency or relative frequency.
Bimodal
Having two clear peaks; it is most often a sign that two different populations have been mixed into one data set.
Class width
The size of each range in a grouped frequency distribution. It is about the range divided by the number of classes, always rounded up.
Cumulative frequency
A running total of frequencies: the number of observations at or below a given value or class; its last entry equals n.
Dot plot
A display in which one dot is stacked above a number line for each observation at that value.
Frequency (f)
The number of times a certain value or class comes up in a data set.
Frequency distribution
A table that pairs each value or class with the number of observations that fall in it.
Grouped frequency distribution
A frequency table built from ranges (classes) instead of single values; it is used when values rarely repeat.
Histogram
A display of quantitative data in which classes sit on a continuous axis, so the bars touch at the class boundaries.
Lie factor
The size of the effect shown in a graphic divided by the size of the effect in the data. An honest graph has a lie factor near 1.
Ogive
A line graph of cumulative frequency plotted against the upper class limits; it rises from 0 to n.
Outlier
An observation far from the bulk of the data. It is often obvious on a dot plot or stemplot, and easily hidden by wide histogram bins.
Pareto chart
A bar chart with the bars set from tallest to shortest, to stress the largest groups.
Pie chart
A circle split into wedges whose center angles are in proportion to relative frequency. It is valid only for mutually exclusive, exhaustive groups.
Relative frequency
The share of the data in a class, f ÷ n; the column adds up to 1, or 100%.
Skewed left (negatively skewed)
A distribution whose long tail stretches toward the low values; the mean is most often less than the median.
Skewed right (positively skewed)
A distribution whose long tail stretches toward the high values; the mean is most often greater than the median.
Stem-and-leaf plot
A display that splits each value into a leading stem and a trailing leaf, keeping every original observation; it needs a key.
Symmetric distribution
A distribution whose halves are about mirror images around its center.
Truncated axis
A value axis that begins above zero, which makes the differences between bars look bigger than they are.
Uniform distribution
A distribution in which every class has about the same frequency, giving a flat display.
Unimodal
Having one clear peak.

Check yourself

1. In a data set of n = 40, one class has a frequency of 7. Find its relative frequency and its percentage. Name the two totals you should always check when you finish a frequency table.
7 ÷ 40 = 0.175, or 17.5%. The frequency column must add up to n = 40. The relative frequency column must add up to 1.000 (100%). The cumulative column gives a third check, since its last entry must also equal n.
2. Use the exercise days table (cumulative relative frequency 0.775 at x = 3). What share of the 40 adults exercised more than 3 days? Show both ways of getting it.
0.225, or 22.5%. By the complement: 1 − 0.775 = 0.225. Directly: the frequencies for 4, 5, 6 and 7 days are 5 + 2 + 1 + 1 = 9, and 9 ÷ 40 = 0.225. The two agree, which confirms the table.
3. A data set runs from a minimum of 12 to a maximum of 87, and you want 6 classes. Work out the class width. Explain why you round the way you do.
Range = 87 − 12 = 75; 75 ÷ 6 = 12.5, which rounds up to a width of 13. You always round up. Rounding down to 12 would give six classes starting at 12: 12 to 23, 24 to 35, 36 to 47, 48 to 59, 60 to 71 and 72 to 83. They stop at 83, so the maximum of 87 would have no class to live in. Width 13 works: 12 to 24, 25 to 37, 38 to 50, 51 to 63, 64 to 76 and 77 to 89 cover every value.
4. A student writes classes as 10 to 20, 20 to 30 and 30 to 40. What is wrong, and what goes wrong after that?
The classes overlap at their endpoints. A value of exactly 20 belongs to two classes. Classes must not overlap (be mutually exclusive) and must leave no gaps, so each observation is counted just once. Overlapping classes make the frequency column unclear, and it will most often fail to add up to n.
5. A survey group holds 45 of 300 people who answered. Find its relative frequency, its percentage and the center angle of its pie slice.
45 ÷ 300 = 0.15 = 15%; angle = 0.15 × 360° = 54°. Here is a useful shortcut. Every 1% of a pie is 3.6°, so 15% × 3.6° = 54°.
6. People could name up to three favorite sports, so the counts across groups add up to 470 among 200 people. Why is a pie chart not valid here, and what should be used instead?
A pie needs mutually exclusive and exhaustive groups. Each person must be in just one slice, and all slices must form one whole. With more than one answer each, the “percentages” would add up to more than 100%. The wedges could not form a single circle; use a bar chart. Label the bars as a percent of people who answered (respondents), not of answers, and say so plainly.
7. Explain just why histogram bars touch while bar chart bars are separated; what does a reader wrongly conclude if you swap them?
A histogram's horizontal axis is a continuous number scale, so one class ends just where the next begins. The bars share a boundary. A bar chart's axis is a list of group names, with no space between them to measure. A histogram with gaps suggests the variable is made of groups. A bar chart with no gaps suggests one group flows smoothly into the next. Both are false statements made by the drawing, not the data.
8. Build the stem-and-leaf plot (stem = tens digit) for 41, 43, 47, 52, 55, 55, 58, 61, 67 and 70. Give the key.
4 | 1 3 7  ·  5 | 2 5 5 8  ·  6 | 1 7  ·  7 | 0. Key: 5 | 2 means 52. The leaf counts are 3 + 4 + 2 + 1 = 10 = n ✓. The plot keeps every value, so you can still read the minimum (41), the maximum (70) and the repeat at 55.
9. Ten salaries (in thousands) are 32, 34, 35, 36, 38, 40, 42, 44, 46 and 253. Work out the mean and the median, and name the shape.
x̄ = 600 ÷ 10 = 60.0; median = (38 + 40) ÷ 2 = 39.0; the distribution is skewed right. The mean sits far above the median because the one large value stretches a long right tail. Note what this means in practice: 9 of the 10 workers earn below the mean.
10. A histogram of clinic waiting times shows two clear peaks. Why should you hold back from reporting a single average, and what should you do instead?
Two peaks (a bimodal distribution) most often mean two different populations are mixed together. Here, they might be walk in and scheduled patients. A single mean can land in the valley between the peaks. Then it describes a waiting time almost nobody has. Find the variable that splits the groups. Split the data, and describe each group on its own.
11. Sales for each quarter are 98, 100, 102 and 104 (millions). Work out the true percent change from Q1 to Q4. Then work out the change it looks like if the bars are drawn on an axis starting at 97. What is the lie factor?
True change = (104 − 98) ÷ 98 = 0.0612 ≈ 6.1%. Cut off at 97, the bar heights are 1, 3, 5 and 7. So the change looks like (7 − 1) ÷ 1 = 6.00 = 600%. Lie factor = 6.00 ÷ 0.0612 ≈ 98. The graphic overstates the growth about a hundredfold, though not one data value was changed. That is why bar charts and histograms must start at zero.
12. A pictogram shows an amount doubling by drawing an icon at twice the width and twice the height. By what factor does the icon's area grow? What would an icon that looks three dimensional suggest? What is the right fix?
Area grows by 2 × 2 = 4 times. An icon that looks 3D suggests a volume 23 = 8 times larger. The data doubled, but the reader sees a 4× or 8× rise. The fix is to show the number in one direction only. Repeat identical icons (two icons for twice as much), or just use a bar of double the length.
Statistics Easy Read · Chapter 4

Center & Spread

A pile of numbers tells you nothing until you can answer two questions about it. Where is the middle? And how spread out is everything else? Those two questions, center and spread, are the whole business of this chapter. Together they are the most useful pair of ideas in all of descriptive statistics. You will learn three ways to describe the middle and four ways to describe the spread. You will learn when each one tells the truth and when it quietly lies. None of this needs a talent for math. It needs only that you add, subtract, divide and take a square root, one careful step at a time. Every formula here is worked out with numbers at least once. So you can follow the math with your finger if you want to.

By the end of this chapter you can

  • Work out the mean, median and mode of a data set. Explain what each one measures.
  • Choose the right measure of center for skewed data, symmetric data and data made of groups (categorical data).
  • Work out the range, variance and standard deviation. Explain why we divide by n − 1 for a sample.
  • Build a five-number summary, find the interquartile range and sketch a boxplot.
  • Use the 1.5 × IQR rule to flag outliers, and state its limits.
  • Turn a raw value into a z-score and back again; use z-scores to compare values from different distributions.
  • Use the empirical rule (68 to 95 to 99.7) on bell shaped data. Say just when it does not apply.
  • Use Chebyshev's theorem to set a floor you can count on for the data in any distribution, whatever its shape.

Section 1Measures of center

Curves showing how the mean and median sit relative to each other in left-skewed, symmetric, and right-skewed distributions
Reference. The mean and the median under different shapes; they match when a distribution is symmetric and pull apart when it is skewed. Source and license: see the figure credits

Three different ideas of "middle"

Everyday English has one word for the middle of a group of numbers. Statistics has three, because there are three truly different things you might mean; the mean is the balance point. Add everything up and share it out equally; the median is the middle by position. Line the values up from smallest to largest and take the one standing in the center. The mode is the most popular value, whichever number shows up most often. On nicely symmetric data, all three land in nearly the same place. That is why it is easy to think they can be swapped; they cannot.

Start with a small, honest data set. Seven people report the number of hours they spent on a task:

4, 8, 9, 9, 12, 13, 15

The mean is the sum divided by the count; it is written x̄ ("x-bar") for a sample and μ ("mu") for a population:

x̄ = Σx / n

Here Σx = 4 + 8 + 9 + 9 + 12 + 13 + 15 = 70, and n = 7. So x̄ = 70 / 7 = 10 hours; the capital Greek sigma, Σ, is just an order: "add up everything that follows."

The median needs the values sorted, and they already are. With n = 7 (odd), the middle position is the (7 + 1) / 2 = 4th value. Count in: 4, 8, 9, 9, 12, 13, 15; the median is 9 hours. When n is even, there is no single middle value, so you average the two middle ones. For 3, 7, 8, 12, 13, 14, the two middle values are 8 and 12. The median is (8 + 12) / 2 = 10.

The mode is the value that comes up most often; only 9 appears twice, so the mode is 9 hours. A data set can have one mode, two (bimodal), several (multimodal) or none at all if every value appears just once.

Why the choice matters: the outlier problem

Here is where the three measures come apart. Say a company of six people reports yearly pay, in thousands of dollars:

38, 42, 45, 48, 52, 275

The mean is (38 + 42 + 45 + 48 + 52 + 275) / 6 = 500 / 6 = 83.3 thousand. The median, averaging the two middle values, is (45 + 48) / 2 = 46.5 thousand. Look at what just happened; the "average" salary at this company is $83,300. Yet five of the six workers earn less than that. One extreme value dragged the mean nearly forty thousand dollars away from anything a typical worker earns; the median did not budge.

That difference has a name; a statistic is resistant (or robust) if extreme values barely move it; the median and the mode are resistant. The mean is not; the mean is not "wrong" here. It is a perfectly correct balance point. If you want the total payroll, the mean times the head count gives it to you exactly. It just answers a different question from the one most people mean when they say "typical."

How the mean and median relate is also a quick way to detect shape. Think of a right-skewed (positively skewed) distribution, with a long tail stretching toward high values. Income and hospital stays are examples; there the mean is pulled above the median. In a left-skewed distribution, the mean falls below the median. When the mean and median are close, the distribution is about symmetric.

Picking the right one

The choice is not a matter of taste; it follows from the data's shape and its level of measurement; you cannot average eye color. And you should not average a data set whose whole story is in its tail.

MeasureDefinitionUse it whenAvoid it when
MeanΣx / n: the balance pointData are about symmetric and quantitative; you need a value that feeds later formulas (variance, z-scores, most inference).Data are strongly skewed or contain outliers; data are categorical
MedianThe middle value in sorted orderData are skewed or have outliers; data are ordinal (ranked); you want "typical"You need an algebraic quantity for later computation
ModeThe most frequent valueData are made of groups (blood type, brand, color); you want the most common group, or you suspect two clusters.Values are continuous and mostly unique: the mode is then meaningless

One more practical point. "Averages" reported in the news are almost always means. And they are almost always applied to skewed amounts, such as income, home prices, wait times and medical costs. Whenever you see the word average attached to money or time, the honest follow up question is "and what was the median?"

Mean for balance, median for typical. If one huge value would change your conclusion, you are looking at a job for the median. Report both when they disagree; the gap between them is information, not a problem to hide.
Interactive Drag one value away from the crowd and watch the mean chase it a fixed 1/n of the way while the median sits still, with a live dot plot, a balance-point marker, and a trace of both statistics against the value you are dragging. Open full ↑
Key points
  • The mean x̄ = Σx / n is the balance point; the median is the middle by position; the mode is the most common value.
  • For an even n, the median is the average of the two middle sorted values.
  • The median and mode are resistant to outliers; the mean is not.
  • Mean > median hints at right skew. Mean < median hints at left skew. Mean ≈ median hints at symmetry.
  • Only the mode works for categorical data.

Section 2Measures of spread

Two normal curves with the same center but different widths, showing small versus large spread
Reference. Two distributions with the same center but very different spread; the mean alone cannot tell them apart. Source and license: see the figure credits

Why the center is only half the story

Consider two groups of five measurements:

Set A: 48, 49, 50, 51, 52
Set B: 30, 40, 50, 60, 70

Both add up to 250, so both have a mean of exactly 50. Report only the mean, and the two sets look like twins; look at them, and they are nothing alike. Set A is packed tight. Set B is scattered. Spread (also called dispersion or variability) is the measure that tells them apart. In practice, it often matters more than the center. A process that averages the right answer but swings wildly is most often worse than one that is a bit off but steady.

The roughest measure of spread is the range:

Range = maximum − minimum

For Set A, the range is 52 − 48 = 4. For Set B, it is 70 − 30 = 40; that already tells them apart. And the range is easy to understand at once, which is why it is quoted so often. But its weakness is fatal for serious work; it uses only two numbers and throws away everything in between. And those two numbers are the most extreme values in the data set, just the ones most likely to be flukes. Add one typo to your spreadsheet, and the range can change by a factor of ten (an order of magnitude).

Variance and standard deviation, step by step

A better measure uses every value; the natural idea is to measure how far each value sits from the mean. That is its deviation, (x − x̄). Then you average those distances; there is one snag. The deviations always add up to exactly zero, because the mean is the balance point; the pluses and minuses cancel perfectly, every time; the fix is to square each deviation first; that makes everything positive. As a bonus, it punishes large gaps more than small ones.

Squaring gives the variance; there are two versions, and the difference is not just for show:

Population: σ2 = Σ(x − μ)2 / N
Sample: s2 = Σ(x − x̄)2 / (n − 1)

The top part, Σ(x − x̄)2, is called the sum of squares, or SS for short. Variance is in squared units, such as squared dollars or squared minutes, which nobody can picture. So we most often take the square root and report the standard deviation; that brings us back to the original units:

σ = √(σ2)     s = √(s2)

Read the standard deviation as about how far a typical value sits from the mean; that is not its exact definition. (It is the root mean square deviation, not the average absolute deviation.) But it is the right picture to hold in your head, and it will not mislead you.

Now the math, worked in full for Set A treated as a sample. First the mean: x̄ = 250 / 5 = 50.

Value xDeviation (x − x̄)Squared deviation (x − x̄)2
4848 − 50 = −24
4949 − 50 = −11
5050 − 50 = 00
5151 − 50 = +11
5252 − 50 = +24
Totals0 ← alwaysSS = 10

Divide the sum of squares by n − 1 = 4:

s2 = 10 / 4 = 2.5     s = √2.5 ≈ 1.58

Run the same steps on Set B. The deviations are −20, −10, 0, +10, +20. Their squares are 400, 100, 0, 100, 400, so SS = 1000. So s2 = 1000 / 4 = 250 and s = √250 ≈ 15.81. Every deviation in Set B is exactly ten times the matching deviation in Set A. So the standard deviation is exactly ten times as large; that is a useful sanity check. It is also a reminder that the standard deviation scales the same way the data do.

Say we had treated Set A as a whole population. Then we would have divided SS by N = 5 instead: σ2 = 10 / 5 = 2 and σ = √2 ≈ 1.41. Notice that the sample version is always the larger of the two.

Why n − 1, and how to compare spreads fairly

The n − 1 in the sample formula is called Bessel's correction; the reason for it is worth understanding, not just memorizing; you work out deviations from the sample mean; that center was itself worked out from those same data points. By design, the sample mean sits right in the middle of your own sample. So distances from it are steadily a little too small, compared with distances from the true population mean μ, which you do not know. Dividing by the smaller number n − 1 raises the result just enough to fix that tilt. Worked out this way, s2 is an unbiased estimator of σ2. That means over many repeated samples, it averages out to the right answer. The number n − 1 is also called the degrees of freedom. Once you know the mean and any four of five values, the fifth is forced. So only four of the deviations are free to vary.

Last, a standard deviation only means something next to its own mean. An s of 15 is huge for adult body temperature and tiny for yearly income. To compare spread across different scales or units, use the coefficient of variation. It gives the standard deviation as a percentage of the mean:

CV = (s / x̄) × 100%

For Set A, CV = (1.58 / 50) × 100% ≈ 3.2%. For Set B, CV = (15.81 / 50) × 100% ≈ 31.6%. Set B is about ten times as spread out, compared with its own center. The CV needs a ratio level variable with a true zero and a positive mean. It is nonsense for a scale like Celsius temperature, where zero is just a chosen point.

Variance is squared; standard deviation is not. If your data are in minutes, the variance is in "square minutes." That unit has no physical meaning. That is just why we take the square root and report s. Never read a variance as a distance, and never compare a variance with a mean.
Interactive Turn a spread dial and watch every deviation from the mean stretch or shrink in real time, with s tracking the dial exactly, the variance tracking its square, and the full arithmetic recomputed live from the values on screen. Open full ↑
Key points
  • Range = max − min; it is simple, but it is built from the two least trustworthy values.
  • Deviations (x − x̄) always add up to zero, so we square them; the total is the sum of squares.
  • Sample variance s2 = SS / (n − 1). Population variance σ2 = SS / N.
  • Standard deviation is the square root of the variance, and it is back in the original units.
  • n − 1 (Bessel's correction, the degrees of freedom) makes s2 an unbiased estimate of σ2.

Section 3The five-number summary

Labeled boxplot showing minimum, first quartile, median, third quartile, maximum, whiskers, and outliers
Reference. The parts of a boxplot; the box edges sit at the quartiles, with a line at the median. Whiskers reach to the last value that is not an outlier. Outliers are plotted as single points. Source and license: see the figure credits

Quartiles and the summary itself

The median splits a sorted data set into two halves. Split each half again, and you get the quartiles. These are three cut points that carve the data into four quarters of equal size. Q1, the first quartile, has 25% of the data below it. Q2 is the median, with 50% below. Q3, the third quartile, has 75% below it. Quartiles are a special case of percentiles; the pth percentile is the value below which about p% of the data fall. So Q1 is the 25th percentile and Q3 is the 75th.

Put the two extremes on either end, and you have the five-number summary: minimum, Q1, median, Q3 and maximum. With five numbers, you know the center, the spread, the shape and the reach of the data. No description in statistics packs more information into fewer characters.

Work an example; here are twelve response times, in minutes, already sorted:

3, 7, 8, 12, 13, 14, 18, 21, 22, 26, 31, 58

Step 1: median. With n = 12 (even), average the 6th and 7th values: (14 + 18) / 2 = 16.

Step 2: Q1. Take the lower half, the six values below the median position: 3, 7, 8, 12, 13, 14; its median is (8 + 12) / 2 = 10.

Step 3: Q3. Take the upper half: 18, 21, 22, 26, 31, 58. Its median is (22 + 26) / 2 = 24.

Step 4: the summary. Minimum 3, Q1 10, median 16, Q3 24, maximum 58.

From these, you get the interquartile range right away:

IQR = Q3 − Q1 = 24 − 10 = 14

The IQR is the width of the middle 50% of the data. Compare it with the range, which is 58 − 3 = 55; the range says these data sprawl across 55 minutes; the IQR says the typical half of them fit inside a 14 minute window; both are true. The gap between them is telling you that something unusual lives out in the right tail. Like the median, the IQR is resistant; you could change that 58 to 5800, and the IQR would not move at all.

Here is a small warning that saves a lot of confusion later; there are several fair ways to work out quartiles. They differ in whether the median value itself is included when you split a data set with an odd count. They also differ in how they fill in between values (interpolate); the method used above is to take the median of each half; it is the one taught in most first courses; those leave the median out of both halves when n is odd. Tukey's original hinges include it in both instead. With an even n, as here, the two agree exactly. Different software may report a Q1 and Q3 that differ a little from your hand math. Neither is wrong; they answer the question with different rules.

Boxplots and the 1.5 × IQR rule

A boxplot (box-and-whisker plot) draws the five-number summary; a box spans from Q1 to Q3, so its width is the IQR. A line inside marks the median. Whiskers then reach outward, but not always to the minimum and maximum. They stop at the most extreme values that still count as ordinary. Anything beyond them is plotted as a single dot.

What counts as ordinary is set by the 1.5 × IQR rule; it sets two fences:

Lower fence = Q1 − 1.5 × IQR
Upper fence = Q3 + 1.5 × IQR

Any value outside the fences is flagged as an outlier. For our response times, 1.5 × IQR = 1.5 × 14 = 21, so:

QuantityCalculationResult
Minimumsmallest value3
Q1median of lower half10
Median (Q2)(14 + 18) / 216
Q3median of upper half24
Maximumlargest value58
IQR24 − 1014
1.5 × IQR1.5 × 1421
Lower fence10 − 21−11
Upper fence24 + 2145
Outliersvalues < −11 or > 4558 only

So the boxplot's left whisker reaches down to 3; that is the smallest value, well inside the lower fence. The right whisker stops at 31, the largest value that is not an outlier. And 58 is drawn as a lone point off to the right. Note that no value can fall below the lower fence of −11 here, since times cannot be negative. So this rule can only ever flag high outliers in these data. Remember that before you read the one flag as proof of anything by itself. The skew is better judged from the summary as a whole; the outlier sits in the upper tail. Q3 is farther from the median (24 − 16 = 8) than Q1 is (16 − 10 = 6). And the mean of these twelve values, 233 / 12 ≈ 19.4, sits well above the median of 16. All three point the same way; the data are right skewed.

Boxplots really pay off when you place several side by side. Compare three groups by boxplot, and you can read many things at a glance. You see differences in center (the median lines) and in spread (the box lengths). You see differences in skew, shown by whether the median sits off center in its box, and you see any stragglers. All of this comes without assuming anything about the shape of the distributions.

An outlier is a flag, not a verdict. The 1.5 × IQR rule picks out values worth looking into. It does not give you the right to delete them; a flagged point may be a typing error, so fix it. It may be a measurement from a different population, so document it and maybe leave it out. Or it may be the single most important real observation you have. Deleting data you do not like because a formula flagged it is how findings get faked.
Interactive Drag one value across the 1.5 × IQR fence and watch the boxplot rebuild itself: five numbers computed live, a whisker that retreats to the last value inside the fence, and a sweep of every multiplier showing how many points each one would flag. Open full ↑
Key points
  • The five-number summary is minimum, Q1, median, Q3 and maximum.
  • IQR = Q3 − Q1 is the width of the middle 50%, and it is resistant to outliers.
  • A boxplot draws the box from Q1 to Q3 with the median inside. Whiskers reach the last value that is not an outlier.
  • Fences sit at Q1 − 1.5 × IQR and Q3 + 1.5 × IQR. Values beyond them are flagged as outliers.
  • Ways of working out quartiles vary a little between textbooks and software. Expect small differences.

Section 4Z-scores

Normal curve aligned with standard deviation markings, z-score scale, and percentile scale
Reference. A normal curve with its standard deviation, z-score and percentile scales lined up beneath it. Source and license: see the figure credits

Standardizing a value

Take two exams with two different scoring systems; you scored 82 on one and 88 on the other; which result was better? The raw numbers cannot say, because they are measured on different rulers. You need a way to strip away the scale of each exam. Then you can ask a question that does not depend on scale: how far above or below its own mean did each score fall, measured in standard deviations?

That is just what a z-score (also called a standard score) does:

z = (x − μ) / σ     or, for a sample,     z = (x − x̄) / s

Read the formula in two moves. The top part, (x − μ), says how far the value sits from the center, in the original units. Dividing by σ says in what currency to state that distance: standard deviations; the result is a pure number with no units at all. That is what lets you compare it across any two distributions you like.

Now settle the exam question. Say Exam A had a mean of 75 with a standard deviation of 5. Exam B had a mean of 80 with a standard deviation of 10.

ExamYour score xMean μSD σz-scoreReading
Exam A82755(82 − 75) / 5 = 7 / 5 = +1.401.40 SD above the mean
Exam B888010(88 − 80) / 10 = 8 / 10 = +0.800.80 SD above the mean

The lower raw score is the stronger result. On Exam A, you beat your classmates by 1.40 standard deviations. On Exam B, it was only 0.80; the 88 looked better only because Exam B was easier and more spread out; this is the whole point of standardizing; it turns "how many points" into "how unusual," and only the second one can be compared.

The sign carries meaning on its own; a positive z means above the mean; a negative z means below. And z = 0 means the value is exactly at the mean. Standardize a whole data set, and the new values always have a mean of 0 and a standard deviation of 1. Try it on Set A from Section 2 (x̄ = 50, s ≈ 1.58). The values 48, 49, 50, 51, 52 become z-scores of about −1.26, −0.63, 0, +0.63 and +1.26; they add up to zero.

Running the formula backwards, and reading the size

The formula can be rearranged, which is just as useful. Solve z = (x − μ) / σ for x:

x = μ + zσ

Say a measurement has μ = 70 and σ = 8; you are told one observation has z = −1.50, then x = 70 + (−1.50)(8) = 70 − 12 = 58. Any question of the form "what value sits two standard deviations above the mean?" is answered this way.

How big must a z-score be before it is interesting? A common working habit treats |z| > 2 as unusual and |z| > 3 as very unusual. Those cutoffs come from the empirical rule in the next section, so they assume a distribution that is about bell shaped; they are habits, not laws.

z-scorePositionRough reading (bell-shaped data)
0At the meanPerfectly typical; about the 50th percentile
+11 SD aboveAround the 84th percentile
−11 SD belowAround the 16th percentile
±22 SD from the meanUnusual: only about 5% of values are this far out or farther
±33 SD from the meanVery unusual: roughly 0.3% of values

Here is one warning that trips up nearly everyone. Working out a z-score needs no assumption about the shape of the distribution. You can standardize any data set with a mean and a standard deviation, however lopsided. But turning a z-score into a percentile or a probability does need you to know the shape. The right hand column of the table above holds for bell shaped data; it can be badly wrong for skewed data. A z of +2 sits at about the 98th percentile of a bell shaped distribution. In a strongly right skewed one, it can land nearer the 95th. With other shapes, it can miss the other way; the only way to know is to look at the distribution.

A z-score is a location, not a probability. "z = 2" means "two standard deviations above the mean" and nothing more. It only becomes a statement about how likely a value is once you commit to a shape for the distribution. That is a separate claim, and you have to back it with the data.
Interactive Standardize a value with z = (x − mean) ÷ SD and watch two scores from completely different distributions, race times, house prices, a height and a weight, land on one shared unitless ruler, with every z, percentile and curve computed live. Open full ↑
Key points
  • z = (x − μ) / σ states a value as a number of standard deviations from the mean.
  • z-scores have no units (they are unitless); that is what lets you compare values from different distributions.
  • Rearranged, x = μ + zσ turns a z-score back into a value on the original scale.
  • A standardized data set always has a mean of 0 and a standard deviation of 1.
  • Standardizing needs no assumption about shape. Turning z into a percentile does.

Section 5The empirical rule

Normal distribution curve labeled with the 68, 95, and 99.7 percent intervals at one, two, and three standard deviations
Reference. The empirical rule. About 68%, 95% and 99.7% of a bell shaped distribution lies within one, two and three standard deviations of the mean. Source and license: see the figure credits

68 to 95 to 99.7 for bell-shaped data

Say a distribution is bell shaped; it is about symmetric, with one peak and tails that thin out smoothly on both sides, then the standard deviation does something remarkable; it predicts, quite exactly, how much of the data lies where. This is the empirical rule, also called the 68 to 95 to 99.7 rule:

IntervalApproximate share of dataMore precise value
μ ± 1σabout 68%68.27%
μ ± 2σabout 95%95.45%
μ ± 3σabout 99.7%99.73%

Work an example; a standardized test is bell shaped with μ = 100 and σ = 15. Then:

The bell is symmetric, so you can split the leftovers evenly and answer one sided questions too. Outside ±2σ lies 100% − 95% = 5% of the data, half in each tail. So about 2.5% of scores are above 130, and about 2.5% fall below 70. Outside ±1σ lies 32%, so about 16% of scores are above 115, and since 68% sits inside ±1σ, half of that, 34%, lies between 100 and 115.

A note for later chapters: "95%" is rounded; the interval holding exactly 95% of a normal distribution is μ ± 1.96σ, not μ ± 2σ. The 1.96 will show up again and again once you reach confidence intervals, so it is worth meeting now.

Chebyshev's theorem: the guarantee that always holds

The empirical rule has a strict condition: the data must be bell shaped. Use it on a strongly skewed distribution, such as incomes, wait times or insurance claims, and it will lie to you, often badly. So what can you say when you do not know the shape? Or when you know it is not bell shaped?

Chebyshev's theorem answers that. It works for any distribution at all, with any shape, any skew and any number of peaks, as long as it has a mean and a standard deviation. The share of data lying within k standard deviations of the mean is at least:

1 − 1 / k2     (for any k > 1)

Put in a few values of k. For k = 2: 1 − 1/22 = 1 − 1/4 = 0.75. So at least 75% of any data set lies within 2 SD of its mean. For k = 3: 1 − 1/9 = 0.889, so at least 88.9% lies within 3 SD. For k = 4: 1 − 1/16 = 0.9375, at least 93.75%. The rule k > 1 exists because at k = 1 the formula gives 1 − 1 = 0. That is true but useless.

A worked case; a right skewed set of processing times has μ = 200 seconds and σ = 20 seconds. You are asked what share of jobs finish between 140 and 260 seconds. First find k. The interval reaches 60 seconds on either side of the mean, and 60 / 20 = 3, so k = 3. Chebyshev then promises that at least 1 − 1/32 = 1 − 0.111 = 88.9% of jobs fall in that window. You did not need to know the shape at all; that is the point.

kIntervalChebyshev guarantees at leastEmpirical rule says (bell-shaped only)
2μ ± 2σ75%about 95%
3μ ± 3σ88.9%about 99.7%
4μ ± 4σ93.75%about 99.99%
5μ ± 5σ96%> 99.99%

Read that table with care, because the two columns are not rival estimates. Chebyshev states a floor that is never broken; the empirical rule states an approximation that holds when the bell shape holds. There is no clash between "at least 75%" and "about 95%" for the same interval. 95% is well over 75%. Chebyshev buys the power to work everywhere at the price of being vague. The empirical rule buys precision at the price of an assumption you must check.

How do you check it? Look at the data before you assume. Plot a histogram. Compare the mean with the median. Sketch a boxplot and see whether the median sits centered in its box. Every tool from Sections 1 through 3 exists partly to answer this one question.

Never use 68 to 95 to 99.7 on skewed data. On a right skewed distribution, μ − 2σ is often a negative number for an amount that cannot be negative. That is a sure sign the rule does not fit. When the shape is unknown or clearly lopsided, fall back on Chebyshev. Or better, report the actual quartiles.
Interactive Shade any slice of a normal curve and watch the area integrate live: drag the boundary out to 1, 2 and 3 standard deviations to find 68, 95 and 99.7 percent, then draw a real sample and count how many values actually landed inside. Open full ↑
Key points
  • The empirical rule: about 68%, 95% and 99.7% of bell shaped data lie within 1, 2 and 3 SD of the mean.
  • Symmetry lets you halve the leftover. About 2.5% of bell shaped data lie above μ + 2σ.
  • Exactly 95% matches μ ± 1.96σ, not ±2σ.
  • Chebyshev's theorem: for any shape, at least 1 − 1/k2 of the data lie within k SD of the mean (k > 1).
  • Chebyshev is a minimum you can count on; the empirical rule is an approximation that needs the bell shape.

The chapter in one breath

  • Center comes in three kinds: the mean (balance point), the median (middle by position) and the mode (most common value).
  • The mean is pulled by outliers and skew; the median is resistant, so report it whenever the data are lopsided. Report both when they disagree.
  • Spread is the other half of the story. Two data sets with the same mean can be nothing alike.
  • Variance averages squared deviations. σ2 = SS / N for a population, and s2 = SS / (n − 1) for a sample. The standard deviation is its square root, back in the original units.
  • The five-number summary (min, Q1, median, Q3, max) plus the IQR describes center, spread and shape without assuming anything; the boxplot draws it.
  • The 1.5 × IQR rule flags outliers to look into; it is a prompt to look, never a right to delete.
  • A z-score, (x − μ) / σ, turns any value into standard deviations from its own mean. That lets you compare values from different distributions directly.
  • The empirical rule (68 to 95 to 99.7) is exact but demands a bell shape. Chebyshev's theorem (at least 1 − 1/k2) is vaguer but always true.

ReferenceWords worth knowing

A quick reference for the terms in this chapter. Skim it now, or come back whenever a word trips you up.

Bessel's correction
Dividing the sum of squares by n − 1 instead of n when working out a sample variance. Then s2 is an unbiased estimate of the population variance σ2.
Boxplot
A box-and-whisker plot; a box runs from Q1 to Q3 with the median marked inside. Whiskers reach to the most extreme values that are not outliers, and outliers are drawn as separate points.
Chebyshev's theorem
For any distribution, whatever its shape, at least 1 − 1/k2 of the data lie within k standard deviations of the mean, for any k > 1.
Coefficient of variation (CV)
The standard deviation given as a percentage of the mean, (s / x̄) × 100%. It is used to compare spread across different scales or units.
Degrees of freedom
The number of values in a calculation that are free to vary. For a sample variance it is n − 1, because fixing the mean sets the last value.
Deviation
The signed distance of a single value from the mean, (x − x̄). Deviations from the mean always add up to zero.
Empirical rule
For bell shaped distributions, about 68%, 95% and 99.7% of the data lie within one, two and three standard deviations of the mean.
Five-number summary
The set of minimum, Q1, median, Q3 and maximum; it is a compact description of center, spread and shape.
Interquartile range (IQR)
Q3 − Q1, the width of the middle 50% of the data; it is a resistant measure of spread.
Mean
The arithmetic average: x̄ = Σx / n for a sample and μ = Σx / N for a population. It is the balance point of the data.
Median
The middle value of sorted data. With an even count, it is the average of the two middle values. It is also the 50th percentile and the second quartile.
Mode
The value that comes up most often; it is the only measure of center you can use with categorical data. A data set may have one mode, several or none.
Outlier
A value far from the bulk of the data. It is most often defined as any value beyond Q1 − 1.5 × IQR or Q3 + 1.5 × IQR.
Percentile
The value below which a given percentage of the data falls; the 25th, 50th and 75th percentiles are the three quartiles.
Quartile
One of the three cut points (Q1, Q2, Q3) that split sorted data into four groups of equal size.
Range
Maximum minus minimum. It is the simplest measure of spread and the least resistant, since it depends only on the two extreme values.
Resistant measure
A statistic that changes little when extreme values are added or changed. The median and IQR are resistant; the mean and range are not.
Skewed distribution
A lopsided (asymmetric) distribution with a longer tail on one side. Right (positive) skew pulls the mean above the median. Left (negative) skew pulls it below.
Standard deviation
The square root of the variance (σ or s). Roughly, it is how far a typical value sits from the mean, in the original units.
Sum of squares (SS)
Σ(x − x̄)2, the total of the squared deviations; it is the top part of every variance formula.
Variance
The mean of the squared deviations: σ2 = SS / N for a population, and s2 = SS / (n − 1) for a sample. Its units are the original units squared.
Z-score
A standardized value, z = (x − μ) / σ. It gives the number of standard deviations a value lies above or below its mean. It has no units, so it can be compared across distributions.

Check yourself

1. Find the mean, median and mode of: 4, 8, 9, 9, 12, 13, 15.
Mean 10, median 9, mode 9. The sum is 70 and n = 7, so x̄ = 70 / 7 = 10. With seven sorted values, the median is the 4th, which is 9; only the value 9 repeats, so it is the mode.
2. Six salaries (in thousands) are 38, 42, 45, 48, 52 and 275. Work out the mean and median. Say which better describes a typical worker.
Mean = 500 / 6 ≈ 83.3; median = (45 + 48) / 2 = 46.5; the median is the better description. One extreme value drags the mean above five of the six salaries. So the mean no longer describes anyone in the data set. The median is resistant and stays near the bulk of the values.
3. A data set has a mean of 62 and a median of 48. What does that tell you about its shape, and why?
It is right skewed (positively skewed). The mean is above the median because a long right tail of large values pulls the balance point up. The middle by position stays put. When the mean and median are close, the distribution is about symmetric.
4. Why can't you take the mean of a variable like blood type or favorite brand? What should you report instead?
Those are categorical (nominal) variables with no number order, so adding and dividing means nothing. Report the mode. The mode, the most common group, is the only measure of center that works for nominal data.
5. For the sample 48, 49, 50, 51, 52, work out the sum of squares, the sample variance and the sample standard deviation. Show the steps.
SS = 10, s2 = 2.5, s ≈ 1.58. The mean is 250 / 5 = 50. The deviations are −2, −1, 0, +1, +2. Squared, they are 4, 1, 0, 1, 4, which add up to SS = 10. Then s2 = 10 / (5 − 1) = 2.5 and s = √2.5 ≈ 1.58.
6. Treat the same five numbers as a whole population; what are σ2 and σ? Why do they differ from the sample answers?
σ2 = 10 / 5 = 2 and σ = √2 ≈ 1.41. The population formula divides SS by N instead of n − 1. Since n − 1 is smaller, the sample variance is always the larger of the two. That boost (Bessel's correction) makes up for the fact that deviations from the sample mean are steadily too small.
7. Why do we square the deviations before averaging them, instead of just averaging (x − x̄) directly?
Because the deviations from the mean always add up to exactly zero. So their average is always 0 and tells you nothing. Squaring makes every term zero or more, so they cannot cancel. It also weights large gaps more than small ones. The square root at the end brings the answer back to the original units.
8. For the sorted data 3, 7, 8, 12, 13, 14, 18, 21, 22, 26, 31, 58, give the five-number summary and the IQR.
Min 3, Q1 = 10, median = 16, Q3 = 24, max 58; IQR = 14. With n = 12, the median is (14 + 18) / 2 = 16. The lower half, 3, 7, 8, 12, 13, 14, has median (8 + 12) / 2 = 10 = Q1. The upper half, 18, 21, 22, 26, 31, 58, has median (22 + 26) / 2 = 24 = Q3. IQR = 24 − 10 = 14.
9. Use that same data set with the 1.5 × IQR rule. Which values are flagged, and where do the whiskers of the boxplot end?
Only 58 is flagged; the whiskers run from 3 to 31. 1.5 × IQR = 1.5 × 14 = 21. So the lower fence is 10 − 21 = −11, and the upper fence is 24 + 21 = 45. Every value except 58 lies inside the fences. So the whiskers stop at the smallest and largest values that are not outliers, 3 and 31. And 58 is plotted as a single point.
10. You scored 82 on Exam A (mean 75, SD 5) and 88 on Exam B (mean 80, SD 10). Which was the stronger result compared with the class? Show the z-scores.
Exam A, with z = +1.40 versus z = +0.80 on Exam B. For A, z = (82 − 75) / 5 = 1.40. For B, z = (88 − 80) / 10 = 0.80. The 82 sits farther above its own mean in standard deviation units, even though the raw score is lower. Exam B was just easier and more spread out.
11. A bell shaped variable has μ = 100 and σ = 15; what interval holds about 95% of values? About what percentage of values are above 130?
About 95% lie between 70 and 130. About 2.5% are above 130. Two standard deviations is 2 × 15 = 30. That gives 100 ± 30 = 70 to 130. By symmetry, the other 5% is split evenly between the two tails, so about 2.5% falls above 130. (Strictly, exactly 95% matches μ ± 1.96σ.)
12. Processing times are strongly right skewed with μ = 200 s and σ = 20 s. What can you say about the share of jobs finishing between 140 and 260 seconds? Why can't you use the empirical rule?
By Chebyshev's theorem, at least 88.9% of jobs fall in that window. The interval reaches 60 s on each side, and 60 / 20 = 3. So k = 3, and the minimum you can count on is 1 − 1/32 = 1 − 0.111 = 0.889. The empirical rule is off limits because it needs a bell shape, and these data are strongly skewed. Note that Chebyshev gives a floor, not an estimate; the true share could be quite a bit higher.
Statistics Easy Read · Chapter 5

Probability Basics

Everything in the second half of statistics rests on one idea: if you repeated this process forever, how often would that happen? That is all probability is, a way of keeping the books for the long run. It is also the place where many people who are confident elsewhere quietly decide that math is not for them. Most often, that is because someone showed them a formula before showing them what it counts. This chapter goes the other way. We will count first and name the rules second, and we will work out every rule with math you can check on your fingers. By the end, you will be able to read a probability off a table, off a tree and off a sentence. Just as important, you will spot the three or four ways people get probability wrong in print every single day.

By the end of this chapter you can

  • Define a random process, an outcome, a sample space and an event, and list a sample space correctly.
  • Work out a probability for equally likely outcomes and use the complement rule.
  • State what a probability means, a long run relative frequency, and explain the law of large numbers.
  • Use the general addition rule and see when events are mutually exclusive.
  • Use the general multiplication rule and test whether two events are independent.
  • Use the complement of "none" to solve "at least one" problems.
  • Work out a conditional probability, read it correctly and explain why P(A|B) is not P(B|A).
  • Read joint, marginal and conditional probabilities off a two-way table, and build the matching tree diagram.

Section 1What probability is

The possible outcomes of flipping coins, laid out as a sample space
Reference. The outcomes of coin flips laid out in full. The complete list of what can happen is the sample space. Source and license: see the figure credits

Random processes, outcomes, and the sample space

A random process is any situation where you know the list of things that could happen but not which one will happen this time. Examples are a coin flip, a die roll, a customer who either renews a subscription or does not, and a machine part that either fails this month or does not. Each single thing that could happen is an outcome. The complete list of all possible outcomes, with no overlap and nothing left out, is the sample space, written S.

Listing the sample space is the most underrated skill in this chapter, because once you have it, most beginner problems become counting problems. Flip a coin twice, and the sample space is S = {HH, HT, TH, TT}. That is four outcomes, not three. People often write three, thinking "two heads, two tails, or one of each." That is a mistake worth making once and never again. HT and TH are truly different outcomes of the process, and merging them will quietly spoil every probability you work out afterward.

An event is any set of outcomes you care to name, which makes it a subset of the sample space. "At least one head" is the event {HH, HT, TH}, and "both flips match" is {HH, TT}. An event can hold one outcome, many outcomes, all of them (that is S itself) or none of them (the impossible event). We name events with capital letters, such as A and B.

The basic probability formula

Say every outcome in the sample space is equally likely, as with a fair coin, a fair die, a well shuffled deck or a name drawn blindly from a hat. Then probability is pure counting:

P(A) = (number of outcomes in A) ÷ (total number of outcomes in S)

The phrase equally likely carries the weight here. The formula is not a definition of probability. It is a shortcut that works only when the outcomes really can be swapped for one another. A weighted die, a survey where some people are more likely to reply and a deck someone has stacked all fail this test. For those, we get probabilities some other way: from data, from a model or from a longer record.

Three facts follow at once and are worth memorizing, because they are the sanity checks you will run on every answer for the rest of the book:

Worked example: rolling two fair dice

Roll a red die and a blue die. The trick is to keep them apart in your mind. Each of the 6 red faces can pair with each of the 6 blue faces, so S holds 6 × 6 = 36 equally likely outcomes, written as ordered pairs like (3, 5).

What is P(sum = 7)? Count the pairs that add up to 7: (1,6), (2,5), (3,4), (4,3), (5,2) and (6,1). That is 6 outcomes.

P(sum = 7) = 6 ÷ 36 = 1/6 ≈ 0.167

What is P(sum ≥ 10)? A sum of 10 comes from (4,6), (5,5) and (6,4), which is 3 outcomes. A sum of 11 comes from (5,6) and (6,5), which is 2 outcomes. A sum of 12 comes from (6,6), which is 1 outcome. The total is 3 + 2 + 1 = 6 outcomes, so P(sum ≥ 10) = 6/36 = 1/6 ≈ 0.167 as well.

What is P(sum is not 7)? Instead of counting 30 pairs, use the complement rule: P(not 7) = 1 − 1/6 = 5/6 ≈ 0.833. Whenever the event you want is messy and its opposite is tidy, flip to the complement.

SumWays it can happenProbabilityDecimal
211/360.028
322/360.056
433/360.083
544/360.111
655/360.139
766/360.167
855/360.139
944/360.111
1033/360.083
1122/360.056
1211/360.028
Total3636/361.000

Notice the last row. The probabilities of a complete list of outcomes that do not overlap always add up to exactly 1. That is not luck; it is P(S) = 1 showing up in a table. If your column does not add up to 1, you have either counted an outcome twice or lost one.

What a probability actually means

Saying P(sum = 7) = 0.167 does not promise you a seven in the next six rolls. It is a statement about the long run. If you rolled these dice ten thousand times, about 16.7% of the rolls would total seven, and the more you rolled, the closer that percentage would sit to 16.7%. This is the law of large numbers: the share of trials in which an event happens settles toward its true probability (converges) as the number of trials grows.

What the law of large numbers does not say is that the process "corrects" itself. Ten tails in a row do not make heads more likely on the eleventh flip, because the coin has no memory and P(heads) is still 0.5. The long run share drifts back toward 0.5 for another reason. Future flips do not make up the gap. Instead, ten flips is a tiny share of ten thousand, so the early surplus gets watered down, not paid back.

The gambler's fallacy is a misunderstanding of the long run. "It's due" is the belief that a random process owes you a correction. It does not. A fair coin that has landed tails ten times running is still a fair coin, and the eleventh flip is still 0.5. The same error wears a suit in other settings, as in "we've had three good quarters, so a bad one is overdue." If the trials are truly independent, the past tells you nothing about the next one.
Interactive Lay out every outcome of dice and coin experiments, mark the ones an event contains, and read the probability straight off the count, then roll it thousands of times and watch the observed proportion close in on the arithmetic. Open full ↑
Key points
  • The sample space S is the complete list of outcomes, with no overlap. An event is any subset of it.
  • For equally likely outcomes, P(A) = (outcomes in A) ÷ (outcomes in S).
  • Always 0 ≤ P(A) ≤ 1, P(S) = 1 and P(Ac) = 1 − P(A).
  • A probability is a long run relative frequency, not a promise about the next trial. Nothing is ever "due."

Section 2The addition rule

Venn diagram showing events dividing a sample space into regions
Reference. A Venn diagram of events inside a sample space. It is the picture that makes the addition rule obvious. Source and license: see the figure credits

"Or" means at least one of them

In everyday speech, "or" often means just one: "soup or salad" means pick one. In statistics, "or" always includes both (it is inclusive). The event "A or B" (the union, written A ∪ B) happens if A happens, if B happens or if both happen. Meanwhile, "A and B" (the intersection, A ∩ B) happens only when both occur together. Pin these two words down now, because every rule in this chapter is a sentence about one or the other.

The general addition rule is:

P(A or B) = P(A) + P(B) − P(A and B)

Why subtract? Draw two circles that overlap. When you add the area of circle A to the area of circle B, the lens shaped overlap gets counted twice, once inside each circle. Subtracting P(A and B) removes the extra copy. That is the whole content of the rule: add the pieces, then pay back the double count.

Mutually exclusive events

Two events are mutually exclusive (also called disjoint) when they cannot both happen on the same trial. In the picture, the circles do not touch. In symbols, P(A and B) = 0, and the moment that term is zero, the fix in the addition rule disappears:

If A and B are mutually exclusive: P(A or B) = P(A) + P(B)

So the "simple" addition rule is not a separate law to memorize. It is the general rule with a zero in it, so learn one formula, not two. Roll a single die. "A 1" and "a 2" are mutually exclusive, since a die cannot land on both at once. So P(1 or 2) = 1/6 + 1/6 = 2/6 = 1/3 ≈ 0.333.

The complement rule from Section 1 is the tidiest special case of all. A and Ac are mutually exclusive, and together they cover the whole sample space. So P(A) + P(Ac) = P(S) = 1, which rearranges to P(Ac) = 1 − P(A).

Worked example: one card from a standard deck

Draw one card from a well shuffled deck of 52 cards. Let H = "the card is a heart" and F = "the card is a face card" (jack, queen or king).

Use the general addition rule:

P(H or F) = 13/52 + 12/52 − 3/52 = 22/52 = 11/26 ≈ 0.423

Check it by brute force. 13 hearts plus the 9 face cards that are not hearts equals 22 cards, and it matches. Had you forgotten to subtract, you would have gotten 25/52 ≈ 0.481. That is wrong by three cards, the very three you counted twice.

RelationshipP(A and B)Rule for P(A or B)Example (one draw or roll)
Mutually exclusive= 0P(A) + P(B)Die shows "a 1" or "a 2" → 1/6 + 1/6 = 1/3
Overlapping> 0P(A) + P(B) − P(A and B)Card is "a heart" or "a face card" → 22/52
Complementary= 0, and union is all of SP(A) + P(Ac) = 1Card "is a heart" or "is not a heart" → 1.000
Mutually exclusive is not the same as independent. This is the most common mix up in the chapter, and the two ideas are close to opposites. Mutually exclusive means the events cannot happen together. Independent (Section 3) means knowing one happened tells you nothing about the other. Say A and B are mutually exclusive and both have a probability above zero. Then learning that A happened tells you a great deal, because it tells you B surely did not. So mutually exclusive events with a probability above zero are always dependent.
Interactive Drag the overlap between two events and an area-true Venn diagram resolves itself to match, while the sum P(A) + P(B) is taken apart to expose the shared outcomes being counted twice, and a live run of seeded draws settles onto the corrected answer and never onto the naive sum. Open full ↑
Key points
  • "A or B" is inclusive: it includes the case where both happen.
  • General addition rule: P(A or B) = P(A) + P(B) − P(A and B). The subtraction fixes the double count.
  • Mutually exclusive (disjoint) means P(A and B) = 0, which shrinks the rule to P(A) + P(B).
  • Mutually exclusive ≠ independent. Disjoint events with a probability above zero are strongly dependent.

Section 3The multiplication rule

Diagram contrasting independent and non-independent probability events
Reference. Independent versus dependent events: whether the first result changes the odds for the second. Source and license: see the figure credits

"And" means both, and both means multiply

Addition answers "or" questions, and multiplication answers "and" questions. The general multiplication rule is:

P(A and B) = P(A) × P(B|A)

Read it as a story in two steps. First A happens. Then, in the world where A has already happened, B happens. The symbol P(B|A) is the conditional probability of B given A, which Section 4 unpacks in detail. For now, read the vertical bar as the word "given" or "assuming."

Independent events

Two events are independent when knowing that one happened does not change the probability of the other. That is, P(B|A) = P(B). Put that into the general rule, and the condition drops out:

If A and B are independent: P(A and B) = P(A) × P(B)

Again, this is one rule with a shortcut, not two rules. And this equation runs both ways. It is the shortcut you use when events are independent, and it is also the test you use to decide whether they are. If P(A and B) equals P(A) × P(B), the events are independent. If it does not, they are dependent.

The most common everyday source of dependence is sampling without replacement. Draw a card, keep it and draw again. The second draw faces a deck of 51 cards, and what is left in it depends on the first card. Now draw a card, put it back, shuffle and draw again. The second draw faces the same 52 card deck as the first, so the draws are independent. It is the same deck and the same question, but a different answer, all because of whether the card went back.

Worked example: two hearts in a row

Without replacement. P(first card is a heart) = 13/52. Given that it was, only 12 hearts remain among 51 cards. So P(second is a heart | first was a heart) = 12/51.

P(both hearts) = (13/52) × (12/51) = (1/4) × (4/17) = 1/17 ≈ 0.0588

With replacement. The first card goes back and the deck is reshuffled, so the second draw faces a fresh deck of 52 cards:

P(both hearts) = (13/52) × (13/52) = (1/4) × (1/4) = 1/16 = 0.0625

Putting the card back raises the answer from 0.0588 to 0.0625. The gap is small here, but it widens fast as the sample grows compared with the population. As a working rule, say you are sampling less than about 10% of a population. Then the dependence is small enough that treating draws as independent is a fair approximation.

The "at least one" trick

Questions that begin "what is the probability of at least one…" are almost always complement problems in disguise. Counting "at least one" means counting one, two, three and so on separately, which is tedious. Counting the opposite, "none at all," takes a single multiplication. So:

P(at least one) = 1 − P(none)

Example. Roll a fair die four times. What is the probability of at least one six? On any single roll, P(not a six) = 5/6. The four rolls are independent, so P(no six in four rolls) = (5/6)4 = 625/1296 ≈ 0.4823. Therefore:

P(at least one six) = 1 − 625/1296 = 671/1296 ≈ 0.518

That is just over a coin flip. Note that the naive guess is wrong: "1/6 per roll, four rolls, so 4/6 ≈ 0.667." You can see why at once. By that logic, eight rolls would give 8/6 = 1.33, which is not a probability. Adding probabilities across repeated trials is the classic beginner error, and multiplying complements is the fix.

SetupIs P(B|A) = P(B)?Rule to useP(two hearts)
With replacementYes: independentP(A) × P(B)(13/52)(13/52) = 0.0625
Without replacementNo: dependentP(A) × P(B|A)(13/52)(12/51) = 0.0588
Two fair coin flipsYes: independentP(A) × P(B)(1/2)(1/2) = 0.25 for two heads
Card is king / card is heartYes: independentP(A) × P(B)(4/52)(13/52) = 1/52 = P(king of hearts)

That last row deserves a second look. On a single draw, "king" and "heart" are independent. P(king) × P(heart) = (1/13)(1/4) = 1/52, and there is exactly 1 king of hearts in 52 cards, so P(king and heart) = 1/52 too. The numbers agree, so the events are independent, even though both describe the very same card. Independence is a statement about probabilities, not about things being physically apart.

Multiplying probabilities that are not independent is how real people go to prison. The classic courtroom error takes several pieces of evidence and multiplies how rare each one is. Then it announces a tiny number that seems impossible. But if the traits are linked (correlated), and traits most often are, then P(B|A) is far bigger than P(B). Then the true joint probability is far bigger than the product. Before you multiply, always ask: does the first event change the odds of the second?
Interactive Draw a chip, then draw another: put the first back and the two draws are independent, keep it out and they are not; a live probability tree, a convergence curve, and a real simulation show the dependence is exactly 1/(N−1) and costs you only spread, never accuracy. Open full ↑
Key points
  • General multiplication rule: P(A and B) = P(A) × P(B|A).
  • Independent means P(B|A) = P(B), which shrinks the rule to P(A) × P(B).
  • P(A and B) = P(A)P(B) is also the test for independence. If the two sides differ, the events are dependent.
  • Sampling without replacement creates dependence. "At least one" problems are solved as 1 − P(none).

Section 4Conditional probability

Diagram illustrating conditional probability as a restricted sample space
Reference. Conditional probability: the given event becomes the new, smaller sample space. Source and license: see the figure credits

Conditioning shrinks the sample space

A conditional probability answers a narrower question. It is not "how likely is A in general" but "how likely is A among the cases where B already happened." Rearranging the multiplication rule gives the definition:

P(A|B) = P(A and B) ÷ P(B),  provided P(B) > 0

The gut sense is worth more than the formula. Conditioning on B throws away every outcome where B did not happen, and it rebuilds the sample space out of what is left. The bottom number (denominator) is no longer "everything"; it is "everything inside B." The top number (numerator) counts the part of that smaller world where A also holds. Whenever you see a vertical bar, ask yourself one question: what is my denominator now?

Worked example: one roll of a fair die

Roll one fair die. Let A = "the roll is a 6" and B = "the roll is even."

With no condition, P(A) = 1/6 ≈ 0.167. Now condition on B. We have P(B) = 3/6 = 1/2 (the faces 2, 4 and 6). And P(A and B) = 1/6, since only the face 6 is both a six and even. So:

P(A|B) = (1/6) ÷ (1/2) = (1/6) × (2/1) = 2/6 = 1/3 ≈ 0.333

Check it by counting instead. Once you are told the roll is even, the live choices are {2, 4, 6}, and just one of those three is a six. That is one out of three. The formula and the counting agree, as they always will.

Now reverse the bar. P(B|A) = P(A and B) ÷ P(A) = (1/6) ÷ (1/6) = 1.000. If the roll is a 6, it is surely even. So P(A|B) = 0.333 while P(B|A) = 1.000. These are not the same number, and they are not the same question.

Question askedIn symbolsDenominator (the "given" world)Value
Roll is a 6P(A){1,2,3,4,5,6}: all six faces1/6 ≈ 0.167
Roll is a 6, given it is evenP(A|B){2,4,6}: three faces1/3 ≈ 0.333
Roll is a 6, given it is oddP(A|Bc){1,3,5}: three faces0/3 = 0.000
Roll is a 6, given it is > 3P(A|C){4,5,6}: three faces1/3 ≈ 0.333
Roll is even, given it is a 6P(B|A){6}: one face1/1 = 1.000

Dependence, independence, and the confusion of the inverse

Conditional probability gives the cleanest definition of independence there is. Events A and B are independent just when P(A|B) = P(A). The condition tells you nothing, so the probability does not budge. They are dependent when P(A|B) ≠ P(A). In the die example, P(A) = 0.167 but P(A|B) = 0.333. So "is a six" and "is even" are dependent, since knowing the roll is even doubles your belief that it is a six.

Compare a single card draw. Let K = "king" and H = "heart." P(K) = 4/52 = 1/13 ≈ 0.0769, and P(K|H) = 1/13 as well, since among the 13 hearts, just one is a king. The condition changed nothing, so K and H are independent. In the same way, P(K and H) = 1/52 = (1/13)(1/4) = P(K)P(H). Both tests always give the same verdict.

The mistake to guard against for the rest of your life is the confusion of the inverse. That means treating P(A|B) as if it were P(B|A), and it shows up everywhere. "Most people who own a private jet are wealthy" is not "most wealthy people own a private jet." "Nearly everyone in the hospital with this condition tested positive" is not "nearly everyone who tests positive has this condition." The two conditional probabilities can differ by orders of magnitude (powers of ten). Which one you need depends entirely on what you already know.

Two famous readings that are conditional probability errors. A p-value is P(data at least this extreme | the null hypothesis is true). It is not the probability that the null hypothesis is true, and it is not the probability that your results were a fluke. Those would need flipping the bar, which the p-value does not allow. In the same way, a 95% confidence interval is a statement about how the method behaves over the long run. If you repeated the study many times, about 95% of the intervals built this way would contain the true parameter. It is not a 95% chance that the parameter sits inside this one interval. The parameter is a fixed number, and this interval either caught it or it did not.
Interactive Build a screening test with live sliders, then condition on a positive result, a negative result, or the disease itself: a probability tree, a re-scaling bar, and a real seeded simulation show the denominator shrinking and the answer moving with it. Open full ↑
Key points
  • P(A|B) = P(A and B) ÷ P(B). Conditioning swaps the denominator for the given event.
  • Independence means P(A|B) = P(A). Dependence means the condition moves the number.
  • P(A|B) ≠ P(B|A) in general. Reversing the bar reverses the question.
  • A p-value is P(data | null true), not P(null true | data). A 95% CI describes the method over the long run, not this one interval.

Section 5Two-way tables and trees

Probability tree diagram for two successive coin tosses
Reference. A probability tree for two tosses in a row. Branches multiply along a path and add across paths. Source and license: see the figure credits

Reading probabilities off a two-way table

A two-way table (or contingency table) sorts a group of people by two categorical variables at once. It is the most useful object in this chapter, because every probability we have defined can be read straight off it. You never need a formula, only the right denominator.

Say 300 job applicants are sorted by whether they hold a professional certification and whether they got a job offer:

Received offerNo offerRow total
Certified9060150
Not certified45105150
Column total135165300

Three kinds of probability live in this table, and they differ only in what you divide by.

Joint probabilities use a single inner cell over the grand total. They give the chance of both things happening together:

Marginal probabilities use a row or column total over the grand total. They look at one variable and ignore the other. They are called marginal because they live in the margins of the table:

Conditional probabilities use a cell over a row or column total, because you have limited the world to one line of the table:

Look hard at the last two lines. P(offer | certified) = 0.600 and P(certified | offer) ≈ 0.667 come from the same cell, 90, but from different denominators. So they are different numbers that answer different questions. That is the confusion of the inverse, made visible.

The table also answers the other rules. Take the addition rule: P(certified or offer) = 0.500 + 0.450 − 0.300 = 0.650. Check it by counting cells: 90 + 60 + 45 = 195, and 195/300 = 0.650. Now take the independence test: P(certified)P(offer) = 0.500 × 0.450 = 0.225, but the actual joint probability is 0.300. Since 0.225 ≠ 0.300, certification and getting an offer are dependent in this group. The conditional probabilities say the same thing more vividly. At 0.600 versus 0.300, certified applicants got offers at twice the rate.

The same data as a tree

A tree diagram takes the same information and lays it out in time. The first set of branches splits on the first variable. Each branch in the second stage is conditional on the branch above it. Two rules govern trees, and they are just the multiplication and addition rules in different clothes:

Here is our applicant data as a tree. The branches in stage 1 are the marginal probabilities of certification. The branches in stage 2 are the conditional probabilities of an offer, given that certification status.

PathStage 1: certificationStage 2: offer, given stage 1Path probabilityCheck against counts
Certified → Offer0.5000.6000.500 × 0.600 = 0.30090/300 = 0.300
Certified → No offer0.5000.4000.500 × 0.400 = 0.20060/300 = 0.200
Not certified → Offer0.5000.3000.500 × 0.300 = 0.15045/300 = 0.150
Not certified → No offer0.5000.7000.500 × 0.700 = 0.350105/300 = 0.350
Total1.000300/300

The path probabilities add up to 1.000, which is your math check. A tree whose ends do not total 1 has an error in it.

Working the tree backwards

Adding across paths gives the law of total probability. To find the overall chance of an offer, collect every path that ends in an offer:

P(offer) = 0.300 + 0.150 = 0.450

That is exactly the marginal 135/300 we read off the table. Written out in full, it is P(offer) = P(cert)P(offer|cert) + P(no cert)P(offer|no cert) = (0.500)(0.600) + (0.500)(0.300) = 0.300 + 0.150 = 0.450.

Now comes the truly useful move: trees let you reverse the conditioning. Say you meet an applicant who got an offer, and you want the probability that they are certified. That is P(certified | offer), which runs the opposite way from the branches you were given. Use the definition of conditional probability. Take the top number from the one path with both features, and take the bottom number from the total you just worked out:

P(certified | offer) = 0.300 ÷ 0.450 = 2/3 ≈ 0.667

That matches 90/135 from the table. This reversal is the whole engine behind Bayes' rule, and you have just done it with nothing but division. The pattern is always the same: the path you care about, divided by all the paths that end the same way.

Whenever a percentage confuses you, ask "percent of what?" "Sixty percent of certified applicants got offers" and "sixty seven percent of people with offers were certified" are both true of this table. They sound almost the same, yet they have different denominators and support different conclusions. And note what none of these numbers prove. Certification and offers are associated here, but this table cannot tell you that certification caused the offers. The certified group may differ in experience, field or drive. Association is not causation, no matter how clean the math is.
Interactive Read joint, marginal, and conditional probabilities off a live contingency table: set the population with sliders, draw a real seeded sample, then tap any cell and watch the denominator shrink from the whole table to a single row or column. Open full ↑
Key points
  • Joint = cell ÷ grand total. Marginal = row or column total ÷ grand total. Conditional = cell ÷ row or column total.
  • Test independence from a table by comparing P(A and B) with P(A)P(B), or P(A|B) with P(A).
  • In a tree, multiply along a path and add across paths. All the path probabilities must add up to 1.
  • Reverse the conditioning by dividing the path you want by the sum of all paths with that ending. The law of total probability gives the denominator.

The chapter in one breath

  • The sample space is every possible outcome, and an event is a subset of it. For equally likely outcomes, probability is just counting: outcomes in A over outcomes in S.
  • Probabilities live between 0 and 1, add up to 1 over a complete list and mean a long run relative frequency. Nothing is ever "due."
  • The complement rule, P(Ac) = 1 − P(A), turns hard events into easy ones, most of all "at least one."
  • Addition rule: P(A or B) = P(A) + P(B) − P(A and B). The subtraction drops out only when the events are mutually exclusive.
  • Multiplication rule: P(A and B) = P(A) × P(B|A). The condition drops out only when the events are independent.
  • Mutually exclusive ≠ independent. Disjoint events with a probability above zero are in fact strongly dependent.
  • Conditional probability shrinks the denominator to the given event, and P(A|B) is not P(B|A). That error lies behind misread p-values and misread test results alike.
  • Two-way tables and trees hold every one of these rules at once. Joint, marginal and conditional probabilities differ only in what you divide by.

ReferenceWords worth knowing

These are the terms that will keep showing up for the rest of the book. Skim them now, and come back whenever a symbol stops making sense.

Addition rule
P(A or B) = P(A) + P(B) − P(A and B). The subtraction removes outcomes counted twice. It drops out when the events are mutually exclusive.
Complement
The event that A does not happen, written Ac. P(Ac) = 1 − P(A).
Conditional probability
The probability of A given that B has happened: P(A|B) = P(A and B) ÷ P(B). Conditioning swaps the denominator for the given event.
Contingency table (two-way table)
A table that sorts people by two categorical variables, with row, column and grand totals. Joint, marginal and conditional probabilities can all be read from it.
Dependent events
Events for which P(A|B) ≠ P(A). Knowing one happened changes the probability of the other.
Disjoint events
Another name for mutually exclusive events. They cannot both happen on the same trial, so P(A and B) = 0.
Event
Any set of outcomes from the sample space, most often named with a capital letter.
Independent events
Events for which P(A|B) = P(A), or in the same way P(A and B) = P(A)P(B). Knowing one tells you nothing about the other.
Intersection
The event that both A and B happen, written A ∩ B or "A and B."
Joint probability
The probability that two events happen together, P(A and B). On a two-way table, it is a single inner cell divided by the grand total.
Law of large numbers
As the number of independent trials grows, the share of trials in which an event happens settles toward its true probability. It does not mean that a process makes up for past imbalances.
Law of total probability
Breaking an event into mutually exclusive cases and adding them: P(B) = P(A)P(B|A) + P(Ac)P(B|Ac). On a tree, it is adding across all paths that end the same way.
Marginal probability
The probability of one event, ignoring the other, P(A). On a two-way table, it is a row or column total divided by the grand total.
Multiplication rule
P(A and B) = P(A) × P(B|A). It shrinks to P(A) × P(B) when the events are independent.
Mutually exclusive
Events that cannot happen on the same trial, so P(A and B) = 0. This is not the same as independent; in spirit, it is the opposite.
Outcome
A single possible result of one run of a random process.
Probability
A number between 0 and 1 that gives the long run relative frequency with which an event happens.
Random process
A situation whose set of possible outcomes is known, but whose result this time is not settled ahead of time.
Replacement (with and without)
Whether a picked item is put back before the next pick. With replacement, the draws are independent. Without replacement, they are dependent.
Sample space
The complete list of all possible outcomes of a random process, with no overlap, written S. All its probabilities add up to 1.
Tree diagram
A picture of a random process in stages, where you multiply probabilities along a path and add across paths. Branches in the second stage are conditional on the first.
Union
The event that A happens, B happens or both, written A ∪ B or "A or B." In statistics, "or" always includes both.

Check yourself

1. Define the sample space. Then list it for the process "flip a fair coin twice." How many outcomes are there, and what is the most common wrong answer?
The sample space is the complete list of possible outcomes, with no overlap: S = {HH, HT, TH, TT}, so there are 4 outcomes. The common error is answering 3 by merging HT and TH into "one of each." They are different outcomes of the process. Merging them makes "one head, one tail" look like 1/3 instead of its true 2/4 = 0.500.
2. A fair six sided die is rolled once. Find P(the roll is greater than 4), and state the rule you used.
P = 2/6 = 1/3 ≈ 0.333. The outcomes greater than 4 are {5, 6}. That is 2 outcomes that count, out of 6 equally likely ones. This is the basic formula P(A) = (outcomes in A) ÷ (outcomes in S).
3. Two fair dice are rolled. Show the work for P(sum = 7) and P(sum = 2). Why are these different when each sum is "one number"?
P(sum = 7) = 6/36 = 1/6 ≈ 0.167; P(sum = 2) = 1/36 ≈ 0.028. The sample space has 36 equally likely ordered pairs. Seven can be made six ways, (1,6), (2,5), (3,4), (4,3), (5,2) and (6,1), while two can be made only one way, (1,1). The equally likely units are the pairs, not the sums.
4. A fair coin is flipped three times. Find P(at least one head) without listing all eight outcomes.
P(at least one head) = 1 − (1/2)3 = 1 − 1/8 = 7/8 = 0.875. The complement of "at least one head" is "no heads at all," that is, TTT. Its probability is (1/2)(1/2)(1/2) = 1/8, because the flips are independent. Subtract that from 1.
5. One card is drawn from a standard deck of 52 cards. Work out P(heart or face card), showing every term.
P = 13/52 + 12/52 − 3/52 = 22/52 = 11/26 ≈ 0.423. There are 13 hearts and 12 face cards, but 3 cards (the jack, queen and king of hearts) are both. They were counted twice, so they must be subtracted once. Forgetting the subtraction gives 25/52 ≈ 0.481, which overcounts by just those 3 cards.
6. Are "the card is a heart" and "the card is a face card" mutually exclusive? Are "the card is a heart" and "the card is a spade"?
Heart and face card are not mutually exclusive, since 3 cards are both, so P(A and B) = 3/52 ≠ 0. Heart and spade are mutually exclusive, because no card has two suits, so P(A and B) = 0. For the second pair, the addition rule shrinks to 13/52 + 13/52 = 26/52 = 0.500.
7. Explain the difference between "mutually exclusive" and "independent." Can two events with a probability above zero be both?
Mutually exclusive means they cannot happen together: P(A and B) = 0. Independent means knowing one happened does not change the other's probability: P(A|B) = P(A). No, with probabilities above zero they cannot be both. If they are disjoint, then P(A|B) = 0, which cannot equal P(A) when P(A) > 0. Being disjoint is a very strong form of dependence, because learning that B happened tells you A surely did not.
8. Two cards are drawn without replacement. Find P(both are aces), and compare it with the answer if the first card were put back.
Without replacement: (4/52) × (3/51) = (1/13)(1/17) = 1/221 ≈ 0.00452. With replacement: (4/52) × (4/52) = (1/13)2 = 1/169 ≈ 0.00592. Without replacement, the second draw is conditional, since only 3 aces remain in 51 cards. So use P(A) × P(B|A). With replacement, the draws are independent, so use P(A) × P(B).
9. A fair die is rolled four times. Find P(at least one six). Why is "4 × 1/6" wrong?
P(at least one six) = 1 − (5/6)4 = 1 − 625/1296 = 671/1296 ≈ 0.518. Each roll has P(no six) = 5/6, and the rolls are independent. So P(no six at all) = (5/6)4 ≈ 0.482. Adding 1/6 per roll is wrong because it counts twice the rolls where more than one six turns up. It also breaks in plain sight at eight rolls, where it would give 8/6 = 1.33, an impossible probability.
10. Roll one fair die. Let A = "a 6" and B = "even." Work out P(A|B) and P(B|A), and explain why they differ.
P(A|B) = (1/6) ÷ (1/2) = 1/3 ≈ 0.333; P(B|A) = (1/6) ÷ (1/6) = 1.000. They differ because they have different denominators. Given "even," the live outcomes are {2, 4, 6}, and one of the three is a six. Given "a 6," the only live outcome is 6, which is surely even. Reversing the bar reverses the question; this is the confusion of the inverse.
11. Use the chapter's table of 300 applicants (certified: 90 offers, 60 none; not certified: 45 offers, 105 none). Find P(offer | not certified) and P(not certified | no offer). Then decide whether the two variables are independent.
P(offer | not certified) = 45/150 = 0.300. P(not certified | no offer) = 105/165 ≈ 0.636. They are not independent. Here is the independence test. P(certified)P(offer) = 0.500 × 0.450 = 0.225, but the observed joint probability is 90/300 = 0.300, and 0.225 ≠ 0.300. Put another way, P(offer | certified) = 0.600 while P(offer) = 0.450, so the condition moved the number. Note that the link does not by itself prove that certification caused the offers.
12. A coworker reads a study with p = 0.03 and says, "So there is only a 3% chance the null hypothesis is true, and a 95% chance the true value is inside their confidence interval." Correct both statements.
Both reverse the conditioning. A p-value is P(data at least this extreme | the null hypothesis is true), not P(null is true | data). And a 95% confidence interval describes how the method performs over the long run: about 95% of intervals built this way would catch the true parameter. A single interval either contains the fixed parameter or it does not, and no 95% chance is attached to that one interval. Both errors are the same mistake as treating P(A|B) as P(B|A).
Statistics Easy Read · Chapter 6

Discrete Random Variables

Up to now, probability has been about single events: one card, one coin, one roll. This chapter takes the next step. Instead of asking about one outcome, we describe every outcome at once, with a number attached to each and a probability attached to each number. That package is called a probability distribution. Once you have one, you can answer almost anything: how likely a result is, what to expect on average and how far from average things most often wander. Three famous distributions do a huge amount of the work in real life. By the end of this chapter, you will be able to tell which one fits a situation and work with it. None of this needs clever tricks. It needs a table, a formula and the patience to work one line at a time.

By the end of this chapter you can

  • Define a random variable, and use the symbols X (the variable) and x (a value it takes).
  • Sort a random variable as discrete or continuous, and defend the choice.
  • State the two requirements of a valid probability distribution, and test a table against them.
  • Work out the chances of events such as "at least," "at most" and "more than" from a distribution table.
  • Work out the mean (μ), variance (σ2) and standard deviation (σ) of a discrete random variable, and read μ as a long run average.
  • State the four requirements of a binomial experiment, and use the binomial probability formula.
  • Use μ = np and σ = √(npq) for a binomial, and judge whether a result is unusual.
  • Tell when the Poisson or geometric distribution applies, and work out probabilities from each.

Section 1Random variables

Diagram showing a random variable as a function that assigns a number to each outcome in a sample space
Reference. A random variable is a rule that attaches a number to every outcome in the sample space. Wikimedia Commons contributors, open license. Source and license: see the figure credits

From outcome to number

A random variable is a variable whose value is a number set by the outcome of a chance process. That is the whole definition, and it is worth reading twice, because two plain words are doing exact work. Number means the result must be numeric. So if the raw outcome is "heads" or "defective," we have to turn it into a number by counting the heads or the defects. Random means we do not know ahead of time which value will occur, though we may know how likely each one is.

Statisticians use a small habit with symbols that pays off at once. A capital letter, most often X, names the random variable itself, the amount we do not know yet. A lowercase letter, x, names one value it might take. So "X = the number of heads in three coin flips" defines the variable, and "x = 2" is one of its possible values. The expression P(X = x) then reads, in plain English, "the probability that the random variable turns out to equal this exact number." Keep the capital and lowercase letters straight, and every formula in this chapter becomes readable.

Discrete: you can count the values

A random variable is discrete if its possible values can be listed, first value, second value, third value and so on, with nothing squeezed in between. Counts are the classic case, such as the number of students absent, the number of faulty units in a shipment or the number of calls coming in during an hour. You can have 3 absences or 4 absences, but never 3.6.

A common misreading is that "discrete" means "only a few values." It does not. A discrete random variable may have infinitely many possible values, as long as they can be counted off in order. The number of calls coming in to a help desk in an hour could in theory be 0, 1, 2, 3 and onward forever. That list never ends, but it is still a list, so the variable is discrete. What matters is whether you can count the values, not how many there are.

Continuous: you can only measure them

A random variable is continuous if it can take any value in a range, so that between any two possible values there is always another. Measurements behave this way: height, weight, time passed, temperature and blood pressure. Between 70.1 kg and 70.2 kg lies 70.15 kg, and between those lies 70.125 kg, without end.

The practical test is not "does the number have decimals?" but "was it counted or measured?" A reported time of 12.4 seconds looks like a decimal because our stopwatch stops there, but the amount underneath is continuous. The rounding is a limit of the tool, not a trait of the variable. On the other hand, a dollar amount of $4.75 is strictly discrete, since money comes in cents. Yet money is most often treated as continuous because the steps are so fine. Both facts can be true at once. The math label is exact, and the modeling choice is a judgment call.

Random variableCounted or measured?Possible valuesType
Number of heads in 3 flipsCounted0, 1, 2, 3Discrete (finite)
Number of emails received todayCounted0, 1, 2, 3, …Discrete (infinite but countable)
Number of cars in a householdCounted0, 1, 2, 3, …Discrete
Time to finish an examMeasuredAny value in (0, 120] minutesContinuous
Weight of a cereal boxMeasuredAny value near 500 gContinuous
Body temperatureMeasuredAny value in a rangeContinuous
Why the difference matters. For a discrete variable, P(X = 2) is a real number, most often above zero, that you can look up in a table. For a continuous variable, P(X = 70.000… kg) is zero. The possible values fill a range and cannot be listed, so probability is spread thinly (as density) over ranges instead of piled on any single point. Note that this is not just because there are infinitely many values. The number of emails in a day can be 0, 1, 2, 3 and so on without end, and every one of those values still has a real probability above zero. With continuous variables, we can only ask about ranges (intervals), such as P(69.5 < X < 70.5). That is why this chapter uses tables and formulas, and why the next one uses areas under a curve.
Interactive Sample ten random variables and record each at finer and finer precision: the counts run out of new values while the measurements never do, and the chance of any one exact value collapses to zero as the chance of landing in an interval settles down. Open full ↑
Key points
  • A random variable gives a number to each outcome of a chance process. X is the variable, and x is a value.
  • Discrete = values can be listed (most often counts). Continuous = values fill a range (most often measurements).
  • Discrete does not mean "few." The list 0, 1, 2, 3, … going on forever is still discrete.
  • For continuous variables, the probability of any single exact value is 0, so we ask about ranges instead.

Section 2Probability distributions

Bar chart of a symmetric discrete probability distribution, with the height of each bar giving the probability of that value
Reference. A discrete probability distribution drawn as bars. Each bar's height is P(x), and the heights total 1. Wikimedia Commons contributors, open license. Source and license: see the figure credits

The two rules

A probability distribution lists every possible value of a discrete random variable together with the probability of each. It can be written as a table or a formula, or drawn as a probability histogram whose bar heights are the probabilities. Whatever the format, a distribution is valid only if it meets just two requirements. These two are not random rules to memorize, because each one restates something you already believe about probability.

Requirement 1: ΣP(x) = 1. The probabilities of all the values must add up to exactly 1. This says the list is complete: something has to happen, and every "something" is on the list. (In practice, allow for rounding. A table of values rounded to three decimals may total 0.999 or 1.001, and that is fine.)

Requirement 2: 0 ≤ P(x) ≤ 1 for every value x. Each single probability must be a real probability, never below zero and never above 1. One 1.4 or −0.05 anywhere in the table kills it, no matter what the total comes to.

A table fails if it breaks either rule. Say someone offers P(0) = 0.30, P(1) = 0.45 and P(2) = 0.15. The single values are all fine, but they add up to 0.90, so 10% of the probability has gone missing and some outcome was left off the list. Now say P(0) = 0.60, P(1) = 0.55 and P(2) = −0.15. These do add up to 1.00, but a negative probability means nothing, so this table is not valid either.

Reading probabilities off a distribution

Let X be the number of heads in three flips of a fair coin. The eight equally likely outcomes are HHH, HHT, HTH, THH, HTT, THT, TTH and TTT. Counting the heads in each gives the distribution below. Because each of the eight outcomes has probability 1/8, the probabilities are just counts out of 8.

x (heads)OutcomesP(x) as a fractionP(x) as a decimal
0TTT1/80.125
1HTT, THT, TTH3/80.375
2HHT, HTH, THH3/80.375
3HHH1/80.125
Total8 outcomes8/8 = 11.000

Check the two rules. Every probability sits between 0 and 1, and the total is exactly 1, so it is valid. Now the payoff: once you have a distribution, combined events are just addition, because the values are mutually exclusive.

"At most 1 head" means X = 0 or X = 1, so P(X ≤ 1) = 0.125 + 0.375 = 0.500.
"At least 2 heads" means X = 2 or X = 3, so P(X ≥ 2) = 0.375 + 0.125 = 0.500.
"At least 1 head" would mean adding 0.375 + 0.375 + 0.125 = 0.875, but the complement is faster: P(X ≥ 1) = 1 − P(X = 0) = 1 − 0.125 = 0.875. It is the same answer with one subtraction.

That complement trick is worth building into your habits. Whenever a question says "at least one," work out 1 − P(none). With three values, it saves a little effort; with a binomial of 40 trials, it saves you from adding forty terms.

Filling in a missing probability

Because the probabilities must total 1, one missing entry can always be found. Say X is the number of roommates a student picked at random has. A survey reports P(0) = 0.15, P(1) = 0.30, P(2) = k and P(3) = 0.25, with no other values possible. Then:

0.15 + 0.30 + k + 0.25 = 1
0.70 + k = 1
k = 1 − 0.70 = 0.30

Always finish by checking that the value you found is itself a real probability. Here 0.30 lies between 0 and 1, so the completed table is valid. If the algebra had given −0.10, that would not mean "probability can be negative." It would mean the reported numbers were wrong.

The histogram is the distribution. A probability histogram plots the values x along the bottom and P(x) as bar heights. Because the probabilities add up to 1, the bars together cover exactly 100% of what can happen. That is why, in the next chapter, "probability" becomes "area under a curve." The idea does not change; only the picture does.
Interactive Set each probability with a slider and watch the total re-compute live as both requirements are tested, every entry between 0 and 1, and the entries summing to exactly 1, with candidate tables that pass one test while failing the other, and real seeded sampling from the ones that qualify. Open full ↑
Key points
  • A probability distribution pairs every possible value of a discrete random variable with its probability.
  • Rule 1: ΣP(x) = 1 (allowing for rounding). Rule 2: 0 ≤ P(x) ≤ 1 for every x. Both must hold.
  • Combined events are found by adding the probabilities of the values they include.
  • For "at least one," use the complement: P(X ≥ 1) = 1 − P(X = 0).

Section 3Expected value

A distribution with its population mean and standard deviation marked on the horizontal axis
Reference. A distribution with its mean μ marked at the center and the standard deviation σ measuring typical spread. OpenIntro Statistics, open license. Source and license: see the figure credits

The mean of a random variable is a weighted average

The mean of a discrete random variable is written μ and is also called the expected value E(X). It answers this question: if this chance process were repeated over and over, what would the average result settle down to? The formula is short:

μ = E(X) = Σ [ x · P(x) ]

Read it as a set of orders: multiply each value by its probability, then add up those products. It is an average weighted by how likely each value is. Values that happen often pull the mean toward themselves, and values that happen rarely barely move it. Notice we do not divide by anything at the end. The dividing is already built in, because the weights P(x) add up to 1.

Let X be the number of pets in a household picked at random, with the distribution P(0) = 0.40, P(1) = 0.30, P(2) = 0.20 and P(3) = 0.10. (Check: 0.40 + 0.30 + 0.20 + 0.10 = 1.00, and every entry is between 0 and 1, so it is valid.) Then:

μ = (0)(0.40) + (1)(0.30) + (2)(0.20) + (3)(0.10)
μ = 0 + 0.30 + 0.40 + 0.30
μ = 1.0 pet

Now the meaning, which is where people most often go wrong. The expected value is not a prediction about the next household, and it need not even be a possible value. Say the distribution had come out to μ = 1.3 pets. No household would ever own 1.3 pets, yet the number still describes what the average comes close to across many, many households. Expected value is a statement about the long run, not about any single trial. That is the law of large numbers. It is the whole reason insurers and casinos can plan a year ahead while having no idea what happens tonight.

Variance and standard deviation

The mean tells you where the distribution sits, but it says nothing about how tightly the values cluster around it. That job belongs to the variance σ2 and the standard deviation σ. The formula that defines it measures the average squared distance from the mean, again weighted by probability:

σ2 = Σ [ (x − μ)2 · P(x) ]   and   σ = √(σ2)

There is a shortcut that gives the same result by algebra and is far easier to work out, because it never asks you to subtract the mean inside the sum:

σ2 = Σ [ x2 · P(x) ] − μ2

Both give the same answer, so use whichever you find clearer. Here is the pet example carried all the way through in one table. Build the columns from left to right, and the math takes care of itself.

xP(x)x · P(x)x2x2 · P(x)(x − μ)2 · P(x)
00.400.0000.00(0−1)2(0.40) = 0.40
10.300.3010.30(1−1)2(0.30) = 0.00
20.200.4040.80(2−1)2(0.20) = 0.20
30.100.3090.90(3−1)2(0.10) = 0.40
Totals1.00μ = 1.00-2.00σ2 = 1.00

By the shortcut: σ2 = 2.00 − (1.00)2 = 2.00 − 1.00 = 1.00. By the definition, the last column also totals 1.00. The two agree, as they must. Then σ = √1.00 = 1.0 pet.

Units matter here. The variance came out in "squared pets," which means nothing to anyone. That is just why we take the square root: σ is back in the original units and can be read as "a typical distance from the mean." So households average 1.0 pet, and a typical household differs from that average by about 1.0 pet.

A rough but useful habit, the range rule of thumb, treats values more than two standard deviations from the mean as unusual. Here that boundary is μ ± 2σ = 1.0 ± 2.0, a range from −1.0 to 3.0 pets. No possible value falls outside it, and 3 sits exactly on the upper edge. So nothing in this distribution counts as unusual. That fits, since a household with 3 pets is uncommon but not startling.

Expected value as a decision tool

Expected value earns its name in cases that involve money. There, it tells you what a repeated bet, policy or purchase is worth per play. Say a club sells 500 raffle tickets at $3 each, with one $1,000 prize. What is the expected value of buying one ticket?

Define X as your net gain, which means the $3 you paid is subtracted in both branches. If you win, you gain 1000 − 3 = $997, and that happens with probability 1/500. If you lose, you gain −$3, with probability 499/500.

E(X) = (997)(1/500) + (−3)(499/500)
E(X) = 997/500 − 1497/500
E(X) = −500/500 = −$1.00

The meaning is exact and a little deflating. You cannot lose exactly $1 on this raffle, because you will either be up $997 or down $3. But if you bought a ticket in this same raffle over and over, your average result would settle near a loss of $1.00 per ticket. The club's side of the same math is the mirror image. It collects $3 per ticket and pays out $1,000 spread over 500 tickets, or $2 per ticket. So it clears an average net of $1.00 per ticket, which is exactly what the buyer loses. (Note that $1.00 is the club's net per ticket, not its revenue; the revenue is the full $3.) That balance is how the fundraiser was planned in the first place.

"Expected" is a technical word, not an everyday one. The expected value is what the average settles toward over many repeats. It is not what you should expect to happen next, and it is often a value that cannot occur at all (1.3 pets, or −$1.00 on a raffle). Say "the long run average is …" out loud when you read μ, and you will never misstate it.
Interactive Compute E(X) = Σ x·P(x) line by line for seven real games, change the price or the prizes and watch the answer move, then play thousands of simulated rounds and watch the running average settle onto the number the formula predicted. Open full ↑
Key points
  • μ = E(X) = Σ[x · P(x)]. It is an average weighted by probability, so no division is needed at the end.
  • σ2 = Σ[(x − μ)2P(x)] = Σ[x2P(x)] − μ2. Then take σ = √(σ2) to return to the original units.
  • μ describes the long run, not the next trial, and it need not be a value the variable can actually take.
  • By the range rule of thumb, values outside μ ± 2σ count as unusual.

Section 4The binomial distribution

Binomial probabilities drawn as bars, with a smooth curve overlaid for comparison
Reference. Binomial probabilities plotted as bars, with one bar for each possible number of successes from 0 to n. Wikimedia Commons contributors, open license. Source and license: see the figure credits

The four requirements

The binomial distribution is the most heavily used discrete distribution in statistics. That is because a huge number of real questions have the same skeleton: we repeat something a fixed number of times, and we count how often it works. A situation counts as a binomial experiment only if all four of the following hold. Miss one, and the formula in the next part gives a wrong answer.

#RequirementWhat it meansWhat breaks it
1Fixed number of trialsn is decided in advance and does not depend on results"Keep testing until 3 fail": n is not fixed
2Two outcomes per trialEach trial is a success or a failure: nothing elseA five-level rating scale (unless collapsed to two)
3Independent trialsOne trial's result does not change any other's probabilityDrawing cards without replacement
4Constant probability pThe success probability is identical on every trialA test-taker who learns as the quiz goes on

Two habits clear up most confusion. First, "success" is just a label for the outcome you chose to count. It can be a defect, a failure or a death. If you are counting faulty parts, a defect is a "success," and p is the probability of a defect. Second, p is the probability of success on one trial, and q = 1 − p is the probability of failure. And x is the number of successes in the n trials, so x can be any whole number from 0 to n.

The binomial formula

P(X = x) = nCx · px · qn−x   where   nCx = n! / [ x! (n − x)! ]

The formula is three ideas multiplied together, and it stops looking scary once you see them one at a time. The piece px is the probability of getting x successes. The piece qn−x is the probability of the other n − x failures. Multiplying them is allowed just because the trials are independent (requirement 3). But that product is the probability of one exact order, such as success, success, failure, failure. The binomial coefficient nCx counts how many orders give x successes. Since each order has the same probability, we multiply by that count.

Worked example. A quiz has 6 multiple choice questions with 4 choices each. A student guesses on every question. What is the probability of exactly 2 correct?

Check the four requirements. n = 6 is fixed ✓. Each question is right or wrong ✓. Guesses do not affect one another ✓. And p = 1/4 = 0.25 on every question ✓. So n = 6, p = 0.25, q = 0.75 and x = 2.

Step 1, the coefficient: 6C2 = 6! / (2! · 4!) = (6 × 5) / (2 × 1) = 30/2 = 15.
Step 2, the successes: (0.25)2 = 0.0625.
Step 3, the failures: (0.75)4 = 0.31640625.
Step 4, multiply: 15 × 0.0625 × 0.31640625 = 0.9375 × 0.31640625 = 0.2966.

So there is about a 29.7% chance of exactly 2 correct. Running the same formula for every value of x gives the complete distribution:

x correct6Cx(0.25)x(0.75)6−xP(x)
010.1779790.1780
160.0593260.3560
2150.0197750.2966
3200.0065920.1318
4150.0021970.0330
560.0007320.0044
610.0002440.0002
Total--1.0000

The column totals 1.0000, which confirms this is a valid probability distribution. Checking that is a good habit whenever you build a binomial table by hand. Combined questions now work just as in Section 2. "What is the probability of at least 1 correct?" Use the complement: P(X ≥ 1) = 1 − P(0) = 1 − 0.1780 = 0.8220. "At least 4 correct?" Add the tail: 0.0330 + 0.0044 + 0.0002 = 0.0376, which is under 4%.

Mean and standard deviation of a binomial

You could find μ and σ by running the Section 3 steps on all seven rows. But for a binomial there are shortcuts, and they are exact, not approximations:

μ = np    σ2 = npq    σ = √(npq)

For the guessing student: μ = np = (6)(0.25) = 1.5 correct. That makes sense: guess on 6 questions with a 1 in 4 chance each, and you average one and a half. And σ = √[(6)(0.25)(0.75)] = √1.125 = 1.06 correct.

Use the range rule of thumb: μ ± 2σ = 1.5 ± 2.12, a range from −0.62 to 3.62. Scores of 0, 1, 2 or 3 are ordinary for a guesser, and a score of 4 or more is unusual. That verdict matches the exact tail probability we just worked out, P(X ≥ 4) = 0.0376. The rule of thumb and the exact math agree, which is the point of having both: the rule is quick, and the math is exact.

The 5% rule for sampling without replacement. Strictly, drawing 20 people from a town of 40,000 without putting them back breaks independence, because each draw changes the pool a little. In practice, if the sample is no more than 5% of the population, the change is tiny and the binomial is used anyway. That is why polling of a large population is treated as binomial. Drawing 3 cards from a deck of 52 is not, since that is nearly 6% of the deck and the probabilities shift sharply.
Interactive Drag n and p and watch the binomial distribution reshape in real time, with exact probabilities and worked formulas, cumulative "at most / at least" tails, a normal-curve overlay, and a live simulation whose bars converge onto the theory. Open full ↑
Key points
  • A binomial experiment needs all four: fixed n, two outcomes, independent trials and constant p.
  • P(X = x) = nCx px qn−x: number of orders × successes × failures.
  • "Success" is only a label for whatever you are counting, and p must match that label.
  • μ = np and σ = √(npq). Sampling under 5% of a population may be treated as binomial.

Section 5Other discrete distributions

Poisson probability distribution plotted as bars showing the probability of each count
Reference. A Poisson distribution: the probability of seeing 0, 1, 2, … events in a fixed interval when events arrive at a steady average rate. Wikimedia Commons contributors, open license. Source and license: see the figure credits

The Poisson distribution

The binomial needs a fixed number of trials. But many real counts have no trials to fix. Think of calls coming in to a help desk in an hour, typos on a page or potholes per kilometer of road. There is no n, because there is no upper limit on how many could occur. For these, the Poisson distribution models the number of events in a fixed stretch of time, area, volume or distance, given a known average rate.

P(X = x) = ( λx · e−λ ) / x!    for x = 0, 1, 2, 3, …

Here λ (lambda) is the mean number of events per interval, and e ≈ 2.71828 is the natural base. The distribution needs three conditions. The events occur independently, the average rate λ is constant over the interval, and the interval is fixed. It has one striking trait: a single parameter controls everything:

μ = λ    σ2 = λ    σ = √λ

The mean and the variance are the same number. That is a truly useful check. If you have count data whose sample variance is far larger than its mean, the Poisson model is probably wrong for it.

Worked example. A help desk gets an average of 3 calls per hour. What is the probability of exactly 5 calls in a given hour?

Here λ = 3 and x = 5.
Step 1: λx = 35 = 243.
Step 2: e−3 = 0.049787.
Step 3: x! = 5! = 5 × 4 × 3 × 2 × 1 = 120.
Step 4: P(X = 5) = (243 × 0.049787) / 120 = 12.0983 / 120 = 0.1008.

So there is about a 10.1% chance of exactly 5 calls. The chance of a fully quiet hour is P(X = 0) = (30 · e−3)/0! = 0.049787, or about 5%. (Recall that 30 = 1 and 0! = 1.) And the chance of at least one call is the complement: 1 − 0.0498 = 0.9502. The standard deviation is σ = √3 ≈ 1.73 calls.

One more use is worth knowing. Say a binomial has a large n and a small p; a common rule of thumb is n ≥ 100 and np ≤ 10. Then the Poisson with λ = np comes very close to it. This is why Poisson models rare events so well, such as accidents at a crossing, rare defects on a production line and unusual claims filed with an insurer.

The geometric distribution

The geometric distribution flips the binomial question around. A binomial fixes the number of trials and lets the number of successes vary. A geometric fixes the number of successes at exactly one, the first one, and lets the number of trials vary. It answers this: how many tries until the first success?

P(X = x) = qx−1 · p    for x = 1, 2, 3, …

The logic is easy to see. To have the first success on trial x, you need x − 1 failures first (probability qx−1), followed by one success (probability p). There is no coefficient, because only one order works. The requirements are the binomial's, minus the fixed n: independent trials, two outcomes and a constant p. Its mean and standard deviation are:

μ = 1/p    σ2 = q/p2    σ = √q / p

Worked example. A sales rep turns 20% of the calls she makes into sales (conversions), and each call is independent. What is the probability that her first conversion comes on the 4th call?

Here p = 0.20, q = 0.80 and x = 4.
P(X = 4) = (0.80)3 × 0.20 = 0.512 × 0.20 = 0.1024, or about 10.2%.

How many calls does it take on average to get that first conversion? μ = 1/p = 1/0.20 = 5 calls, the reciprocal, just as gut sense suggests. Read that with care: μ counts the successful call itself. So the average number of failed calls before the first conversion is 4, not 5. The spread is σ = √0.80 / 0.20 = 0.894/0.20 = 4.47 calls, which is large compared with the mean; waiting times of this kind are known to vary a lot. And the probability that she needs more than 3 calls is just the probability that the first 3 all fail: P(X > 3) = (0.80)3 = 0.512. So P(X ≤ 3) = 1 − 0.512 = 0.488.

One caution when reading other sources. Some define the geometric variable as the number of failures before the first success. Then it starts at 0 instead of 1 and has a mean of q/p. The math is the same; only the starting point shifts. Always check which version a formula sheet or calculator is using before you plug in numbers.

Choosing among the three

Nearly every discrete problem you meet at this level fits one of these three. The fastest way to tell which is to ask what is fixed and what is random.

DistributionWhat is fixedWhat is randomValues of XMeanVariance
BinomialNumber of trials nNumber of successes0, 1, …, nnpnpq
PoissonThe interval (time, area, …)Number of events0, 1, 2, …λλ
GeometricNumber of successes (one)Number of trials needed1, 2, 3, …1/pq/p2
The coin has no memory. The geometric distribution is memoryless. If the first 9 calls all failed, the probability that the 10th converts is still 0.20, unchanged. Independence means past failures build no credit toward a future success. The belief that a run of bad luck makes success "due" is the gambler's fallacy, and the geometric distribution is where it is most tempting and most wrong.
Interactive Two distributions with no fixed n: drag one parameter and watch the histogram rebuild live, Poisson counting events in a window, geometric counting trials until the first success, with exact probabilities, a decision guide for choosing between them, a live memorylessness check, and a real seeded simulation that converges on the theory. Open full ↑
Key points
  • Poisson: P(x) = λxe−λ/x! counts events in a fixed interval. Uniquely, μ = σ2 = λ.
  • Poisson comes close to a binomial when n is large and p is small, using λ = np.
  • Geometric: P(x) = qx−1p counts trials until the first success, with μ = 1/p.
  • Pick the distribution by asking what is fixed (trials, interval or successes) and what is random.

The chapter in one breath

  • A random variable attaches a number to each outcome of a chance process. It is discrete if its values can be listed (counts) and continuous if they fill a range (measurements).
  • A probability distribution is valid only if ΣP(x) = 1 and 0 ≤ P(x) ≤ 1 for every value. Both rules must hold.
  • Combined events are sums of value probabilities, and "at least one" is fastest as 1 − P(0).
  • The expected value μ = Σ[xP(x)] is an average weighted by probability that describes the long run. It is not the next trial, and it is not always a possible value.
  • Spread comes from σ2 = Σ[x2P(x)] − μ2, with σ = √(σ2) bringing back the original units. Values beyond μ ± 2σ are by habit called unusual.
  • A binomial needs a fixed n, two outcomes, independence and a constant p. Then P(x) = nCxpxqn−x, μ = np and σ = √(npq).
  • The Poisson counts events in a fixed interval, with μ = σ2 = λ. The geometric counts trials until the first success, with μ = 1/p.
  • Choose a model by asking what the problem holds fixed: the trials, the interval or the single success you are waiting for.

ReferenceWords worth knowing

A quick reference for the terms in this chapter. Skim it now, or come back whenever a word trips you up.

Bernoulli trial
A single trial with just two possible outcomes, labeled success and failure, with success probability p. A binomial experiment is n independent Bernoulli trials.
Binomial coefficient
The count nCx = n!/[x!(n−x)!] of the different orders that give x successes in n trials.
Binomial distribution
The distribution of the number of successes in a fixed number of independent trials with a constant chance of success: P(x) = nCxpxqn−x.
Continuous random variable
A random variable that can take any value in a range. Probabilities are given to ranges, and the probability of any single exact value is 0.
Cumulative probability
The probability that a random variable is at most a given value, P(X ≤ x). It is found by adding the probabilities of all values up to and including x.
Discrete random variable
A random variable whose possible values can be listed, such as 0, 1, 2, 3, most often from counting. The list may go on forever.
Expected value
Another name for the mean of a random variable, E(X) = μ = Σ[xP(x)]. It is the long run average over many repeats.
Factorial
The product n! = n(n−1)(n−2)…(1), with 0! defined as 1.
Geometric distribution
The distribution of the number of independent trials needed to get the first success: P(x) = qx−1p, with a mean of 1/p.
Independent trials
Trials in which the outcome of one has no effect on the probabilities of any other.
Law of large numbers
The rule that as a chance process is repeated more and more times, the average of the results settles toward the expected value.
Mean of a random variable (μ)
The average of the values weighted by probability, Σ[xP(x)]. It is the balance point of the distribution.
Memoryless property
The trait of the geometric distribution that past failures do not change the probability of success on the next trial.
Parameter
A number that describes a population or a probability model, such as n and p for a binomial or λ for a Poisson.
Poisson distribution
The distribution of the number of events in a fixed interval at a constant average rate λ: P(x) = λxe−λ/x!. Its mean and variance both equal λ.
Probability distribution
A list, formula or graph that gives every possible value of a discrete random variable together with its probability.
Probability histogram
A bar graph of a discrete distribution. The values sit on the horizontal axis, and the bar heights are the probabilities.
Random variable
A variable whose number value is set by the outcome of a chance process. It is written X, with x standing for one value.
Range rule of thumb
A rough habit that values farther than 2 standard deviations from the mean, outside μ ± 2σ, may be called unusual.
Standard deviation of a random variable (σ)
The square root of the variance. It is a typical distance of the values from the mean, in the original units.
Success probability (p)
The probability of the outcome being counted on a single trial. Its complement, q = 1 − p, is the chance of failure.
Variance of a random variable (σ2)
The average squared distance from the mean, weighted by probability: Σ[(x−μ)2P(x)], which equals Σ[x2P(x)] − μ2.

Check yourself

1. Sort each as discrete or continuous, and give your reason: (a) the number of text messages you send tomorrow, (b) the exact time you fall asleep tonight, (c) the number of eggs cracked before one is broken.
(a) discrete, (b) continuous, (c) discrete. (a) and (c) are counts, so their values can be listed. Note that (c) starts at 0, since the very first egg cracked may be the broken one. It also has no upper limit, which is fine, because the list 0, 1, 2, 3, … can still be counted. (b) is a measurement that fills a range of time, so between any two values there is always another.
2. A table gives P(0) = 0.25, P(1) = 0.40, P(2) = 0.20 and P(3) = 0.10. Is it a valid probability distribution? Show your check.
No, it fails the first requirement. Every entry lies between 0 and 1, so Rule 2 is met. But 0.25 + 0.40 + 0.20 + 0.10 = 0.95, not 1. About 5% of the probability is missing, which means at least one possible value was left off the table.
3. For the distribution P(0) = 0.20, P(1) = 0.35, P(2) = 0.30 and P(3) = 0.15, find P(X ≥ 1) in two different ways.
P(X ≥ 1) = 0.80 either way. By direct addition: 0.35 + 0.30 + 0.15 = 0.80. By the complement: 1 − P(0) = 1 − 0.20 = 0.80. The complement route is the one to reach for whenever a problem says "at least one."
4. A distribution has P(1) = 0.22, P(2) = k, P(3) = 0.31 and P(4) = 0.12, with no other values. Find k, and confirm it is a real probability.
k = 0.35. The known entries total 0.22 + 0.31 + 0.12 = 0.65, so k = 1 − 0.65 = 0.35. It lies between 0 and 1, so both requirements now hold and the table is valid.
5. Work out the mean and standard deviation of X with P(0) = 0.5, P(1) = 0.3 and P(2) = 0.2. Show the steps.
μ = 0.7 and σ ≈ 0.78. μ = 0(0.5) + 1(0.3) + 2(0.2) = 0 + 0.3 + 0.4 = 0.7. Then Σ[x2P(x)] = 0(0.5) + 1(0.3) + 4(0.2) = 1.1. So σ2 = 1.1 − (0.7)2 = 1.1 − 0.49 = 0.61, and σ = √0.61 ≈ 0.781.
6. A friend works out an expected value of 2.4 children per family and says, "So most families have between 2 and 3 children, and the next family I meet will probably have 2." What is wrong?
Expected value describes a long run average, not any single outcome, and 2.4 is not even a possible value. It means that the average number of children across very many families comes close to 2.4. It says nothing about which value is most likely, nothing about the spread and nothing reliable about the next family.
7. A charity sells 200 tickets at $5 each for a single $600 prize. Find the expected net gain of buying one ticket, and explain what it means.
E(X) = −$2.00 per ticket. The net gain is 600 − 5 = $595 with probability 1/200, and −$5 with probability 199/200. E(X) = 595(1/200) + (−5)(199/200) = (595 − 995)/200 = −400/200 = −$2.00. You will actually either gain $595 or lose $5. The −$2.00 is the average per ticket over many repeats.
8. State the four requirements of a binomial experiment. Then explain which one is broken by "deal 5 cards from a deck and count the hearts."
Fixed n; two outcomes per trial; independent trials; constant p. Dealing without replacement breaks independence (and so a constant p). After a heart is dealt, only 12 hearts remain in 51 cards, so p drops from 13/52 to 12/51. Five cards is nearly 10% of the deck, well past the 5% guideline, so the binomial should not be used here.
9. About 30% of a company's shipments arrive late. For 8 shipments picked at random, find the probability that exactly 3 arrive late.
P(X = 3) ≈ 0.2541, about 25.4%. Here n = 8, p = 0.30, q = 0.70 and x = 3. The coefficient is 8C3 = 8!/(3!5!) = (8×7×6)/(3×2×1) = 336/6 = 56. Then (0.30)3 = 0.027 and (0.70)5 = 0.16807. So P = 56 × 0.027 × 0.16807 = 1.512 × 0.16807 ≈ 0.2541.
10. For the same shipment setting (n = 8, p = 0.30), find μ and σ. Decide whether 7 late shipments would be unusual.
μ = 2.4, σ ≈ 1.30, and yes, 7 late shipments would be unusual. μ = np = 8(0.30) = 2.4, and σ = √(npq) = √[8(0.30)(0.70)] = √1.68 ≈ 1.296. The range rule gives μ ± 2σ = 2.4 ± 2.59, a range from about −0.19 to 4.99, and 7 falls far outside it.
11. A clinic averages 4 walk in patients per hour. Find the probability of exactly 2 walk ins in an hour, and the probability of none.
P(X = 2) ≈ 0.1465 and P(X = 0) ≈ 0.0183. This is Poisson with λ = 4 and e−4 ≈ 0.018316. P(2) = (42 × 0.018316)/2! = (16 × 0.018316)/2 = 0.293056/2 ≈ 0.1465. P(0) = (40 × 0.018316)/0! = 0.018316, since 40 = 1 and 0! = 1.
12. Each part off a line has a 10% chance of being faulty, independently. Find the probability that the first faulty part is the 5th one checked. Also find the average number of checks until a faulty part turns up.
P(X = 5) = 0.06561 and μ = 10 checks. This is geometric with p = 0.10 and q = 0.90: P(5) = (0.90)4(0.10) = 0.6561 × 0.10 = 0.06561. The mean is μ = 1/p = 1/0.10 = 10. Note that four good parts in a row change nothing. The 5th still has a 10% chance of being faulty, because the trials are independent.
Statistics Easy Read · Chapter 7

The Normal Distribution

Measure enough of almost anything that varies for lots of small, independent reasons, and the histogram tends to pile up in the middle and thin out evenly on both sides. Heights, birth weights, test scores and the error in a lab instrument all do this. That shape has a name: the normal distribution, or the bell curve; it matters far beyond its good looks. Once you know a variable is about normal, two numbers, the mean and the standard deviation, let you answer questions about any value in the distribution. This chapter teaches you to read the curve and to reason with the 68 to 95 to 99.7 rule. You will turn any score into a z-score and turn that z-score into a probability. Then you will run the whole machine backward when you are handed a percentile instead of a score. There is math here, but it is all addition, subtraction, multiplication and division, nothing harder.

By the end of this chapter you can

  • List the properties of a normal curve that define it, and explain what μ and σ each control.
  • Explain why probability for a continuous variable is an area, not a height, and why the total area equals 1.
  • Use the empirical rule (68 to 95 to 99.7) to estimate shares above, below and between values.
  • Work out a z-score with z = (x − μ) ÷ σ, and read its sign and size correctly.
  • Use z-scores to compare values measured on different scales.
  • Read a standard normal table to find left tail, right tail and between two values probabilities.
  • Work backward from a percentile to a raw score using x = μ + zσ.
  • Tell when the normal model does not apply, and avoid the classic misreadings.

Section 1The normal curve

Several normal probability density curves with different means and standard deviations plotted on the same axes
Reference. Normal curves with different means and standard deviations. The mean slides the curve left or right, and the standard deviation makes it narrow or wide. Source and license: see the figure credits

What the shape is telling you

A normal distribution is a smooth, symmetric curve with one peak: the bell curve; it is not a picture of data you collected. It is a model, an ideal math shape that real data can look like more or less closely. When we say "adult female heights are about normal," we mean the histogram of real heights looks a lot like that curve. It is close enough that we can use the curve's math to make good predictions.

Every normal curve is fully pinned down by just two numbers, called parameters. The mean μ (mu) sits at the center and marks the peak; the standard deviation σ (sigma) controls the spread; a small σ gives a tall, narrow curve where values huddle near the middle. A large σ gives a short, wide curve where values sprawl. Change μ, and the whole curve slides sideways without changing shape. Change σ, and the curve stretches or squeezes without moving its center. Statisticians write this in short as X ~ N(μ, σ2), read "X follows a normal distribution with mean μ and variance σ2."

The equation behind the picture is f(x) = [ 1 ÷ (σ √(2π) ) ] · e−(x − μ)² / (2σ²). You will never have to work it out by hand, and nothing in this chapter depends on it. It is worth seeing once, only so you can confirm the claim above: the only symbols in it besides x are μ and σ. Two numbers give one curve.

The properties, one at a time

Six features define the shape, and every method in the rest of this chapter leans on one of them.

PropertyWhat it meansWhy it matters
SymmetricThe left half is a mirror image of the right half about μLets you convert a right-tail question into a left-tail one, and vice versa
UnimodalExactly one peak, located at μA two-humped histogram is not normal: do not use these tools on it
Mean = median = modeAll three centers land on the same pointThe center is unambiguous; 50% of the area lies on each side
Total area = 1The area under the whole curve is exactly 1 (100%)Area is probability: this is what makes the curve usable
Asymptotic tailsThe tails approach the axis forever but never touch itNo value is strictly impossible, but extremes are vanishingly rare
Inflection at μ ± σThe curve switches from bending down to bending out one σ from centerYou can truly see σ on the picture: it is where the curve changes its bend.

The fourth property deserves a slow read, because it is where most people first get uneasy. Think of a continuous variable, one that can take any value in a range, like height in inches carried out to as many decimals as you like. The probability of landing on exactly one value is zero. Nobody is exactly 64.000000… inches tall. So we never ask "what is the probability height equals 64?" We ask "what is the probability height falls between 63 and 65?" The answer is the area under the curve over that stretch of the axis. The height of the curve is density, not probability. Area is probability.

Here is a practical result. For continuous distributions, P(X < 64) and P(X ≤ 64) are the same number, because the single point 64 adds zero area. That is not true for the discrete distributions of Chapter 6, and it trips people up on exams.

How close to normal does real data have to be?

Close enough, and no closer. Real heights stop at zero at the bottom and at about nine feet at the top, yet the normal curve in theory runs on forever in both directions. Real test scores are whole numbers, but the curve is smooth. None of that matters in practice, because the curve gives so little area to the impossible regions that the error is tiny. What does matter is a big break from the shape: strong skew, two peaks or a hard boundary sitting close to the mean. Income is the classic bad fit. It is right skewed, with a long tail of high earners, so its mean sits well above its median. The empirical rule you are about to learn will give you badly wrong answers for it.

Two numbers, and you know everything. That is the whole payoff of the normal model. For most distributions, knowing the mean and standard deviation tells you the center and the spread and little else. For a normal distribution, μ and σ set the whole curve. So they let you work out the share of the population above any value, below any value or between any two values, without ever looking at the original data again.
Interactive Drag the mean and the standard deviation, with sliders or by grabbing the peak and the inflection point directly, and watch the bell slide and stretch while the area inside ±1, ±2, and ±3 SDs is recomputed live and a real sample piles up underneath it. Open full ↑
Key points
  • A normal distribution is a symmetric, unimodal, bell shaped model, set fully by μ (center) and σ (spread).
  • The mean, median and mode all sit at μ. Changing μ slides the curve, and changing σ widens or narrows it.
  • Area under the curve is probability, and the total area is 1; the height of the curve is density, not probability.
  • The model is an approximation, so do not use it on strongly skewed data or data with two peaks.

Section 2The empirical rule in action

Normal curve divided into standard deviation bands showing 68 percent, 95 percent, and 99.7 percent of the area
Reference. The empirical rule. About 68%, 95% and 99.7% of a normal distribution falls within one, two and three standard deviations of the mean. Source and license: see the figure credits

The rule, and the finer breakdown

Every normal curve has the same shape. So the share of area inside a given number of standard deviations is always the same, no matter what the units are. That steady fact is the empirical rule, also called the 68 to 95 to 99.7 rule:

Split those bands in half using symmetry, and you get a map of the curve exact enough for most quick reasoning. Each half band below is one side of the center.

RegionShare of the areaRunning total from the left
Below μ − 3σ0.15%0.15%
μ − 3σ to μ − 2σ2.35%2.5%
μ − 2σ to μ − 1σ13.5%16%
μ − 1σ to μ34%50%
μ to μ + 1σ34%84%
μ + 1σ to μ + 2σ13.5%97.5%
μ + 2σ to μ + 3σ2.35%99.85%
Above μ + 3σ0.15%100%

Memorize the order 0.15, 2.35, 13.5, 34, then 34, 13.5, 2.35, 0.15 going back out. Those eight numbers add up to 100%, and they answer a surprising share of exam questions with no table at all.

A worked example

Say adult female heights in a large population are about normal with μ = 64.0 inches and σ = 2.5 inches. First, build the ruler by marking off standard deviations from the center:

Now answer four questions using only that ruler and the table above.

(a) What percent are taller than 69.0 inches? 69.0 is exactly μ + 2σ. The middle 95% lies inside ±2σ, so 100% − 95% = 5% lies outside. Symmetry splits that 5% evenly between the two tails: 5% ÷ 2 = 2.5%.

(b) What percent are shorter than 61.5 inches? 61.5 is μ − 1σ. Outside ±1σ lies 100% − 68% = 32%, split evenly: 32% ÷ 2 = 16%.

(c) What percent are between 66.5 and 69.0 inches? That is the band from μ + 1σ to μ + 2σ. Take the difference of the two symmetric bands and halve it: (95% − 68%) ÷ 2 = 27% ÷ 2 = 13.5%.

(d) What percent are between 59.0 and 66.5 inches? Split at the mean. From 59.0 (μ − 2σ) up to 64.0 is half of the 95% band, which is 47.5%. From 64.0 up to 66.5 (μ + 1σ) is half of the 68% band, which is 34%. Add them: 47.5% + 34% = 81.5%.

Notice the pattern in all four. Draw the curve, and mark μ and the three standard deviation ticks on each side. Shade what the question asks for, then add or subtract the block percentages. The sketch is not optional decoration; it is the method.

Where the rule stops working

The empirical rule is a fact about normal distributions only. Use it on right skewed data, such as household income or hospital stays, and it will overstate the left tail and understate the right, sometimes badly. For a distribution whose shape you do not know, there is a weaker backstop that works everywhere, Chebyshev's inequality. At least 1 − 1/k2 of any distribution lies within k standard deviations of the mean, for any k > 1. That promises at least 75% within 2σ and at least 88.9% within 3σ. Those are always true, but much looser than 95% and 99.7%. The precision of the empirical rule is the reward for the normal assumption being justified.

±2σ is 95.45%, not 95%. The rounding is harmless in casual reasoning, but the two get confused later. When someone says "the 95% interval," they almost always mean the interval built from 1.96 standard deviations, not 2. The empirical rule's "95" is a friendly approximation. 1.96 is the exact number, and it is the one that shows up in confidence intervals.
Interactive Apply 68 to 95 to 99.7 to six real measurements: pick a quantity, build a question with σ-snapped cuts, and watch the slice arithmetic, the exact area, and a live simulated sample all compute themselves, including one skewed case where the rule returns an impossible answer. Open full ↑
Key points
  • The empirical rule: about 68% / 95% / 99.7% of a normal distribution lies within 1, 2 and 3 standard deviations of μ.
  • Symmetry lets you halve any band. Outside ±2σ is 5%, so each tail is 2.5%.
  • The block percentages 0.15 / 2.35 / 13.5 / 34 (on each side) answer most questions with no table.
  • The rule applies to approximately normal data only. Chebyshev's inequality is the weaker rule that always holds.

Section 3The standard normal

The standard normal distribution with mean zero and standard deviation one, marked in z units
Reference. The standard normal distribution: mean 0 and standard deviation 1, with the horizontal axis measured in z units. Source and license: see the figure credits

One curve to rule them all

There are infinitely many normal curves, one for every pair (μ, σ), and nobody wants infinitely many tables. The fix is to rescale every normal distribution onto one shared curve, the standard normal distribution. That is the normal distribution with μ = 0 and σ = 1, written Z ~ N(0, 1).

The rescaling is done with the z-score:

z = ( x − μ ) ÷ σ

Read it as two steps in plain English. Subtract the mean: this recenters the value and tells you how far above or below average it sits, in the original units. Divide by the standard deviation: this turns that distance from original units into "standard deviations," which have no units at all. A z-score of 1.5 means "one and a half standard deviations above the mean." That holds whether the original data were inches, dollars, milliseconds or exam points.

The sign carries meaning. Positive z means above the mean, negative z means below, and z = 0 means exactly at the mean. The size carries the rest. An |z| under 1 is fully ordinary, around 2 is somewhat unusual, and 3 or more is truly rare. Only about 0.3% of a normal distribution sits beyond ±3.

Worked example: one score, two ways

An exam has μ = 72 points and σ = 8 points; a student scores x = 86.

z = (86 − 72) ÷ 8 = 14 ÷ 8 = 1.75

The score is 14 points above average, and 14 points is 1.75 standard deviations. Now a second student scores x = 60:

z = (60 − 72) ÷ 8 = (−12) ÷ 8 = −1.50

That student sits one and a half standard deviations below the mean. Note that z = −1.50 and z = +1.50 are the same distance from the center in opposite directions. We will use that fact again and again in Section 4.

Why standardizing is worth the trouble: comparing apples to oranges

The real power of a z-score is that it strips away the units and the scale. So scores from fully different measurements can be compared. Say a student takes two exams:

ExamScore xMean μSD σz = (x − μ) ÷ σReading
Exam A86728(86 − 72) ÷ 8 = +1.751.75 SD above average
Exam B91856(91 − 85) ÷ 6 = +1.001.00 SD above average
Exam C687510(68 − 75) ÷ 10 = −0.700.70 SD below average

The raw scores say Exam B (91) was the best result and Exam A (86) came second; the z-scores say otherwise. Compared with everyone else who took each test, Exam A was the strongest showing at +1.75, ahead of Exam B at +1.00. The 91 looks great until you notice that the class averaged 85 with a tight spread, so a 91 was only one standard deviation up. This is just why z-scores show up on growth charts, standardized tests and lab reference ranges. They answer "how unusual is this?" instead of "how big is this?"

The reverse turn is just algebra. Multiply both sides of the z-score formula by σ, and add μ:

x = μ + zσ

Check it on Exam A: x = 72 + (1.75)(8) = 72 + 14 = 86; it gives back the original score, as it must. Section 5 is built fully on this rearranged form.

Standardizing does not make data normal. Turning values into z-scores subtracts a constant and divides by a constant, a purely linear rescaling. It moves the center to 0 and the spread to 1, and it does nothing at all to the shape. If the original distribution was right skewed, the z-scores are right skewed too, and the standard normal table will give you wrong answers. Check the shape first, and standardize second.
Interactive Convert raw scores to z-scores with live arithmetic and watch any normal curve collapse onto the one standard normal, with tail areas computed two independent ways, a real simulated sample that standardizes to mean 0 and SD 1, and a reverse lookup from percentile back to a raw cutoff. Open full ↑
Key points
  • The standard normal distribution has μ = 0 and σ = 1, written Z ~ N(0, 1).
  • z = (x − μ) ÷ σ turns any value into "number of standard deviations from the mean," an amount with no units.
  • The sign gives direction (above or below μ), and the size gives how unusual it is. So z-scores let you compare different scales.
  • x = μ + zσ turns it back. Standardizing never changes the shape of a distribution.

Section 4Finding probabilities

A printed table of standard normal cumulative probabilities with z values down the left column
Reference. A standard normal probability table; each entry is the area to the left of the listed z value. Source and license: see the figure credits

What the table actually gives you

A standard normal table (or z-table) is a lookup of areas. The standard version used almost everywhere reports cumulative left tail area. The entry for a given z is the share of the distribution lying below that z, written Φ(z) or P(Z < z). So the entry for z = 0.00 is 0.5000, since half the curve lies below the center, and the entries climb toward 1 as z grows.

Reading it takes two coordinates; the row gives z to one decimal place, and the column gives the hundredths digit. To find Φ(1.75), go down to the row 1.7 and across to the column .05:

z.00.01.02.03.04.05.06.07
1.5.9332.9345.9357.9370.9382.9394.9406.9418
1.6.9452.9463.9474.9484.9495.9505.9515.9525
1.7.9554.9564.9573.9582.9591.9599.9608.9616
1.8.9641.9649.9656.9664.9671.9678.9686.9693
1.9.9713.9719.9726.9732.9738.9744.9750.9756

Φ(1.75) = 0.9599; that single number means that 95.99% of a standard normal distribution lies below z = 1.75. Everything else in this section is math done on numbers like that one.

The three question types

Every normal probability problem has one of three shapes, and each has a one line rule. In all of them, first turn your raw value into a z-score, then look it up.

QuestionRuleWhy
P(X < a): left tailΦ(za)Read the table directly; it already reports left-tail area
P(X > a): right tail1 − Φ(za)Total area is 1, so what is not below must be above
P(a < X < b): betweenΦ(zb) − Φ(za)Take everything below the top, remove everything below the bottom

Two habits keep you out of trouble. Sketch first: draw the bell, mark the mean and your value, and shade the region the question asks about. If your final answer is more than 0.5 but you shaded a small sliver, you have made an error. Sanity check against the empirical rule: an area beyond z = 2 should be near 2.5%, and an area below z = 0 should be exactly 0.5000.

Worked example: the same exam, three questions

Exam scores are about normal with μ = 72 and σ = 8.

(a) What share of students score below 86?
Step 1, standardize: z = (86 − 72) ÷ 8 = 14 ÷ 8 = 1.75.
Step 2, look up: Φ(1.75) = 0.9599.
Step 3, answer: P(X < 86) = 0.9599, so about 96.0% of students score below 86.

(b) What share score above 86?
It is the same z = 1.75. This is a right tail, so subtract from 1:
P(X > 86) = 1 − 0.9599 = 0.0401, or about 4.0%. That makes sense: (a) and (b) must add up to 1, and 0.9599 + 0.0401 = 1.0000.

(c) What share score between 64 and 86?
Step 1, standardize both ends.
Lower: z = (64 − 72) ÷ 8 = (−8) ÷ 8 = −1.00.
Upper: z = (86 − 72) ÷ 8 = 1.75.
Step 2, look up both. Φ(1.75) = 0.9599 and Φ(−1.00) = 0.1587.
Step 3, subtract: 0.9599 − 0.1587 = 0.8012, or about 80.1%.
Sanity check: the range runs from 1σ below the mean to 1.75σ above it. So it should be well over the 68% that sits inside ±1σ but stay under 95%, and it does.

If your table lists only positive z values, get Φ(−1.00) from symmetry: Φ(−z) = 1 − Φ(z), so Φ(−1.00) = 1 − 0.8413 = 0.1587, the same number.

These are worth committing to memory, because they come back again and again in the rest of statistics:

zΦ(z) = area to the leftArea to the rightNote
0.000.50000.5000The mean splits the curve in half
1.000.84130.1587Gives the 68% rule: 0.8413 − 0.1587 = 0.6826
1.6450.95000.0500Top 5% cutoff
1.960.97500.0250The real "95%" number: 2.5% in each tail
2.000.97720.0228Gives the 95.45% rule
2.5760.99500.0050Middle 99%
3.000.99870.0013Gives the 99.73% rule
A probability is a long run share, not a verdict about one person. "P(X > 86) = 0.04" means that in this population, about 4% of scores are above 86. Put another way, a student drawn at random has a 4% chance of scoring above 86 before you look. Once you know a student scored 90, there is no longer any probability involved, because that student is simply in the top 4%. Probability describes the act of drawing, not the value already drawn.
Interactive Shade any region under a normal curve, between, below, above, or outside two boundaries, and read its probability off a live numerical integration, then check that answer against a real simulated sample counted one observation at a time. Open full ↑
Key points
  • The z-table gives Φ(z) = P(Z < z), the area to the left. The row is tenths, and the column is hundredths.
  • Left tail: read it directly. Right tail: 1 − Φ(z). Between: Φ(zupper) − Φ(zlower).
  • Symmetry gives negative values: Φ(−z) = 1 − Φ(z). And P(X < a) equals P(X ≤ a), because the variable is continuous.
  • Always sketch and shade before working anything out, and check the answer against the empirical rule.

Section 5Working backward

A bell curve populated with one hundred figures illustrating how percentile rank maps onto the normal distribution
Reference. Percentile rank on a bell curve; a value's percentile is the share of the distribution lying below it. Source and license: see the figure credits

The question runs the other way

So far, you have been handed a value and asked for a share; many real questions come in the opposite order. What score puts a student in the top 10%? What birth weight is the 5th percentile? Where do we set the cutoff so that 95% of parts pass inspection? These are inverse problems, and they run the same machine backward.

Begin with the words; the kth percentile is the value with k percent of the distribution below it. The 90th percentile is the value that 90% of the data falls under and 10% is above. Percentiles are always stated as left tail areas; that is handy, because it is just what the z-table reports.

Here is the recipe in three steps:

  1. Turn the wording into a left tail area. "90th percentile" is already 0.9000. "Top 10%" is not 0.10; the cutoff for the top 10% has 90% below it, so the area is 0.9000 as well. "Bottom 5%" is 0.0500.
  2. Search the body of the table for that area, and read off the z. This is the reverse lookup. You scan the inside probabilities for the one closest to your target, then read the z from its row and column.
  3. Undo the standardizing with x = μ + zσ. That turns the position back into the original units.

Worked example: the 90th percentile

Use the same exam: μ = 72 and σ = 8. What score is the 90th percentile?

Step 1: the target left tail area = 0.9000.

Step 2: hunt in the body of the table; the nearest entries are Φ(1.28) = 0.8997 and Φ(1.29) = 0.9015. The first is off by 0.0003 and the second by 0.0015, so take z = 1.28.

Step 3: undo the standardizing:
x = μ + zσ = 72 + (1.28)(8) = 72 + 10.24 = 82.24

A score of about 82.2 marks the 90th percentile: about 90% of students score below it, and 10% above; check that the answer makes sense. 82.24 is above the mean, as any percentile above 50 must be. It is also a bit more than one standard deviation up, which fits an area of 0.90 sitting between Φ(1.00) = 0.8413 and Φ(1.50) = 0.9332.

Two more, including a negative z

(a) What score marks off the top 5%? The cutoff has 95% below it, so the target area is 0.9500 and z = 1.645. (The table brackets it: Φ(1.64) = 0.9495 and Φ(1.65) = 0.9505, so 1.645 is the standard value filled in between them.)
x = 72 + (1.645)(8) = 72 + 13.16 = 85.16. Scores at or above about 85.2 are in the top 5%.

(b) What score is the 25th percentile (the first quartile)? The target area is 0.2500, which is below the mean, so the z must be negative. By symmetry, Φ(−0.67) = 1 − Φ(0.67) = 1 − 0.7486 = 0.2514, and Φ(−0.68) = 1 − 0.7517 = 0.2483. The value 0.2500 sits between them, and the usual value is z = −0.67 (more exactly, −0.6745).
x = 72 + (−0.67)(8) = 72 − 5.36 = 66.64. About a quarter of students score below 66.6.

The most common error in inverse problems is dropping the minus sign. If the percentile is below 50, the z must be negative, and the answer must land below the mean. If your math hands you a value above μ for the 25th percentile, you lost a sign somewhere.

These z values come up so often that they are worth keeping close:

PercentileLeft-tail areazScore when μ = 72, σ = 8  (x = 72 + 8z)
1st0.0100−2.32672 − 18.61 = 53.39
5th0.0500−1.64572 − 13.16 = 58.84
10th0.1000−1.28272 − 10.26 = 61.74
25th0.2500−0.67472 − 5.39 = 66.61
50th0.50000.00072.00
75th0.7500+0.67472 + 5.39 = 77.39
90th0.9000+1.28272 + 10.26 = 82.26
95th0.9500+1.64572 + 13.16 = 85.16
99th0.9900+2.32672 + 18.61 = 90.61

Finding a symmetric middle interval

A close cousin asks: which two scores enclose the middle 95%? Symmetry does the work. If 95% is in the middle, 5% is left over, split into 2.5% in each tail. So the lower bound has a left tail area of 0.0250 (z = −1.96), and the upper bound has a left tail area of 0.9750 (z = +1.96). Then:

Lower: x = 72 + (−1.96)(8) = 72 − 15.68 = 56.32
Upper: x = 72 + (1.96)(8) = 72 + 15.68 = 87.68

The middle 95% of scores runs from about 56.3 to 87.7. This math is the direct ancestor of the confidence interval, and it is where the number 1.96 first earns its keep.

"Middle 95%" is not "95% confidence." The range 56.3 to 87.7 above describes where 95% of single scores fall in a population whose μ and σ we treated as known. A confidence interval, which you will meet later, is a different object. It estimates an unknown parameter, and its "95%" refers to how often the method succeeds over the long run. If you repeated the whole study many times, about 95% of the intervals made would contain the true parameter. It is not a 95% chance that the parameter lies inside the one interval you happen to have. Keep the two ideas in separate drawers.
Interactive Name an area instead of a value, the bottom p%, the top p%, or the middle p%, and run the normal curve in reverse: convert the ask into a left area, invert the standard normal to get z*, un-standardize with x = μ + zσ, then check the cutoff against a sample you draw yourself. Open full ↑
Key points
  • A percentile is stated as a left tail area; the kth percentile has k% of the distribution below it.
  • Inverse problems go area → z → x, using x = μ + zσ.
  • "Top 10%" means a left tail area of 0.90, not 0.10. Percentiles below 50 give a negative z, and losing that sign is the classic error.
  • A symmetric middle range splits the leftover area evenly between the two tails: middle 95% → z = ±1.96.

The chapter in one breath

  • The normal distribution is a symmetric, unimodal, bell shaped model set fully by two parameters: μ (center) and σ (spread).
  • For a continuous variable, area under the curve is probability. The total area is 1, and the probability of any single exact value is 0.
  • The empirical rule puts about 68%, 95% and 99.7% of the data within 1, 2 and 3 standard deviations of the mean, and symmetry lets you halve any band.
  • The z-score, z = (x − μ) ÷ σ, rewrites any value as a number of standard deviations from the mean, with no units. That makes different scales comparable.
  • The standard normal Z ~ N(0, 1) is the one curve every normal distribution is turned into, so one table serves them all.
  • The z-table reports the left tail area Φ(z). Right tails are 1 − Φ(z), and areas between values are Φ(zupper) − Φ(zlower).
  • Running the machine backward, area → z → x = μ + zσ, turns a percentile into a raw score.
  • All of it depends on the data being approximately normal. Standardizing rescales a distribution but never fixes its shape.

ReferenceWords worth knowing

A quick reference for the terms in this chapter. Skim it now, or come back whenever a word trips you up.

Area under the curve
The region between a density curve and the horizontal axis over some range. For a probability model, this area is the probability of landing in that range.
Bell curve
An everyday name for the normal curve, from its symmetric shape with one hump.
Chebyshev's inequality
The promise that at least 1 − 1/k2 of any distribution lies within k standard deviations of the mean (k > 1). It is weaker than the empirical rule but always true.
Continuous random variable
A variable that can take any value in a range. The probability of any single exact value is zero, so probabilities are worked out over ranges.
Cumulative probability
The total probability at or below a given value. It is the left tail area, written Φ(z) for the standard normal.
Density curve
A smooth curve whose total area underneath equals 1; it is used to model the distribution of a continuous variable.
Empirical rule
The 68 to 95 to 99.7 rule. In a normal distribution, about 68%, 95% and 99.7% of values lie within 1, 2 and 3 standard deviations of the mean.
Inflection point
The point where a curve changes the direction it bends. On a normal curve, these sit exactly at μ − σ and μ + σ.
Lower-tail area
The share of the distribution below a stated value; it is what a standard normal table reports.
Mean (μ)
The center of a normal distribution. For this model, it equals the median and the mode.
Normal distribution
A symmetric, unimodal, bell shaped continuous probability model set fully by μ and σ. It is written X ~ N(μ, σ2).
Parameter
A number that describes a population or model, such as μ or σ, as opposed to a statistic worked out from a sample.
Percentile
The value below which a stated percentage of the distribution falls; the 90th percentile has 90% of values beneath it.
Probability density function
The equation that makes a density curve; its height is density, not probability.
Raw score
A value given in its original units of measurement, before standardizing.
Standard deviation (σ)
The spread of a normal distribution; it is the distance from the mean to either inflection point.
Standard normal distribution
The normal distribution with μ = 0 and σ = 1, written Z ~ N(0, 1). It is the reference curve every other normal distribution is turned into.
Standardizing
Turning values into z-scores by subtracting the mean and dividing by the standard deviation. It is a linear rescaling that changes the center and spread but not the shape.
Symmetric distribution
One whose left and right halves are mirror images around the center.
Unimodal
Having just one peak.
z-score
The amount with no units z = (x − μ) ÷ σ. It gives how many standard deviations a value sits above (positive) or below (negative) the mean.
z-table
A table of standard normal cumulative probabilities. It is used forward to turn a z into an area, and backward to turn an area into a z.

Check yourself

1. Name the two parameters that fully set a normal curve, and state what each one does to the picture.
The mean μ and the standard deviation σ. Changing μ slides the whole curve left or right without changing its shape. Changing σ makes the curve narrower and taller (small σ) or wider and flatter (large σ) without moving its center.
2. A classmate says, "The height of the normal curve at x = 70 is the probability of getting a 70." What is wrong with that, and what is the right idea?
Height is density, not probability. For a continuous variable, the probability of any single exact value is zero. Probability is the area under the curve over a range, so you ask for P(69.5 < X < 70.5), not P(X = 70). A related result: P(X < 70) and P(X ≤ 70) are equal.
3. Systolic blood pressure in a population is about normal with μ = 120 mmHg and σ = 10 mmHg. Give the ranges that cover about 68%, 95% and 99.7% of the population.
68%: 110 to 130. 95%: 100 to 140. 99.7%: 90 to 150. Each is μ ± kσ: 120 ± 10, 120 ± 20 and 120 ± 30.
4. Use the same distribution (μ = 120, σ = 10); what percent of the population has a systolic pressure above 140? Show the reasoning without a table.
About 2.5%. 140 is μ + 2σ. The empirical rule puts about 95% inside ±2σ, leaving 100% − 95% = 5% outside. Symmetry splits that evenly, so 5% ÷ 2 = 2.5% lies above 140.
5. Still with μ = 120 and σ = 10: what percent falls between 130 and 140?
About 13.5%. That band runs from μ + 1σ to μ + 2σ. Take the difference of the symmetric bands, and halve it: (95% − 68%) ÷ 2 = 27% ÷ 2 = 13.5%.
6. A data set of hospital stays is strongly right skewed. Why is the empirical rule the wrong tool, and what can you use instead?
The 68 to 95 to 99.7 percentages are traits of the normal shape, so they do not hold for skewed data. Using them would misstate both tails. Chebyshev's inequality still applies to any distribution: at least 1 − 1/k2 of values lie within k SD of the mean. That is at least 75% within 2 SD and 88.9% within 3 SD, but it is far less exact.
7. A lab value has μ = 96 and σ = 12. Work out the z-score for a reading of 78, and explain what it means.
z = (78 − 96) ÷ 12 = (−18) ÷ 12 = −1.50. The reading is 18 units below the mean, which is one and a half standard deviations below average. The negative sign means "below the mean." A size of 1.5 is somewhat low but not extreme.
8. Student A scored 88 on a test with μ = 80 and σ = 5. Student B scored 140 on a different test with μ = 125 and σ = 12. Who did better compared with their group?
Student A. zA = (88 − 80) ÷ 5 = 8 ÷ 5 = +1.60; zB = (140 − 125) ÷ 12 = 15 ÷ 12 = +1.25. The raw 140 is the larger number, but compared with its own distribution it is only 1.25 SD above average, while A's 88 is 1.60 SD above. z-scores remove the units and the scale, so the comparison is fair.
9. Using μ = 72 and σ = 8, find the share of scores below 78; use Φ(0.75) = 0.7734.
About 0.7734, or 77.3%. Standardize first: z = (78 − 72) ÷ 8 = 6 ÷ 8 = 0.75. The table gives the left tail area directly, so P(X < 78) = Φ(0.75) = 0.7734. As a check, the answer should be over 0.50 because 78 is above the mean, and it is.
10. Use the same distribution (μ = 72, σ = 8). Find the share of scores between 60 and 78, given Φ(0.75) = 0.7734 and Φ(1.50) = 0.9332.
About 0.7066, or 70.7%. Lower: z = (60 − 72) ÷ 8 = −1.50, and by symmetry Φ(−1.50) = 1 − 0.9332 = 0.0668. Upper: z = 0.75, and Φ(0.75) = 0.7734. Subtract: 0.7734 − 0.0668 = 0.7066.
11. With μ = 500 and σ = 100, find the score at the 95th percentile; use z = 1.645.
x = 500 + (1.645)(100) = 500 + 164.5 = 664.5. The 95th percentile means a left tail area of 0.9500, whose z is 1.645. Undo the standardizing with x = μ + zσ. Note that the same value answers "what score marks off the top 5%?", since the top 5% cutoff has 95% below it.
12. With μ = 500 and σ = 100, find the 10th percentile, and explain the sign of the z. Use z = −1.28.
x = 500 + (−1.28)(100) = 500 − 128 = 372. The 10th percentile has a left tail area of 0.1000, which is less than 0.50. So the value must sit below the mean, and the z must be negative. Dropping that minus sign is the most common error in inverse problems. It would give 628, which is above the mean and so plainly wrong for a 10th percentile.
Statistics Easy Read · Chapter 8

Sampling Distributions & the Central Limit Theorem

Every time you take a sample, you get a slightly different answer, and for a long time that fact looked like a fatal flaw in the whole project of statistics. It is not. The way a statistic varies from sample to sample follows rules of its own. It can be predicted and described with a curve, and once you can describe it, you can say just how far off your one real sample is likely to be. This chapter builds that idea from the ground up. It covers what a sampling distribution is, where it is centered and how wide it is. It also shows why, through one of the most surprising results in all of math, it turns out to be bell shaped almost no matter what the original population looks like. Nothing here asks you to love algebra. It asks you to keep three different distributions straight in your head, and the rest follows.

By the end of this chapter you can

  • Tell apart a population distribution, a distribution of sample data and a sampling distribution of a statistic.
  • Explain why a statistic is a random variable, and build a sampling distribution by listing every possible sample.
  • State and use the two facts about the sample mean: μx̄ = μ and σx̄ = σ/√n.
  • State the Central Limit Theorem exactly, including its conditions and its limits.
  • Explain what the CLT does not say: it does not make the population or your data normal.
  • Work out a standard error, tell it apart from a standard deviation and use the square root law of sample size.
  • Build the sampling distribution of a sample proportion, and check the success-failure condition.
  • Turn a question about a sample statistic into a z-score, and read off a probability.

Section 1What a sampling distribution is

Diagram showing repeated samples drawn from one population, each producing a statistic, and those statistics forming their own distribution
Reference. A sampling distribution. Many samples are drawn from one population, each gives a statistic, and those statistics form a distribution of their own. Source and license: see the figure credits

Three distributions, and why people confuse them

Almost every trouble people have with this chapter comes from squashing three different things into one word. Let us pull them apart before we do any math.

The population distribution is how the single values are spread out in the whole group you care about. Examples are all adult resting heart rates, all household incomes or all widget diameters coming off a line. It has a true mean, written μ, and a true standard deviation, written σ. These are parameters, fixed numbers you almost never get to see.

The distribution of the sample data is what you actually hold in your hand: the n values you collected. Its histogram is an imperfect photo of the population's histogram. If the population is right skewed, your sample histogram will look right skewed too, and it will look more like the population as n grows. Its mean is x̄ and its standard deviation is s. These are statistics, numbers worked out from data.

The sampling distribution is the strange and powerful one. It is not a distribution of people, incomes or widgets. It is the distribution of a statistic, such as x̄, s or a proportion, across every sample of size n you could possibly have drawn. One dot in a sampling distribution is one whole sample boiled down to one number.

DistributionWhat one dot representsCenterSpreadDo you see it?
PopulationOne individual in the whole groupμσAlmost never
Sample dataOne individual you actually measuredx̄sYes: this is your dataset
Sampling distribution of x̄One entire sample, reduced to its meanμσ/√nNo: it is a mathematical object

Notice the last row. You will never see a sampling distribution in real life, because in real life you take one sample, not a thousand. The sampling distribution is a thought experiment. But it is a thought experiment whose center and spread we can work out exactly, and that is what makes inference possible at all.

A statistic is a random variable

Here is the hinge of the whole chapter. Because the sample was chosen at random, the value of x̄ was decided partly by chance. Draw a different random sample, and you get a different x̄. An amount whose value is set by a random process is a random variable, and every random variable has a distribution. So x̄ has a distribution. That distribution is the sampling distribution, and its spread is what we call sampling variability. It is the ordinary, expected and harmless fact that two honest samples from the same population give two different answers.

Building one by hand

Sampling distributions stop feeling mysterious the moment you build one by listing every case. Take a tiny population of four values: 2, 4, 6, 8. Its parameters are exact and easy:

μ = (2 + 4 + 6 + 8)/4 = 5, and σ2 = [(2−5)2 + (4−5)2 + (6−5)2 + (8−5)2]/4 = (9 + 1 + 1 + 9)/4 = 20/4 = 5, so σ = √5 ≈ 2.236.

Now list every sample of size n = 2 drawn with replacement. There are 4 × 4 = 16 of them, each equally likely, and each one has a mean. Putting those 16 means in a table gives the complete sampling distribution of x̄:

Value of x̄Which samples give itHow manyProbability
2(2,2)11/16 = .0625
3(2,4), (4,2)22/16 = .125
4(2,6), (6,2), (4,4)33/16 = .1875
5(2,8), (8,2), (4,6), (6,4)44/16 = .25
6(4,8), (8,4), (6,6)33/16 = .1875
7(6,8), (8,6)22/16 = .125
8(8,8)11/16 = .0625

Two things jump out. First, the original population was flat, with four values that were each equally likely. Yet the sampling distribution of x̄ is already peaked in the middle. There are four ways to land on a mean of 5 and only one way to land on a mean of 2, because an extreme mean needs every draw to be extreme in the same direction. That is the seed of the Central Limit Theorem, and you can already see it at n = 2.

Second, let us work out the center and spread of this new distribution. The mean of x̄ is

(2·1 + 3·2 + 4·3 + 5·4 + 6·3 + 7·2 + 8·1)/16 = (2 + 6 + 12 + 20 + 18 + 14 + 8)/16 = 80/16 = 5, which is exactly μ.

And its variance is Σ(x̄ − 5)2 · (probability):

[9(1) + 4(2) + 1(3) + 0(4) + 1(3) + 4(2) + 9(1)]/16 = (9 + 8 + 3 + 0 + 3 + 8 + 9)/16 = 40/16 = 2.5, so the standard deviation is √2.5 ≈ 1.581.

Compare that with the population, where σ2 = 5 and σ ≈ 2.236. The variance was cut exactly in half, and 2.236/√2 = 1.581. We did not round anything off; the two rules of Section 2 fell out of pure counting.

You take one sample, not a thousand. People sometimes worry that a sampling distribution is useless in practice because nobody really repeats a study 10,000 times. That is exactly right, and it does not matter. We never build the sampling distribution. We work out its center and width from μ, σ and n. Then we use that known shape to judge how far our single real result might fairly sit from the truth. The thought experiment does the work, so the repeats don't have to.
Interactive Draw real samples from four different populations and watch the statistic's own distribution build one dot at a time, on an axis shared with the population, with the pile's center and spread checked live against μ, σ/√n and √(p(1−p)/n). Open full ↑
Key points
  • A parameter (μ, σ, p) describes the population, and a statistic (x̄, s, p̂) describes a sample.
  • A sampling distribution is the distribution of a statistic over all possible samples of size n, where one dot is one whole sample.
  • Because the sample is random, a statistic is a random variable, and its spread is sampling variability.
  • Even a flat population gives a peaked sampling distribution of x̄, because extreme means need every draw to be extreme.

Section 2The distribution of the sample mean

Histogram of all possible sample means, showing a symmetric bell shape centered on the population mean
Reference. The distribution of all possible sample means from one population. It is centered on μ and far narrower than the population itself. Source and license: see the figure credits

Where it is centered: the mean of the mean

For a simple random sample of size n from a population with mean μ:

μx̄ = μ

In words, the average of all possible sample means is the population mean. This holds for every sample size, from n = 2 to n = 2,000,000, and for every population shape, skewed or not. It is the trait that makes x̄ an unbiased estimator of μ.

Be careful about what "unbiased" promises. It does not mean your own x̄ equals μ, since it almost surely doesn't. It means the method has no steady tendency to run high or low, so the errors are centered on zero. Bias is a trait of a method, not of a number.

How wide it is: the square-root law

For a simple random sample in which the observations are independent:

σx̄ = σ/√n

Put another way, the variance of the mean is σ2/n. This amount is so important that it gets its own name, the standard error, and its own section below. Two conditions earn it:

The gut sense here is averaging. When you add up n independent values, the high draws and the low draws partly cancel. They do not cancel fully, which would give zero spread, and they do not fail to cancel at all, which would give σ. They cancel at exactly the rate √n.

And its shape

Shape has a clean rule and a famous one. The clean rule is this: if the population is normal, then x̄ is exactly normal for any n, even n = 2. The famous one covers what happens when the population is not normal. That is the Central Limit Theorem, and it is the next section.

Population is…Center of x̄SD of x̄Shape of x̄
Normalμσ/√nExactly normal, any n
Non-normal, small nμσ/√nResembles the population: skew survives
Non-normal, large nμσ/√nApproximately normal (CLT)

Look down the middle two columns: the center and the spread are the same in all three rows. Population shape affects only the shape of the sampling distribution, never its center and never its width. That is worth memorizing, because exam questions love to test it.

A worked example

Adult resting heart rate in a large population is about normal, with μ = 74 beats per minute and σ = 12 bpm. You draw a simple random sample of n = 36 adults. What is the chance that the sample mean is above 77 bpm?

Step 1: center. μx̄ = 74 bpm.

Step 2: spread. σx̄ = σ/√n = 12/√36 = 12/6 = 2 bpm.

Step 3: shape. The population is normal, so x̄ is exactly normal, and no sample size rule is needed.

Step 4: standardize. z = (77 − 74)/2 = 3/2 = 1.50.

Step 5: read the table. The area to the right of z = 1.50 is 1 − 0.9332 = 0.0668, which is about a 6.7% chance.

Now feel the leverage. A single adult above 77 bpm is nothing special: z = (77 − 74)/12 = 0.25, an area of about 0.40, so about 40% of adults clear it. But an average of 36 adults above 77 happens only 6.7% of the time. With the same cutoff and the same population, a group average is far steadier and far harder to move than one person's value. Every clinical trial and every quality control chart runs on this fact.

Never divide by √n when the question is about one person. This is the most common error in the chapter. If the question says "a randomly chosen person," standardize with σ. If it says "the mean of a sample of n," standardize with σ/√n. Read the question, find the noun and then pick the denominator.
Interactive Stacks the population, one sample, and the sampling distribution of x̄ on a single shared axis: draw real samples from four different population shapes and watch the spread of the mean collapse to σ/√n while the data itself never gets tidier. Open full ↑
Key points
  • μx̄ = μ always, so x̄ is an unbiased estimator of μ.
  • σx̄ = σ/√n, given independence (with replacement, or n < 10% of N).
  • Population shape changes only the shape of the sampling distribution, never its center or spread.
  • A normal population gives an exactly normal x̄ at any sample size.
  • Averages vary far less than single values, which is why group results are more trustworthy than single measurements.

Section 3The Central Limit Theorem

Panels showing that sample means from a strongly non-normal population become bell-shaped as sample size increases
Reference. Sample means drawn from a clearly non-normal population become bell shaped as n grows. This is the Central Limit Theorem in one picture. Source and license: see the figure credits

The statement

Let X1, X2, …, Xn be independent draws from any population with mean μ and a finite standard deviation σ. Then as n grows, the distribution of the sample mean comes closer and closer to a normal distribution:

x̄ ≈ Normal(μ, σ/√n)   equivalently  z = (x̄ − μ) / (σ/√n) ≈ Normal(0, 1)

Read that with care, because the word "any" is doing huge work. The population may be right skewed like income, left skewed like exam scores, two peaked, spiky, discrete or shaped like a comb. It does not matter. Average enough of it, and the averages go bell shaped. This is why the normal curve turns up everywhere in applied statistics. It is not because nature loves bells, but because we keep taking averages, and a law of math draws averages toward a normal shape.

The same result applies to sums, since a sum is just n times a mean. The total of n independent draws is about Normal(nμ, σ√n). Insurers, casinos and warehouse planners live in that version.

What the CLT does not say

Four misreadings are worth killing on sight.

It does not say the population becomes normal. The population is whatever it is and never changes. Only the distribution of the statistic changes shape.

It does not say your data become normal. Collect 5,000 household incomes, and the histogram of those 5,000 values will be gloriously right skewed. In fact, it will be more clearly skewed than a sample of 50, because more data show the population better. The CLT is about the histogram of many means, not the histogram of many observations. This is the deepest confusion in the chapter, and the figure above is worth staring at until the difference is automatic.

It is not the Law of Large Numbers. The LLN says x̄ settles toward μ (converges) as n → ∞, so it tells you where you're going. The CLT tells you the shape and scale of the error along the way. The LLN gives the destination, and the CLT gives the wobble.

It does not always apply. The theorem needs a finite variance. A Cauchy distribution has none, and the mean of n Cauchy draws has exactly the same distribution as a single draw, so averaging buys you nothing at all. Heavy tailed data in finance and insurance sit uncomfortably close to this territory. That is one reason those fields treat the normal approximation with suspicion.

How large is "large enough"?

There is no single answer, because the honest answer depends on how skewed the population is. The familiar n ≥ 30 is a rule of thumb, not a proven law (theorem). Think of it as a border checkpoint, not a law of physics.

Population shapeExamplen for a good normal approximation
NormalHeight, measurement errorAny n: exact, no approximation needed
Symmetric, non-normalA fair die roll, a uniform variableAround 5 to 10 is already convincing
Moderately skewedReaction times, hospital stay lengthAbout 30: the classic rule
Strongly skewedIncome, insurance claim sizeOften 100 to 300 or more
Extremely heavy-tailedCauchy, some financial returnsNever: the theorem's condition fails

A worked example

The lengths of support calls are strongly right skewed: most calls are short, and a few drag on for an hour. The population mean is μ = 4.0 minutes with σ = 6.0 minutes. (Note that σ is bigger than μ, a sign of heavy right skew.) A supervisor samples n = 100 calls at random. What is the chance that the sample averages more than 5.0 minutes?

Step 1: shape check. The population is badly skewed, so x̄ is not normal for small n. But n = 100 is large, the calls are independent and 100 is a tiny share of all calls, so the CLT applies.

Step 2: center. μx̄ = 4.0 minutes.

Step 3: spread. σx̄ = 6.0/√100 = 6.0/10 = 0.60 minutes.

Step 4: standardize. z = (5.0 − 4.0)/0.60 = 1.00/0.60 ≈ 1.67.

Step 5: read the table. The area to the right of z = 1.67 is 1 − 0.9525 = 0.0475, or about 4.8%.

The sum version comes free. 100 calls averaging over 5.0 minutes is the same event as 100 calls totaling over 500 minutes. So there is also a 4.8% chance that the shift's total call time is over 500 minutes. Staffing decisions are made on just this math.

Skew hides in the sample, not in the mean. If you sampled those 100 calls and drew a histogram, it would be lopsided and ugly, and that would be correct, not a breach of any rule. The bell shape lives one level up, in the imagined distribution of the averages of many such samples. Judging whether the CLT applies from the shape of your own data histogram is a mix up of categories. Judge it from the sample size and how severe the skew is.
Interactive Drag the sample size and watch a lopsided population produce a normal sampling distribution: both panels share one standardized axis, and 4,000 simulated studies measure at every setting how far the sample mean still is from the bell and whether its 5% really means 5%. Open full ↑
Key points
  • The CLT: for independent draws from any population with a finite σ, x̄ becomes about Normal(μ, σ/√n) as n grows.
  • It changes only the shape of the sampling distribution, since the center and spread were already set by Section 2.
  • It says nothing about the population's shape or about your own data histogram.
  • n ≥ 30 is a rule of thumb. Heavier skew needs more, and infinite variance defeats the theorem fully.
  • The same result holds for sums: Normal(nμ, σ√n).

Section 4Standard error

Histograms of sample means at several sample sizes, each narrower than the last
Reference. The effect of sample size. As n grows, the distribution of sample means tightens around the population mean. Source and license: see the figure credits

The definition, and the distinction that matters most

The standard error of a statistic is the standard deviation of that statistic's sampling distribution. For the sample mean:

SE(x̄) = σ/√n   and when σ is unknown, as it nearly always is, we estimate it:  SE(x̄) ≈ s/√n

Now the difference. A standard deviation answers "how spread out are the people?" A standard error answers "how spread out would my estimate be if I repeated the study?" One is a fact about the world, and the other is a statement about how exact a way of measuring is. They cannot be swapped, and quoting one when you mean the other misleads readers badly. SE is always the smaller number. So reporting "mean ± SE" when you meant to describe your subjects makes the data look far tidier than they are.

 Standard deviation (s or σ)Standard error (SE)
DescribesSpread of individual observationsSpread of a statistic across repeated samples
AnswersHow different are people from each other?How precise is my estimate?
Effect of larger nSettles toward σ: does not shrinkShrinks as 1/√n
Use it forDescribing the sample or populationConfidence intervals and test statistics

That third row deserves a moment. Doubling your sample does not make people more alike, since the population's σ is a fixed feature of the world. What more data buys is a sharper picture of μ: a smaller SE, and nothing else.

The square-root law and its brutal arithmetic

Because n sits under a square root, precision gets better slowly. Take σ = 20 and watch:

Sample size n√nSE = 20/√nImprovement over n = 25
2554.00-
100102.002× better for 4× the data
400201.004× better for 16× the data
1,600400.508× better for 64× the data
10,0001000.2020× better for 400× the data

To cut the standard error in half, you must make the sample four times as big. To cut it to a tenth, multiply the sample by a hundred. This is why huge studies are costly, and why the jump from a poll of 400 people to a poll of 1,600 buys less than people expect. It is also why, past a point, money is better spent on cutting bias than on chasing decimal places that √n will not give up. Better sampling frames and higher response rates are where that money should go.

A worked example, and the surprising irrelevance of population size

A sample of n = 49 finished part diameters has s = 14.2 microns.

SE = s/√n = 14.2/√49 = 14.2/7 = 2.03 microns.

The engineers want the standard error down to 1.0 micron. How many parts does that take? Set 14.2/√n = 1.0, so √n = 14.2 and n = 14.22 = 201.64 → round up to n = 202. (Check: 14.2/√202 = 14.2/14.21 ≈ 0.999. ✓) Halving the SE cost about four times the sample, 49 to 202, just as the square root law promised.

Now comes the fact that startles nearly everyone: the population size N does not appear in the formula. As long as the sample is a small share of the population, a random sample of 1,000 estimates a parameter just as exactly in a country of 300 million as in a town of 30,000. Precision is ruled by how many people you asked, not by what share of them you asked. "Only 1,000 people out of 300 million: how can that mean anything?" is a natural objection, but it is wrong. The soup does not care how big the pot is, as long as you stirred it.

The standard error is the engine of every interval you will ever build. In the next chapters, a confidence interval will be built as estimate ± (multiplier × SE). Get the meaning right now. A "95% confidence interval" describes how the method behaves over the long run: 95% of intervals built this way catch the true parameter. It does not mean there is a 95% chance that the parameter lies inside the one interval on your page. That interval either contains μ or it doesn't, and the 95% belongs to the method, not to this one result.
Interactive Draw real samples from four differently shaped populations and raise n to watch the sampling distribution of the sample mean narrow by exactly σ/√n, with ±1 SE drawn to scale as rulers, a ×4-data-÷2-error staircase, and a live solver for the sample size a target precision would require. Open full ↑
Key points
  • SE = the standard deviation of a statistic's sampling distribution. For the mean, it is σ/√n, estimated by s/√n.
  • SD describes single values, and SE describes an estimate. A larger n shrinks SE and leaves σ alone.
  • The square root law: make n four times as big to halve the SE, so precision comes at a steeply rising price.
  • SE depends on n, not on population size N, whenever the sample is a small share of the population.
  • A confidence interval is estimate ± multiplier × SE, and its confidence level describes the method, not this one interval.

Section 5Sampling distribution of a proportion

A binomial distribution with a normal curve overlaid, showing the normal approximation
Reference. A binomial count with a normal curve laid over it. This approximation makes proportions behave like means. Source and license: see the figure credits

A proportion is a mean in disguise

Data made of groups (categorical data) seem like they should need a whole new theory. They don't; they need new labels. Code each observation as 1 for "yes" and 0 for "no." Then the sample proportion

p̂ = x/n  (where x = number of successes)

is just the mean of those 0s and 1s. And for a variable that takes only the values 0 and 1, with success probability p, the population mean is μ = p and the population standard deviation is σ = √[p(1−p)]. Put those into Section 2's two rules, and the results for proportions appear with no new work at all:

μp̂ = p   and   SE(p̂) = √[p(1−p)/n]

So p̂ is an unbiased estimator of p, and its spread still falls off as 1/√n. It is the same logic and the same square root law, with a formula that looks different.

The success-failure condition

The one truly new wrinkle is shape. The count x follows a binomial distribution, which is discrete. When p is near 0 or 1, it is also badly skewed, because it is pressed up against a wall. If p = 0.02, most samples give very few successes, and the distribution cannot stretch left past zero. The normal approximation needs enough room on both sides:

np ≥ 10  and  n(1−p) ≥ 10

In plain terms, you expect at least about 10 successes and at least about 10 failures. (Some texts use 5 and some use 15, but the idea is the same: both tails need elbow room.) When the condition fails, do not fake it with a z-score; use exact binomial methods instead.

True pp(1−p)SE at n = 1,000Check at n = 50
0.020.01960.0044 (0.44 pts)np = 1: fails
0.100.09000.0095 (0.95 pts)np = 5: fails
0.300.21000.0145 (1.45 pts)15 and 35: passes
0.500.25000.0158 (1.58 pts): the maximum25 and 25: passes
0.700.21000.0145 (1.45 pts)35 and 15: passes
0.900.09000.0095 (0.95 pts)n(1−p) = 5: fails

Two lessons live in that table. First, p(1−p) peaks at p = 0.5, so a proportion near a half is the hardest to pin down. That is just why close elections are hard to call and lopsided ones are easy. Second, because 0.5 is the worst case, planners who don't yet know p assume p = 0.5. That gives a sample size that is sure to be big enough, no matter what the truth turns out to be.

A worked example

Say 60% of a large population supports a measure, so p = 0.60. A pollster surveys n = 200 people at random. What is the chance that the poll reports 55% support or less?

Step 1: conditions. np = 200(0.60) = 120 ≥ 10, and n(1−p) = 200(0.40) = 80 ≥ 10. Both clear easily. And 200 people are far fewer than 10% of a large population, so the draws are close enough to independent. The normal approximation is approved.

Step 2: center. μp̂ = 0.60.

Step 3: spread. SE = √[(0.60)(0.40)/200] = √(0.24/200) = √0.0012 ≈ 0.0346, or about 3.46 percentage points.

Step 4: standardize. z = (0.55 − 0.60)/0.0346 = −0.05/0.0346 ≈ −1.44.

Step 5: read the table. The area to the left of z = −1.44 is about 0.075, which is about a 7.5% chance.

Read it honestly. Even with a perfectly run random sample and no bias at all, a poll of 200 will land at or below 55% about one time in thirteen when the truth is 60%. That gap is not fraud, poor work or a "shift in the voters." It is sampling variability doing just what the formula predicts.

Where the "margin of error" comes from. A reported margin of error is about 2 × SE, using p̂ in place of the unknown p. For our poll, 2 × 0.0346 ≈ 0.069, or about ±7 percentage points. That is wide, because 200 is a small poll. Note what it does and does not cover. The margin of error measures random sampling variability only. It says nothing about people who do not reply, badly worded questions or a sampling frame that missed part of the population. Those errors do not shrink as n grows, and no formula on this page will warn you about them.
Interactive Score everyone 1 or 0 and a proportion becomes a mean: draw real samples and watch p̂ pile up around the true p with spread √(p(1−p)/n), checked live against the exact binomial, the normal model, and the np ≥ 10 condition. Open full ↑
Key points
  • A proportion is the mean of 0s and 1s, so all of Section 2 carries over unchanged.
  • μp̂ = p and SE(p̂) = √[p(1−p)/n].
  • The shape is about normal only when the success-failure condition (np ≥ 10 and n(1−p) ≥ 10) holds.
  • Variability is greatest at p = 0.5. That is why close races are hardest to call, and why 0.5 is the safe planning value.
  • Margin of error ≈ 2 × SE, and it covers random sampling error only, never bias.

The chapter in one breath

  • Keep three distributions apart: the population, your sample data and the sampling distribution of a statistic, where one dot is one whole sample.
  • Because samples are random, every statistic is a random variable with a distribution of its own. That spread is sampling variability, not error in the everyday sense.
  • The sample mean is centered exactly on the truth, μx̄ = μ, so x̄ is unbiased.
  • Its spread is σ/√n, so averages are far steadier than single values. A normal population gives an exactly normal x̄ at any n.
  • The Central Limit Theorem says x̄ becomes about normal as n grows, for any population with finite variance. It changes the shape only, never the center or spread, and it never touches the population or your own histogram.
  • The standard error measures how exact an estimate is, not the spread of people. It falls as 1/√n, so halving it costs four times the data, and it depends on n, not on the size of the population.
  • A proportion is a mean of 0s and 1s: μp̂ = p and SE = √[p(1−p)/n]. It is about normal when the success-failure condition holds, and it varies most at p = 0.5.
  • Every confidence interval and hypothesis test in the chapters ahead is built on the standard error. That makes this chapter the hinge of the whole book.

ReferenceWords worth knowing

These terms are the working words of inference. Skim them now, and come back whenever a symbol or phrase stops making sense.

Bias (of an estimator)
A steady tendency for a statistic to fall above or below the parameter it estimates. Bias is a trait of a method, not of any single result.
Central Limit Theorem (CLT)
For independent draws from any population with a finite standard deviation, the sampling distribution of x̄ comes closer and closer to Normal(μ, σ/√n) as n grows.
Estimator
A rule or formula for making an estimate of a parameter from sample data. x̄ is an estimator of μ.
Finite population correction
The factor √[(N−n)/(N−1)], applied to the standard error when the sample is a large share of a finite population. It makes the SE smaller.
Independence
The condition that one observation carries no information about another. Sampling with replacement meets it, and so does sampling, close enough, when n is under about 10% of the population.
Law of Large Numbers
The result that x̄ settles toward μ as the sample size grows without limit. It gives the destination, while the CLT gives the shape of the error along the way.
Margin of error
About 2 × SE, the half width of a typical 95% confidence interval. It counts random sampling variability only, never bias.
Parameter
A fixed number that describes a population, such as μ, σ or p. It is most often unknown.
Population distribution
The distribution of single values across the whole group of interest.
Sample proportion (p̂)
The share of successes in a sample, x/n. In math terms, it is the mean of a set of 0s and 1s.
Sampling distribution
The distribution of a statistic across all possible samples of a fixed size n from the same population.
Sampling variability
The natural ups and downs of a statistic from sample to sample. It is expected behavior, not a mistake.
Simple random sample (SRS)
A sample chosen so that every possible sample of size n is equally likely. It is the assumption behind every formula in this chapter.
Skewness
Lopsidedness (asymmetry) in a distribution. Heavier skew in the population needs a larger n before the CLT approximation can be trusted.
Standard deviation
A measure of how spread out single values are: σ for a population and s for a sample. It does not shrink as n grows.
Standard error (SE)
The standard deviation of a statistic's sampling distribution, which measures how exact an estimate is. For the mean, it is σ/√n, estimated by s/√n.
Statistic
A number worked out from sample data, such as x̄, s or p̂. Because the sample is random, a statistic is a random variable.
Success-failure condition
The rule that np ≥ 10 and n(1−p) ≥ 10 before you treat the sampling distribution of p̂ as about normal.
Unbiased estimator
An estimator whose sampling distribution is centered on the parameter, so its average value over all possible samples equals the truth. x̄ and p̂ are unbiased.
z-score (standardized score)
The number of standard deviations a value sits from its mean: z = (value − center)/(spread). For a sample mean, the spread used is the standard error.

Check yourself

1. In one sentence each, tell apart the population distribution, the distribution of the sample data and the sampling distribution of x̄. What does a single dot stand for in each?
Population = the spread of all single values (one dot = one person or thing); sample data = the n values you collected (one dot = one measured person or thing); sampling distribution = the spread of a statistic over all possible samples (one dot = one whole sample, boiled down to its mean). Only the middle one is something you actually see.
2. A population has μ = 40 and σ = 15. For samples of size n = 25, give the center and standard deviation of the sampling distribution of x̄.
Center = 40; standard deviation = 15/√25 = 15/5 = 3. The center always equals μ, and the spread is σ/√n. Neither one depends on the population's shape.
3. True or false: "Because of the Central Limit Theorem, if I collect enough data my histogram will look normal." Explain.
False, and this is the most common misreading of the CLT. A histogram of raw observations comes to look more and more like the population's shape. So a skewed population gives a histogram that looks more and more clearly skewed. The CLT is about the distribution of sample means, not the distribution of single data values.
4. Adult resting heart rate is normal with μ = 74 and σ = 12. Find the probability that a sample of n = 36 has a mean above 77, and show your steps.
About 6.7%. SE = 12/√36 = 2; z = (77 − 74)/2 = 1.50; the area to the right of 1.50 = 1 − 0.9332 = 0.0668. Because the population is normal, x̄ is exactly normal, so no sample size rule is needed.
5. Using the same population, what is the probability that one adult chosen at random has a rate above 77? Why is the answer so different from question 4?
About 40%: z = (77 − 74)/12 = 0.25, and the area to the right of 0.25 is about 0.401. For one person, you divide by σ. For a mean of n, you divide by σ/√n. Averages vary far less than single values, so the same cutoff is far harder for an average to cross.
6. State the Central Limit Theorem, including the condition on the population that it needs.
For independent observations from any population with mean μ and a finite standard deviation σ, the sampling distribution of x̄ comes closer and closer to Normal(μ, σ/√n) as n grows. Finite variance is a must. For a Cauchy distribution, the mean of n draws behaves no better than a single draw.
7. Call lengths have μ = 4.0 min and σ = 6.0 min and are strongly right skewed. For n = 100, find P(x̄ > 5.0), and explain why a normal curve may be used on skewed data.
About 4.8%. SE = 6.0/√100 = 0.60; z = (5.0 − 4.0)/0.60 ≈ 1.67; the area to the right ≈ 1 − 0.9525 = 0.0475. The normal curve is allowed not because the data are normal, since they are badly skewed. It is allowed because n = 100 is large enough for the CLT to make the distribution of means nearly normal.
8. Explain the difference between a standard deviation and a standard error, and say what happens to each as n grows.
SD measures how spread out single observations are. SE measures how much a statistic would vary across repeated samples, which is how exact the estimate is. As n grows, s settles toward the fixed population σ and does not shrink, while SE shrinks as 1/√n. More data do not make people more alike; they sharpen your estimate of the mean.
9. A study with n = 100 reports SE = 3.0. How large a sample would be needed to bring the SE down to 1.5, and to 1.0?
n = 400 for SE = 1.5, and n = 900 for SE = 1.0. SE = σ/√n = 3.0 at n = 100 means σ = 30. Then 30/√n = 1.5 gives √n = 20, so n = 400. And 30/√n = 1.0 gives √n = 30, so n = 900. Halving the SE always costs four times the data.
10. Someone objects: "A poll of 1,000 people can't possibly represent 300 million." Answer the objection using the standard error formula.
The formula contains n, not the population size N. So as long as the sample is a small share of the population, precision depends on how many people you asked, not on what share you asked. A random 1,000 does about equally well for a town or a nation. The real threats to a poll are picking people in a way that is not random and people not replying, and no sample size fixes those.
11. In a population where p = 0.60, a poll of n = 200 is taken. Check the conditions, work out the standard error and find the chance that the poll reports 55% or less.
The conditions pass, and the probability is about 7.5%. np = 120 ≥ 10 and n(1−p) = 80 ≥ 10. SE = √[(0.6)(0.4)/200] = √0.0012 ≈ 0.0346. z = (0.55 − 0.60)/0.0346 ≈ −1.44, which gives a left tail area of about 0.075. A result that low is ordinary sampling variability, not proof of a flawed poll.
12. For a fixed n, at what value of p is SE(p̂) largest, and why do sample size planners assume that value? What does a reported margin of error fail to account for?
SE is largest at p = 0.5, because p(1−p) peaks there at 0.25. Planners who do not yet know p use 0.5 as the worst case, which makes sure the sample is large enough whatever the truth is. The margin of error captures random sampling variability only. It says nothing about people who do not reply, poorly worded questions or a sampling frame that left out part of the population. Those biases do not shrink as n grows.
Statistics Easy Read · Chapter 9

Confidence Intervals

A sample can tell you what it saw, but it cannot tell you the exact truth about the whole population. A confidence interval is the honest way to report that gap. Instead of a single number that is almost surely a little wrong, you report a range of believable values, along with how confident the method is. The recipe is short enough to memorize in one line: take your best estimate and stretch it by a margin of error. This chapter builds that line from scratch and works the math for means and for proportions. It shows just what makes an interval wide or narrow. And it teaches the part most people get wrong: how to say what “95% confident” really means.

By the end of this chapter you can

  • Explain why a point estimate alone is not enough, and describe a confidence interval as estimate ± margin of error.
  • Name the three moving parts of every interval: the point estimate, the critical value and the standard error.
  • Build a confidence interval for a population mean, using z when σ is known and t when it is not.
  • State the degrees of freedom for a one sample t interval, and explain why the t distribution has heavier tails than z.
  • Build a confidence interval for a population proportion, and check its conditions before you trust it.
  • Predict how the interval changes when the confidence level, the sample size or the variability changes.
  • Solve for the sample size needed to hit a target margin of error.
  • Write a correct reading of a 95% confidence interval, and spot the four classic wrong ones.

Section 1The idea of a confidence interval

A point estimate shown as a single dot compared with an interval estimate shown as a range around it
Reference. Point estimation versus interval estimation: a single best guess compared with a range of believable values for the same parameter. Source and license: see the figure credits

Why a single number is never enough

Say you want to know the average number of hours adults in a small city sleep each night. You cannot ask all 24,000 of them, so you take a random sample of 25 and work out a sample mean of 6.8 hours. That 6.8 is a point estimate. It is a single number, worked out from a sample, offered as your best guess for the parameter. Here the parameter is the true population mean μ, which you will never see directly.

Here is the uncomfortable truth about point estimates: yours is almost surely wrong. It is not badly wrong, and not wrong on purpose, but simply wrong. A different random sample of 25 adults would have given 7.1, and another would have given 6.5. The estimate moves around from sample to sample. That movement is called sampling error. It is not a mistake you made; it is the price you cannot avoid for looking at a part instead of the whole.

So reporting “6.8 hours” with a straight face overstates what you know. Reporting “somewhere between 6.1 and 7.5 hours, and here is how sure I am of that method” is honest. That second statement is a confidence interval: an interval estimate for a parameter, paired with a stated confidence level.

The one-line recipe

Every confidence interval at this level is built from the same skeleton. That holds for a mean, for a proportion and for a difference between two groups:

point estimate ± margin of error

And the margin of error is itself always the same two things multiplied together:

margin of error = (critical value) × (standard error of the estimate)

The standard error measures how much your estimate bounces around from sample to sample. It is the standard deviation of the estimate's sampling distribution. The critical value (written z* or t*) is a multiplier. It is chosen so that the interval is wide enough to succeed as often as your confidence level demands. Want more confidence? Use a bigger multiplier. That is the whole machine. Everything else in this chapter fills in those two blanks for one kind of problem at a time.

Why does this work at all? Because of the Central Limit Theorem from the last chapters. For a large enough sample, the sampling distribution of the sample mean is about normal and centered on the true parameter. Say the estimate lands within about 1.96 standard errors of the truth about 95% of the time. Then reaching out 1.96 standard errors from the estimate will catch the truth about 95% of the time. The interval is the sampling distribution read backward.

Parameter (unknown)SymbolPoint estimateStandard error of the estimate
Population meanμx̄ (sample mean)σ/√n if σ known; s/√n if not
Population proportionpp̂ (sample proportion)√[p̂(1 − p̂)/n]
Population standard deviationσs (sample SD)(not covered here)
Difference of two meansμ1 − μ2x̄1 − x̄2√[s12/n1 + s22/n2]

Reading an interval out loud

An interval has a center (your point estimate), a half width (the margin of error) and two endpoints. Say a poll reports “54% approve, margin of error 3 percentage points.” Then the interval is 51% to 57%, the center is 54% and the half width is 3. Notice that the width of the whole interval is twice the margin of error, a difference that trips people up all the time. A margin of error of 3 points gives an interval 6 points wide.

One more habit is worth building now. A confidence interval is a statement about a parameter, not about one person. An interval of 6.1 to 7.5 hours is about the population's average sleep. It says nothing about whether any one person sleeps in that range, and most of them will not. The tool for single people is a prediction interval, and it is much wider.

Every interval you will ever build is the same sentence. It is the estimate, plus or minus the critical value times the standard error. When a new interval shows up later, such as two proportions, a regression slope or a paired difference, do not memorize a new formula. Ask three questions: what is my estimate, what is its standard error and which table gives me the multiplier? The skeleton never changes.
Interactive Draw real samples and watch each confidence interval get built out of its own data as estimate ± z*·σ/√n, then stack hundreds of repeats to see that the confidence level describes the procedure, not any single interval, and that the margin covers sampling wobble and nothing else. Open full ↑
Key points
  • A point estimate is a single number guess for a parameter. It varies from sample to sample because of sampling error.
  • A confidence interval is point estimate ± margin of error, reported with a stated confidence level.
  • Margin of error = critical value × standard error. The standard error measures how much the estimate bounces from sample to sample.
  • The width of an interval is twice the margin of error, and the interval describes a parameter, never one person.

Section 2A confidence interval for a mean

The standard normal curve overlaid with a Student t curve showing the t distribution's heavier tails
Reference. The standard normal distribution compared with Student's t distribution. They have the same bell shape, but t is shorter in the middle and heavier in the tails. Source and license: see the figure credits

When σ is known: the z interval

Start with the easier case. It almost never happens in real life, but it makes the logic easy to see. Say the population standard deviation σ is truly known. Think of a filling machine whose long run spread the maker has measured over millions of bottles. Then the standard error of the sample mean is exactly σ/√n, and the interval is

x̄ ± z* · (σ/√n)

Here z* is the value that cuts off the middle part of the standard normal curve matching your confidence level. For 95%, that value is 1.96, the number worth memorizing.

Worked example. A bottling line fills 500 mL bottles. The machine's long run standard deviation is known to be σ = 4 mL. A quality inspector pulls a random sample of n = 36 bottles and finds x̄ = 502 mL. Build a 95% confidence interval for the true mean fill volume μ.

The 95% confidence interval is 500.69 mL to 503.31 mL. 500 mL falls just outside this interval. So a true mean of exactly 500 mL is not among the believable values this sample supports, and the data do give evidence, at the 5% level, that the machine is off target. Notice how narrowly it misses. Had the sample mean been 501 mL, the interval would have run from 499.69 to 502.31, and 500 would have been well inside.

When σ is unknown: the t interval

In practice, you almost never know σ. You estimate it with the sample standard deviation s, which adds a second source of uncertainty. Not only is x̄ a noisy estimate of μ, but s is a noisy estimate of σ. If you simply swapped in s for σ and kept using 1.96, your intervals would be a little too narrow. They would catch the truth less than 95% of the time.

William Gosset solved this in 1908, publishing under the pen name “Student.” His fix was a new family of curves, Student's t distribution. These look like the normal curve but have heavier tails, which gives slightly larger critical values and slightly wider intervals. Just how much heavier depends on the degrees of freedom, df = n − 1. Small samples give few degrees of freedom, fat tails and big multipliers. Large samples give many degrees of freedom, and t comes closer and closer to z.

x̄ ± t*n−1 · (s/√n)

Worked example. A random sample of n = 25 adults completes a reaction time task. The sample mean score is x̄ = 78.4, with a sample standard deviation of s = 9.0. Build a 95% confidence interval for the population mean μ.

The 95% confidence interval is 74.68 to 82.12. Notice what the correction cost. Had you carelessly used z* = 1.96, the margin would have been 3.53 and the interval 74.87 to 81.93. That is clearly too narrow, and too confident.

Conditions, and how t collapses into z

Any interval for a mean, the z version and the t version alike, rests on two assumptions. You should state and check them before you trust the math in either worked example above. First, the data must come from a random sample (or a randomized experiment), and the observations must be independent. When sampling without replacement, a practical check is that the sample is less than 10% of the population. Second, the sampling distribution of x̄ must be about normal. That holds if the population itself is about normal. Thanks to the Central Limit Theorem, it also holds if n is large enough. (n ≥ 30 is the usual rule of thumb, and more is needed if the data are badly skewed or have outliers.)

The table below shows the 95% critical value shrinking toward 1.96 as the sample grows. This is why software uses t for everything. With n = 100, the difference between 1.984 and 1.960 is tiny, but with n = 10 it is not.

Sample size ndf = n − 1t* at 95%z* at 95%How much wider is t?
542.7761.960+42%
1092.2621.960+15%
25242.0641.960+5%
50492.0101.960+3%
100991.9841.960+1%
very large→ ∞→ 1.9601.9600%
If you had to work out s, you must use t. That is the whole rule, and it is easier than any flowchart. If σ is handed to you from outside the data, use z. If the standard deviation was worked out from the sample you are studying, use t with df = n − 1. Using z with a small sample is one of the most common errors on statistics exams. It always errs in the same direction: too narrow and too confident.
Interactive Draw real samples and watch a confidence interval for a mean get built out of them, x̄ ± (multiplier × standard error), switching between the z case where σ is known and the t case where σ must be estimated with s on n − 1 degrees of freedom, then run 2,000 simulated studies to see which multiplier actually keeps its promise. Open full ↑
Key points
  • σ known: x̄ ± z*(σ/√n). σ unknown: x̄ ± t*(s/√n), with df = n − 1.
  • The t distribution has heavier tails than z, which widens the interval to pay for estimating σ.
  • As n grows, t* comes closer and closer to z*. At 95%, the target value is 1.96.
  • Conditions: random and independent observations, plus a population that is about normal or a large enough n.

Section 3A confidence interval for a proportion

A binomial histogram with a smooth normal curve laid over it showing the normal approximation
Reference. The normal approximation to the binomial distribution. It is the basis for the success-failure condition behind a proportion interval. Source and license: see the figure credits

Counting instead of measuring

Sometimes the variable is not a measurement but a yes or no answer. Did the patient respond to treatment? Did the voter approve? Did the part pass inspection? Then the parameter of interest is a population proportion p. The point estimate is the sample proportion p̂ = x/n, where x is the number of “successes.”

Counts follow a binomial distribution, which is lumpy and discrete. But when n is big enough, a smooth normal curve comes very close to that binomial histogram, just as the figure above shows. Then the normal curve tools from Section 2 apply again. The standard error of a sample proportion works out to √[p(1 − p)/n]. Since p is the very thing we do not know, we put in p̂ instead:

p̂ ± z* · √[p̂(1 − p̂)/n]

Note that this one uses z, not t. There is no separate standard deviation to estimate here. For a yes or no variable, the proportion is the mean, and it sets the spread all by itself. So there is no extra degrees of freedom fix to make.

The conditions: check them first

This formula is an approximation, and it is a bad one when the sample is small or the proportion is close to 0 or 1. Three conditions protect you.

ConditionHow to checkWhy it matters
Random sampleThe data came from random selection or random assignmentWithout it the estimate is biased, and no formula can repair bias
Independence (10% rule)n < 10% of the population when sampling without replacementKeeps the standard error formula valid
Success-failurenp̂ ≥ 10 and n(1 − p̂) ≥ 10At least about 10 of each outcome, or the binomial is too skewed for a normal curve

Worked example. In a random sample of n = 400 adults, x = 148 say they exercise regularly. Build a 95% confidence interval for the population proportion p.

The 95% confidence interval is 0.323 to 0.417, or about 32% to 42%. This is just the kind of interval a news outlet squeezes into “37%, plus or minus about 5 points.”

Percentage points are not percent

When a result is itself a percentage, words get slippery. A margin of error of 4.7 percentage points means the endpoints are 32.3% and 41.7%. It does not mean 4.7% of 37%, which would be a margin of only 1.7 points. Always say “percentage points” when you mean adding or subtracting on a percentage scale. The difference shows up in news about polls, in quality reports and in write ups of clinical trials alike.

One more practical note. Political polls most often publish a single “margin of error” worked out at the most cautious case, p̂ = 0.5, because that is where p̂(1 − p̂) is largest. That is why a poll of 1,000 people is nearly always described as ± 3 points, whatever the actual percentages came out to.

The formula does not fix a bad sample. Every condition after “random sample” is a technical detail, but the first one is not. Say your 400 people were volunteers who saw a link online. The math still runs and the interval still prints, but the answer means nothing. That is because the margin of error counts only random sampling variation. It never counts selection bias, people who did not reply or a badly worded question.
Interactive Draw real samples, build p-hat plus or minus z* times its standard error from the actual counts, and check the conditions, with an exact binomial coverage calculation that shows a "95%" interval capturing p only 87% of the time when successes are scarce. Open full ↑
Key points
  • For a proportion: p̂ ± z*√[p̂(1 − p̂)/n], using z instead of t.
  • Check random sampling, the 10% independence rule and the success-failure condition (np̂ ≥ 10 and n(1 − p̂) ≥ 10).
  • Report the margin in percentage points, not as a percent of the estimate.
  • Variability is largest at p̂ = 0.5, which is why published poll margins assume that worst case.

Section 4Margin of error and sample size

Curves showing margin of error falling as sample size grows, drawn separately for several confidence levels
Reference. Margin of error plotted against sample size for several confidence levels. Higher confidence lifts every curve, and larger samples pull them all down. Source and license: see the figure credits

The three dials

The margin of error is a critical value times a standard error. So only three things can change an interval's width, and each behaves in a way you can predict.

Confidence level. Raising confidence raises the critical value, so the interval gets wider. This is not a flaw; it is the price of a stronger promise. If you want to be right almost every time, you must say something vaguer. At the extreme, a 100% confidence interval for average sleep would be “between 0 and 24 hours.” It is surely correct, and fully useless.

Sample size. Raising n shrinks the standard error, so the interval gets narrower. But the √n in the denominator sets the exchange rate, and it is a harsh one. To halve the margin of error, you must make the sample size four times as big (quadruple it). Doubling n only buys you a factor of 1/√2 ≈ 0.71.

Variability. More spread in the population (a larger σ or s) means a larger standard error and a wider interval. You most often cannot change this one, since it is a trait of the world, not of your study. Still, careful measuring and subgroups that are alike inside can reduce it.

ChangeCritical valueStandard errorMargin of errorInterval
Confidence 90% → 99%1.645 → 2.576 (up)unchangedupWider
Confidence 99% → 90%2.576 → 1.645 (down)unchangeddownNarrower
Sample size n × 4unchanged (roughly)÷ 2÷ 2Half as wide
Sample size n ÷ 4unchanged (roughly)× 2× 2Twice as wide
Population more spread outunchangedupupWider

Seeing the dials turn

Go back to the reaction time sample: x̄ = 78.4, s = 9.0, n = 25, df = 24 and a standard error of 1.80. Hold the data fixed, and turn only the confidence dial.

Confidencet* (df = 24)Margin of errorIntervalWidth
90%1.7111.711 × 1.80 = 3.0875.32 to 81.486.16
95%2.0642.064 × 1.80 = 3.7274.68 to 82.127.44
99%2.7972.797 × 1.80 = 5.0373.37 to 83.4310.06

Now hold confidence at 95%, and turn only the sample size dial. Treat the standard deviation as a known σ = 9.0, so the multiplier stays fixed at 1.96:

Sample size nStandard error 9/√nMargin of error (1.96 × SE)Interval about x̄ = 78.4
259/5 = 1.803.5374.87 to 81.93
1009/10 = 0.901.7676.64 to 80.16
4009/20 = 0.450.8877.52 to 79.28

Each fourfold jump in n cuts the margin exactly in half. Going from 25 to 400 people, sixteen times the data, buys a margin one quarter as large.

Planning a study: solving for n

Turn the formula around, and you get a planning tool. Decide the margin of error E you can live with, pick your confidence level and solve.

For a mean. From E = z*σ/√n, solving gives n = (z*σ/E)2. Say a small first (pilot) study suggests σ ≈ 12, and you want a 95% interval with a margin no larger than 2 points.

For a proportion. From E = z*√[p(1−p)/n], solving gives n = z*2p(1−p)/E2. If you have no earlier estimate of p, use p = 0.5. That makes p(1−p) as large as it can be, 0.25, and so gives the safest (largest) answer. For a 95% interval with a margin of 3 percentage points:

That number should look familiar. It is why national polls so often sample around a thousand people. About a thousand people buys a 3 point margin, and pushing to 1 point would take about 9,600.

Round up, never down, and never round the sample size to a “nicer” number. You cannot recruit 138.3 people, and 138 would leave the margin a little larger than the one you promised. Rounding up is the only direction that keeps the promise. The same logic explains why researchers recruit extra people. You plan for 139 and enroll 150, because some people will drop out and take your margin of error with them.
Interactive Drag the sample size and the confidence level and watch a real interval widen and narrow against a fixed axis: the square-root law that makes precision expensive, and how to solve for n before collecting a single observation. Open full ↑
Key points
  • Higher confidence → larger critical value → wider interval. There is no free lunch.
  • Larger n → smaller standard error → narrower interval, but only at the rate 1/√n. Make n four times as big to halve the margin.
  • For a mean, n = (z*σ/E)2. For a proportion, n = z*2p(1−p)/E2, using p = 0.5 when nothing is known.
  • Always round the sample size you need up to the next whole person.

Section 5Interpreting a confidence interval correctly

A set of 95 percent confidence intervals drawn as error bars around several estimates
Reference. A display of 95% confidence intervals. Each bar is one interval made from one sample, and the confidence level describes the method that made them. Source and license: see the figure credits

The sentence that is right

Here is a template you can use every time, and it is worth writing down word for word:

“We are 95% confident that the interval from 74.68 to 82.12 contains the true mean reaction time score for the population.”

Three parts make it correct: the confidence level, the interval and a clear statement of the parameter in context, meaning whose mean, of what and measured how. Drop any one of them, and the sentence loses its meaning.

And what does the 95% attach to? Not to this interval. It attaches to the method (the procedure). Imagine repeating the whole study over and over, thousands of times. Each time, you draw a fresh random sample, work out x̄ and s and build the interval. Each repeat gives a different interval, centered somewhere slightly different, with a slightly different width. In the long run, about 95% of those intervals will contain the true μ, and about 5% will miss it fully. That long run success rate is the coverage probability, and it is the only thing 95% ever meant.

The catch is that you built just one interval, and you cannot tell whether yours is one of the 95% or one of the 5%. Your interval either contains μ or it does not. There is no partial credit and no randomness left to describe, since μ is a fixed number and your endpoints are now fixed numbers too.

The four sentences that are wrong

Each of the following is something real people write: students, journalists and now and then published researchers. Each is wrong, and it is worth knowing just why.

Wrong statementWhy it failsWhat it should say
“There is a 95% probability that μ lies in this interval.”μ is a fixed constant, and the endpoints are now fixed numbers. The probability is 0 or 1; we just do not know which. The 95% describes the method over the long run.“95% of intervals built this way capture μ.”
“95% of the data values fall between 74.68 and 82.12.”This mixes up the spread of single people with how exact an estimate is. An interval for a mean is most often far narrower than the data.“This interval estimates the mean, not the range of scores.”
“95% of future sample means will fall in this interval.”Future sample means vary around μ, not around your own x̄. The real capture rate for that claim is well under 95%.“The interval estimates μ, not the location of future samples.”
“The interval contains 80, so we have proved μ = 80.”An interval lists believable values, all of them at once. 74.7 is just as much ‘in’ the interval as 80 is.“80 is a believable value for μ, and so is every other number in the interval.”

A fifth error deserves its own mention, because it travels with confidence intervals so often. A p-value is not the probability that the null hypothesis is true. It is the probability of seeing data at least as extreme as yours, assuming the null hypothesis is true. Confidence intervals and p-values are two views of the same math, and they share the same discipline. Both are statements about how data behave under a hypothesis. Neither is ever a statement about how likely a hypothesis is.

The same discipline rules the language of decisions. Say an interval contains a claimed value, or in the same way, the matching test does not reach significance. Then the correct phrase is fail to reject, never accept. Failing to reject means only that the data were consistent with that value, not that the value is true. The interval 74.68 to 82.12 is just as consistent with 80 as it is with 74.7 or 82.1, and it cannot single one of them out. Absence of evidence against a value is not evidence for it. A wide interval most often means you had too little data to tell anything apart at all.

What an interval is genuinely good for

Used correctly, a confidence interval does three jobs a single p-value cannot. It shows the size of the effect, not just whether one exists. It shows how exact your estimate is (its precision) through its width. A narrow interval around a small effect and a huge interval around a large one tell very different stories. And it supports a quick check of significance. If a 95% interval for a difference does not contain 0, the matching two sided test rejects at α = 0.05. If a 95% interval for a mean does not contain 80, a two sided test of μ = 80 rejects at α = 0.05.

Last, keep the interval's scope honest. A margin of error measures random sampling variation only. It does not cover a biased sampling frame, people who refused to answer, a leading question, a tool that was set up wrong or data entered wrong. Those errors can dwarf the margin of error, and no amount of extra sample size will shrink them. More data collected badly just give you a tighter interval around the wrong number.

Say “confident,” not “probability.” The word “confident” exists in statistics just because “probability” would be wrong here. It is a deliberate signal that you are describing how reliable a method is across many imagined samples. You are not describing the chance that one fixed number sits between two other fixed numbers. When you catch yourself writing “there is a 95% chance that μ...,” stop and rewrite.
Interactive Draw 100 samples, build 100 confidence intervals, and count how many capture the true mean, then test seven interpretations of the number against the picture. Open full ↑
Key points
  • The correct form: “We are C% confident that the interval (a, b) contains the true parameter in context.”
  • The confidence level describes the method over the long run: about 95% of intervals built this way catch the parameter.
  • A CI is not about data values and not about future sample means, and it does not give a probability to a fixed μ.
  • A value inside the interval is believable (plausible), not proven. “Fail to reject” never means “accept.”
  • The margin of error covers random sampling variation only, never bias, people who did not reply or measurement error.

The chapter in one breath

  • A point estimate is a single best guess. Because of sampling error, it is almost surely a little wrong, so we report a range instead.
  • Every confidence interval is point estimate ± (critical value × standard error), and the width of the interval is twice the margin of error.
  • For a mean with σ known, use x̄ ± z*(σ/√n). With σ unknown, use x̄ ± t*(s/√n) with df = n − 1.
  • The t distribution has heavier tails to pay for estimating σ, and it comes closer and closer to z as n grows. At 95%, z* = 1.96.
  • For a proportion, use p̂ ± z*√[p̂(1−p̂)/n] after checking random sampling, the 10% rule and success-failure (at least 10 of each outcome).
  • Higher confidence widens the interval. A larger n narrows it only at the rate 1/√n, so making n four times as big halves the margin.
  • To plan a study, solve n = (z*σ/E)2 for a mean, or n = z*2p(1−p)/E2 for a proportion. Use p = 0.5 when in doubt, and always round up.
  • “95% confident” describes the method over the long run, not a probability for this one interval. The margin of error covers random variation only, never bias.

ReferenceWords worth knowing

A quick reference for the words in this chapter. Skim it now, then come back whenever a term in a formula or a reading stops making sense.

Central Limit Theorem
The result that, for a large enough sample, the sampling distribution of x̄ is about normal, whatever the population's shape. It is what allows the normal curve critical values used in these intervals.
Confidence interval
An interval estimate for a population parameter, worked out as point estimate ± margin of error and reported with a confidence level.
Confidence level
The long run percentage of intervals built by a given method that would catch the true parameter. Common choices are 90%, 95% and 99%.
Coverage probability
The actual long run share of intervals from a method that contain the parameter. A good method has coverage close to its stated confidence level.
Critical value
The multiplier (z* or t*) applied to the standard error. It is chosen from a distribution table to match the confidence level you want.
Degrees of freedom (df)
The number that picks which t curve to use. For a one sample interval for a mean, df = n − 1.
Interval estimate
A range of believable values for a parameter, as opposed to a single number.
Margin of error
The half width of a confidence interval: critical value × standard error. It measures random sampling variation only.
Parameter
A fixed fact in numbers about a whole population, such as μ or p. It is unknown and does not vary from sample to sample.
Point estimate
A single number estimate of a parameter, worked out from sample data, such as x̄ for μ or p̂ for p.
Population proportion (p)
The true share of the population with a given trait. It is the parameter estimated by p̂.
Prediction interval
An interval meant to contain a future single observation instead of a parameter. It is always wider than a confidence interval for the mean.
Sample proportion (p̂)
The share of successes in the sample, x/n. It is the point estimate for p.
Sampling distribution
The distribution of a statistic's values across all possible samples of a given size. Its standard deviation is the standard error.
Sampling error
The natural variation of an estimate from sample to sample. It is not a mistake, and it is the only thing a margin of error accounts for.
Standard error
The standard deviation of a statistic's sampling distribution: σ/√n or s/√n for a mean, and √[p̂(1−p̂)/n] for a proportion.
Statistic
A number worked out from sample data, such as x̄, s or p̂. Unlike a parameter, it varies from sample to sample.
Student's t distribution
A family of symmetric, bell shaped curves with heavier tails than the normal, labeled by degrees of freedom. It is used when σ must be estimated by s.
Success-failure condition
The rule that np̂ ≥ 10 and n(1 − p̂) ≥ 10. It makes the normal approximation to the binomial good enough for a proportion interval.
t critical value (t*)
The multiplier taken from the t distribution with n − 1 degrees of freedom. At 95%, it is 2.064 for df = 24, and it shrinks toward 1.96 as df grows.
Width
The full length of a confidence interval, upper endpoint minus lower endpoint. It is exactly twice the margin of error.
z critical value (z*)
The multiplier taken from the standard normal curve: 1.645 for 90%, 1.960 for 95% and 2.576 for 99% confidence.

Check yourself

1. Write the general skeleton of any confidence interval, and name the two pieces that multiply together to form the margin of error.
Point estimate ± margin of error, where margin of error = critical value × standard error. The critical value (z* or t*) comes from the confidence level. The standard error measures how much the estimate varies from sample to sample.
2. A survey reports 46% support with a margin of error of 4 percentage points. State the interval and its width.
The interval is 42% to 50%, and its width is 8 percentage points. The margin of error is the half width, so the full interval spans twice the margin.
3. A process with known spread has σ = 6. A random sample of n = 64 gives x̄ = 120. Build a 95% confidence interval for μ, showing your math.
118.53 to 121.47. Standard error = 6/√64 = 6/8 = 0.75. Margin of error = 1.96 × 0.75 = 1.47. Then 120 − 1.47 = 118.53 and 120 + 1.47 = 121.47. Because σ is known, z* = 1.96 is correct here.
4. Why do we use t instead of z when σ is unknown, and what are the degrees of freedom for a one sample interval?
Estimating σ with s adds extra uncertainty. So the t distribution's heavier tails give a larger multiplier and a wider interval to match. df = n − 1. Using z with a small sample makes the interval too narrow, and its true coverage lower than promised.
5. A sample of n = 16 parts has x̄ = 40.0 mm and s = 2.0 mm. With t* = 2.131 at 95% for df = 15, work out the interval.
38.93 mm to 41.07 mm. Standard error = 2.0/√16 = 2.0/4 = 0.50. Margin of error = 2.131 × 0.50 = 1.0655, about 1.07. Then 40.0 − 1.07 = 38.93 and 40.0 + 1.07 = 41.07.
6. In a random sample of 500 shoppers, 200 used a loyalty card. Check the conditions, and build a 95% interval for p.
The conditions pass, and the interval is 0.357 to 0.443 (about 36% to 44%). p̂ = 200/500 = 0.40. np̂ = 200 ≥ 10 and n(1−p̂) = 300 ≥ 10. Standard error = √[(0.40)(0.60)/500] = √0.00048 = 0.02191. Margin of error = 1.96 × 0.02191 = 0.0429. Then 0.40 ± 0.043.
7. A researcher has n = 30 and p̂ = 0.05. Should she use the standard proportion interval? Explain.
No, because the success-failure condition fails. np̂ = 30(0.05) = 1.5, which is far below 10. With so few successes, the binomial distribution is too skewed for a normal approximation, and the interval would not be reliable. (It can even reach below 0.) She needs a much larger sample or another method.
8. With everything else fixed, what happens to an interval when you move from 95% to 99% confidence, and what is the trade off?
The critical value rises from 1.96 to 2.576, so the margin of error and the interval both get wider. The trade off is precision for reliability. You are right more often in the long run, but your statement is vaguer. A 100% interval would be surely correct and tell you nothing.
9. You now have a margin of error of 4.0 with n = 100. What sample size would give a margin of 2.0, and why is it not 200?
You need n = 400, because the standard error shrinks as 1/√n, not as 1/n. Halving the margin means making the sample four times as big. Doubling to 200 would only cut the margin by a factor of 1/√2 ≈ 0.71, to about 2.83.
10. Plan a poll. You want a 95% interval with a margin of error of 2 percentage points, and you have no earlier estimate of p. How many people must you survey?
2,401 people. Use the cautious p = 0.5, so p(1−p) = 0.25. Then n = (1.96)2(0.25)/(0.02)2 = 3.8416 × 0.25 / 0.0004 = 0.9604/0.0004 = 2401. Since it comes out exactly, no rounding is needed. But any result with a fraction must always be rounded up.
11. A 95% confidence interval for a population mean is 12.4 to 15.6. Write a correct reading. Then explain why “there is a 95% probability that μ is between 12.4 and 15.6” is wrong.
Correct: “We are 95% confident that the interval from 12.4 to 15.6 contains the true population mean.” The probability version is wrong because μ is a fixed constant, and 12.4 and 15.6 are now fixed numbers. The interval either contains μ or it does not, so the probability is 0 or 1. The 95% describes the method over the long run: about 95% of intervals built this way from repeated random samples would catch μ.
12. A poll of 1,200 online volunteers reports 62% agreement, ± 2.7 points. There are two problems. What does the margin of error fail to cover, and what would you conclude about a claimed true value of 50%?
The margin of error covers random sampling variation only. It says nothing about the selection bias of volunteers who picked themselves, people who did not reply or a leading question, and those errors are likely far larger here. In pure math terms, the interval is 59.3% to 64.7%, which leaves out 50%. So a two sided test of p = 0.5 would reject at α = 0.05. But since the sample is not random, that conclusion cannot be trusted. Collecting more data badly would only give a tighter interval around the wrong number.
Statistics Easy Read · Chapter 10

The Logic of Hypothesis Testing

Every interesting result comes with a nagging question: could that have happened by chance? A hypothesis test is a formal, honest way to answer it. You write down the boring explanation and ask how surprising your data would be if that boring explanation were true. Then you let the answer guide your decision, without letting it dictate. The machinery is simple math, but the reasoning is where people get lost, and where careless researchers publish nonsense. This chapter is about the reasoning. It covers what a null hypothesis really claims, what a p-value really measures and what it plainly does not measure. It covers the two ways a test can be wrong. And it shows why a "significant" finding can still be worth nothing at all.

By the end of this chapter you can

  • State a null hypothesis and an alternative hypothesis correctly, in terms of population parameters.
  • Choose between a one-tailed and a two-tailed alternative, and explain why the choice comes before the data.
  • Define the p-value as a conditional probability, and work one out from a test statistic.
  • Name the three or four things a p-value is often and wrongly said to mean.
  • Use a significance level (α) to reach a decision, and use the words reject and fail to reject exactly.
  • Tell a Type I error from a Type II error, and work out the power of a simple test.
  • Explain how sample size drives p-values, and why huge studies find tiny effects "significant."
  • State and check the assumptions a test rests on, and explain why a p-value depends on those too.
  • Report a result using an effect size and a confidence interval, and read that interval correctly.
  • Explain why a significant result does not by itself prove causation.

Section 1Null and alternative hypotheses

Two overlapping distributions showing the null hypothesis distribution and the alternative hypothesis distribution
Reference. The null distribution and the alternative distribution side by side. A hypothesis test asks which world your data look like they came from. Source and license: see the figure credits

The courtroom, and why we start with the boring explanation

A hypothesis test is built like a criminal trial. The defendant is presumed innocent, and the prosecution must bring evidence strong enough to overturn that presumption. In statistics, the presumption of innocence is called the null hypothesis, written H0. It is always the dull, no news, nothing special explanation. The drug does nothing, the two groups are the same, the coin is fair or the population mean is just what everyone has always said it is.

Against it stands the alternative hypothesis, written Ha (some books write H1). This is the claim you truly care about: the drug helps, the groups differ, the coin is loaded or the mean has shifted. Notice the imbalance: the burden of proof sits fully on Ha. If the evidence is weak, we do not conclude that H0 is true. We simply say the prosecution failed. That imbalance is the most important idea in this chapter, and Section 3 comes back to it.

Writing them correctly: four rules

Most errors in stating hypotheses are mechanical, and four rules fix nearly all of them.

Rule 1: hypotheses are about parameters, never statistics. A hypothesis is a claim about the unknown population. It may be about μ (a population mean), p (a population proportion), σ (a population standard deviation) or the difference between two of those. It is never a claim about x̄ or the sample proportion p̂, because you can see those, so there is nothing to guess. Writing "H0: x̄ = 20" is like making a guess about a number already printed in front of you.

Rule 2: the equals sign lives in H0. The null must pin the parameter to one exact value, because that value is what lets us build a probability model and work out anything at all. So write H0: μ = 20, never H0: μ ≠ 20.

Rule 3: H0 and Ha must not overlap. Together, they should cover the choices without both being true at once, as in μ = 20 versus μ ≠ 20, or μ ≤ 20 versus μ > 20.

Rule 4: the direction is chosen before you look at the data. A two-tailed (two sided) alternative, μ ≠ 20, says "different in either direction." A one-tailed (one sided) alternative, μ > 20 or μ < 20, says "different in this one direction." It is only fair when the direction was decided ahead of time for a real reason, and when a difference the other way would be of no interest at all. Peeking at the data, noticing that the sample mean came out high and then declaring a one-tailed test is a way of quietly doubling your chance of a false positive. When in doubt, go two-tailed.

Research questionH0HaTails
Is the mean commute still 20 minutes?μ = 20μ ≠ 20Two
Does the new curriculum raise scores above the old mean of 72?μ ≤ 72μ > 72One (upper)
Is the defect rate below the promised 3%?p ≥ 0.03p < 0.03One (lower)
Do two teaching methods differ in mean score?μ1 − μ2 = 0μ1 − μ2 ≠ 0Two
Is the coin fair?p = 0.5p ≠ 0.5Two

Setting up a real one

A transit office states that the mean one way trip for students at a large school is 20 minutes. You suspect it has crept upward, but you would also want to know if it had dropped, so you go two-tailed. You survey a random sample of n = 36 students and find x̄ = 22.4 minutes with s = 6.0 minutes.

The hypotheses, in the language of the population, are

H0: μ = 20 minutes   versus   Ha: μ ≠ 20 minutes.

Your sample came out 2.4 minutes high. That by itself proves nothing, since samples wobble. The question the rest of this chapter answers is this: if the mean really were 20, how often would a sample of 36 wobble this far? We carry this example through Sections 2, 3 and 4.

You can never "prove the null." A test can give evidence against H0. But no amount of unremarkable data proves that a parameter equals exactly 20.000… . Absence of evidence is not evidence of absence. That is most true with a small sample, where you might have missed a real difference fully. That is why the verdict is "not guilty," not "innocent."
Interactive Write H₀ and Hₐ for six real claims, choosing the parameter, the null value, and the direction, and watch the null curve slide, the shaded tail flip, and the p-value recompute live, then see what it costs to pick the direction after looking at the data. Open full ↑
Key points
  • H0 is the no effect, no difference explanation. Ha carries the claim and the burden of proof.
  • Hypotheses are statements about parameters (μ, p, σ), never about sample statistics.
  • The equality goes in H0, because a fixed value is what makes the probability math possible.
  • Choose one-tailed vs two-tailed before seeing the data. When unsure, use two-tailed.

Section 2The p-value

A distribution curve with the tail area beyond the observed test statistic shaded to represent the p-value
Reference. The p-value as a shaded tail area: the probability, under H0, of a result at least as extreme as the one seen. Source and license: see the figure credits

What it actually measures

Assume, for the sake of argument, that H0 is true. Under that assumption, the sample statistic has a known sampling distribution, a pattern of wobble you can predict. The p-value is the probability, worked out inside that assumed world, of getting a result at least as extreme as the one you actually got.

Written as a conditional probability, it is:

p = P( a test statistic at least this extreme  |  H0 is true and the model's assumptions hold )

Read the vertical bar as "given." Everything to the right of it is assumed, not concluded. A small p-value means your data would be a rare event in the null world, which gives grounds for doubting the null world. A large p-value means your data are perfectly ordinary there. They are unsurprising, and so they tell you little.

Computing one, step by step

Back to the trips: H0: μ = 20 and Ha: μ ≠ 20, with n = 36, x̄ = 22.4 and s = 6.0.

Step 1: standard error. The typical wobble of a sample mean is

SE = s / √n = 6.0 / √36 = 6.0 / 6 = 1.00 minute.

Step 2: test statistic. Measure the gap between what you saw and what H0 predicted, in units of that wobble:

t = (x̄ − μ0) / SE = (22.4 − 20) / 1.00 = 2.40, with df = n − 1 = 35.

Your sample mean sits 2.40 standard errors above the null value.

Step 3: tail area. On a t distribution with 35 degrees of freedom, the area beyond t = 2.40 in one tail is about 0.011. Ha is two sided, so "at least as extreme" also includes results 2.40 SEs below 20. So we double it:

p ≈ 2 × 0.011 = 0.022.

Step 4: say it in plain English. Say the true mean trip really were 20 minutes. Then about 2.2% of random samples of 36 students would land at least 2.4 minutes away from 20, in one direction or the other. Our sample is in that unusual 2.2%. That is real evidence against μ = 20, but not overwhelming evidence.

What that calculation assumed

Every number above depends on a set of assumptions. A one sample t test has three that you must state and check before reporting anything:

The same three conditions carry through Sections 3, 4 and 5. When σ is known and used in place of s, as in the power math of Section 4, the test statistic becomes a z instead of a t. But the sampling, independence and shape rules do not change.

Four things a p-value is not

These misreadings are so common that they show up in press releases, textbooks and published papers. Learn them as a list of things you will never say.

People sayWhy it is wrongWhat is actually true
"p = 0.022, so there is a 2.2% chance the null is true."Reverses the conditioning. The p-value is P(data | H0), not P(H0 | data).P(H0 | data) cannot be computed without prior probabilities; classical testing never supplies them.
"There is a 97.8% chance the alternative is true."Same reversal, mirrored. 1 − p is not the probability of Ha.1 − p is just the area of the null distribution outside the tail. It says nothing about Ha.
"p = 0.022 means the effect is big."This mixes up evidence with size. A tiny effect gets a small p-value if n is huge.Magnitude is reported by an effect size and a confidence interval (Section 5).
"p = 0.022 means it will replicate 97.8% of the time."The chance of a repeat result depends on the true effect and the new study's power, not on p.A study with p just under 0.05 often replicates barely half the time.
"p = 0.30 proves there is no effect."A large p-value is a failure to detect, not a demonstration of absence.An underpowered study returns large p-values even when the effect is real (Section 4).

One more caution hides in the fine print of the definition. The p-value assumes H0 and every model assumption: random sampling, independence, the right shape of distribution and no picking and choosing of which results to report. A small p-value is evidence that something in that whole package is wrong. If your sample was a convenience sample of your friends, the thing that is wrong may not be H0.

The bar in P(A | B) points one way. The probability that someone is a professional basketball player, given that they are over 7 feet tall, is high. The probability that someone is over 7 feet tall, given that they are a professional basketball player, is a very different number. A p-value is the second kind of statement, about your data. People habitually read it as the first kind of statement, about your hypothesis.
Interactive Drag your result along the null distribution to shade the tail and watch the p-value recompute, then run thousands of simulated studies in a world where the null is true and count the extreme ones yourself. Open full ↑
Key points
  • The p-value is P(result this extreme or more | H0 true and assumptions hold).
  • Work it out in three moves: standard error → test statistic → tail area. Double the tail for a two sided Ha.
  • It is not the probability that the null is true, not the probability of a repeat result and not a measure of effect size.
  • A small p-value puts the whole model in doubt, not just H0, so check your sampling and assumptions first.

Section 3Significance and decisions

A normal curve divided into a central non-rejection region and shaded rejection regions in the tails
Reference. Rejection regions in the tails versus the region in the middle where you do not reject. This is the shape behind a significance level. Source and license: see the figure credits

Alpha: an error budget you set in advance

A p-value is a sliding (continuous) measure of surprise. Sooner or later, though, somebody has to do something: approve the drug, change the course plan or keep the old machine. Turning a sliding measure into a yes or no decision takes a cutoff, and that cutoff is the significance level, written α.

α is not a law of nature. It is a choice about how much risk of a false alarm you are willing to accept. Setting α = 0.05 means this: if H0 is true, I accept a 5% chance of wrongly rejecting it. Fields that can afford a few false alarms use 0.05. Some fields use 0.01, 10−6 or smaller. These are fields where a false alarm is a disaster, or where thousands of tests are run at once, such as genetics and particle physics. The one rule you cannot bend is that α is fixed before you see the data. Choosing α after the p-value arrives is not statistics; it is bookkeeping in reverse.

The decision rule, both ways

The rule itself is one line: if p ≤ α, reject H0; if p > α, fail to reject H0. Another route that gives the same answer compares the test statistic with a critical value instead. That is the picture the figure above shows. The tails cut off by α form the rejection region, and a statistic landing there leads to rejection.

Here is our trip study, with α = 0.05 set ahead of time:

The p-value route. p ≈ 0.022. Since 0.022 ≤ 0.05, reject H0.

The critical value route. With df = 35 and a two-tailed α = 0.05, the critical value is t* = 2.030. So the rejection region is t < −2.030 or t > 2.030. Our t = 2.40 lands beyond 2.030, so we reject H0. The verdict has to be the same, because the two routes are the same statement seen from two sides.

Now say the sample mean had been 21.6 instead of 22.4. Then

t = (21.6 − 20) / 1.00 = 1.60, and with df = 35 the two-tailed p ≈ 0.119.

Here 0.119 > 0.05, and 1.60 does not reach 2.030, so we fail to reject H0. Note with care what we have and have not learned. The sample mean was still 1.6 minutes above 20. We have not shown that the trip is 20 minutes. We have shown that a wobble this size is unremarkable in a sample of 36. So this study cannot tell the difference between "no change" and "a change we were too small to detect."

Say it right

OutcomeSay thisNever say this
p ≤ α"Reject H0." / "The result is statistically significant at α = 0.05.""Ha is proven." / "The null is false."
p > α"Fail to reject H0." / "There is insufficient evidence of a difference.""Accept H0." / "We proved there is no difference."
Any outcomeReport the estimate, the interval, and the exact p-value."p < 0.05" with no effect size.
p = 0.051"Weak evidence; the interval runs from … to …""No effect." / "Trending toward significance."

Why the fuss about "fail to reject" instead of "accept"? Because the test was never designed to gather evidence for H0. The whole setup, with its sampling distribution, tail area and rejection region, was built inside the assumption that H0 is true. So it can only ever tell you whether that assumption strains, and it has no way to confirm it. A jury that acquits has not proven innocence; it has found the evidence too weak.

0.049 and 0.051 are the same result. α = 0.05 is a habit, not a cliff. Two studies on opposite sides of it differ by an amount no scientist could care about. Yet one gets called "significant" and the other "null." Treat α as a decision rule for when you must act. Treat the p-value itself as what it is: a sliding, and rather noisy, measure of surprise.
Interactive Drag the significance level across a live two-tailed z-test and watch one unchanged p-value flip from "fail to reject" to "reject": then see the long-run error rate that your choice of alpha actually buys. Open full ↑
Key points
  • α is the false alarm rate you agree to accept, chosen before the data arrive.
  • The decision rule: p ≤ α → reject H0 and p > α → fail to reject. The critical value route always agrees.
  • "Fail to reject" ≠ "accept," because the test cannot give evidence in favor of the null.
  • Significance is crossing a cutoff, not a measurement. Report the estimate and interval alongside it.

Section 4Type I and Type II errors

Two overlapping distributions with shaded areas labeled for significance level and statistical power
Reference. Significance level and power drawn together. The null distribution's tail is α, the alternative distribution's overlap is β, and what remains is power. Source and license: see the figure credits

Two ways to be wrong

Reality has two states and your test has two verdicts, so there are four combinations: two right and two wrong.

 H0 is actually trueH0 is actually false
Reject H0Type I error: false alarm. Probability = α.Correct decision. Probability = 1 − β = power.
Fail to reject H0Correct decision. Probability = 1 − α.Type II error: missed detection. Probability = β.

A Type I error is convicting the innocent: declaring an effect that is not there. You control it directly, because α is its probability. That is what setting α = 0.05 buys you. A Type II error is letting the guilty go free: missing an effect that truly is there. Its probability, β, is not something you set directly. It falls out of how big the real effect is, how noisy your measurements are, how large your sample is and what α you chose.

Power is the good half of that second column. Power = 1 − β, the probability that your study detects an effect of a given size when that effect is real. Power belongs to a study design plus one named alternative. There is no such thing as "the power of a test" without naming the effect size you want to catch.

Computing power, with numbers

Go back to the trip study. To keep the math clean, say the population standard deviation is known to be σ = 6.0 minutes, so we can work with the standard normal. Test H0: μ = 20 against Ha: μ ≠ 20 at α = 0.05 with n = 36. Ask: if the true mean is really 21.5 minutes, what is the chance that we detect it?

Step 1: find the rejection region in real units. SE = σ/√n = 6.0/6 = 1.00. A two-tailed α = 0.05 uses z* = 1.96, so we reject whenever

x̄ > 20 + 1.96(1.00) = 21.96   or   x̄ < 20 − 1.96(1.00) = 18.04.

Step 2: move into the true world. If μ = 21.5, then x̄ is centered at 21.5 with the same SE = 1.00. Standardize both edges against 21.5:

upper: z = (21.96 − 21.5)/1.00 = 0.46   →   P(Z > 0.46) = 1 − 0.6772 = 0.3228

lower: z = (18.04 − 21.5)/1.00 = −3.46   →   P(Z < −3.46) = 0.0003

Step 3: add. Power = 0.3228 + 0.0003 ≈ 0.32, so β ≈ 1 − 0.32 = 0.68.

Read that again, because it is sobering. Say the trip truly has risen by a minute and a half. This study of 36 people misses it about 68% of the time. Most of its "no significant difference" conclusions would be wrong.

Step 4: fix it with sample size. Make n four times as big, 144. Then SE = 6.0/√144 = 6.0/12 = 0.50, and we reject when x̄ > 20 + 1.96(0.50) = 20.98 (or below 19.02). Standardize against the true 21.5:

z = (20.98 − 21.5)/0.50 = −1.04   →   P(Z > −1.04) = 0.8508

The lower edge adds almost nothing, so power ≈ 0.85. Making n four times as big halved the standard error and took power from 32% to 85%. This is just what a power analysis does before a study is run. Pick the smallest effect worth detecting and a target power (0.80 is the usual floor). Then solve for the n you need.

The four levers, and the trade-off

LeverMove it this wayEffect on powerCost
Sample size nIncreaseRises: SE shrinks like 1/√nTime, money, participants
True effect sizeLarger real differenceRisesNot yours to choose
Variability σDecrease (better measurement, tighter design)RisesEffort, instrumentation
Significance level αIncrease (0.01 → 0.05)RisesMore Type I errors

The last row is the central tension of the whole framework. With everything else held fixed, the only way to make Type I errors rarer is to shrink the rejection region. That makes Type II errors more common, and the reverse is also true. You cannot cut both by adjusting α. The one lever that improves both at once is a bigger, cleaner sample. That is why sample size is the design question that matters most.

Which error is worse depends fully on context, and that is a judgment about results in the real world, not about statistics. Think of screening for a cancer that can be treated. There, a Type II error (missing a real case) is far worse than a Type I error (a false alarm settled by a follow up test). So screening tests are tuned on purpose toward high power. In a criminal trial, the system accepts many Type II errors on purpose to avoid Type I errors.

A result that is not significant, from a study with too little power, means almost nothing. Before you take "no difference was found" seriously, ask what effect the study could have detected. Say its power against a meaningful effect was 30%. Then its failure to find one tells you about as much as a coin flip. Reporting it as evidence of no effect is a real error.
Interactive Tap through the four-cell error matrix while three live sliders, sample size, true effect, and alpha, recompute the overlapping null and alternative distributions, a power curve, and 200 simulated studies, showing why a bigger sample cures misses but never false alarms. Open full ↑
Key points
  • Type I error = rejecting a true H0 (a false alarm). Its probability is exactly α.
  • Type II error = failing to reject a false H0 (a missed detection). Its probability is β.
  • Power = 1 − β, always stated against a named effect size. 0.80 is the usual minimum.
  • Lowering α raises β. Only a larger n or less variability improves both kinds of error at once.

Section 5Statistical versus practical significance

A point estimate shown with a confidence interval around it on a number line
Reference. A point estimate with its confidence interval. This is the report that answers "how big?", which a p-value alone never does. Source and license: see the figure credits

Sample size manufactures significance

Look once more at the test statistic, and notice what is in the denominator:

t = (x̄ − μ0) / (s/√n)

Hold the top number fixed, the same real difference, and let n grow. The bottom number shrinks toward zero, so t grows without limit and the p-value slides toward zero. Any difference from H0, no matter how tiny, becomes statistically significant at a large enough sample size. Statistical significance answers "can we tell this is not exactly zero?" It never answers "is it big enough to care about?"

A worked pair: the significant triviality and the invisible whale

Study A. A supplement company follows n = 40,000 people and records each one's weight change over six months. It tests H0: μ = 0 against a two sided alternative. The mean change is 0.20 pounds, with s = 10 pounds. (This is a single sample of 40,000 changes, so the one sample formula SE = s/√n applies. Comparing two separate groups would need the two sample standard error instead.)

SE = s/√n = 10/√40000 = 10/200 = 0.05

t = 0.20 / 0.05 = 4.00, giving p < 0.0001, which is wildly "significant."

95% confidence interval: 0.20 ± 1.96(0.05) = 0.20 ± 0.098 → (0.10, 0.30) pounds.

The effect size (Cohen's d) = difference / s = 0.20/10 = 0.02, which is negligible by any standard.

The interval is the punchline. We are confident the true effect is somewhere between a tenth and three tenths of a pound. It is real and it is not zero, but it is fully worthless to a person trying to lose weight. It is significant, and trivial.

Study B. A small trial follows n = 25 people over the same six months and tests the same H0: μ = 0. The mean weight change is 4.0 pounds, again with s = 10 pounds.

SE = 10/√25 = 10/5 = 2.00

t = 4.0/2.00 = 2.00, df = 24, two-tailed p ≈ 0.057, which is "not significant."

95% CI: 4.0 ± 2.064(2.00) = 4.0 ± 4.13 → (−0.13, 8.13) pounds.

The effect size d = 4.0/10 = 0.40, a small to moderate effect worth chasing.

Study B failed the α = 0.05 cutoff, but its interval fits with an eight pound benefit. The honest conclusion is not "the supplement does not work." It is "this study was too small to say." Study A is the more significant result and the less important one. Study B is the less significant result and the more promising one.

 Practically importantPractically trivial
Statistically significantThe goal: a real, meaningful effect, well measured.Huge n detecting a difference nobody would act on (Study A).
Not statistically significantPromising but underpowered: wide interval, needs a bigger study (Study B).Genuinely uninteresting, or genuinely no effect. The interval tells you which.

What to report instead

A complete result has three parts, and only the third is the p-value. They are the estimate (how big), the interval (how exactly we know it) and the test (how surprising it would be under the null). Study A, reported properly, reads: "0.20 lb, 95% CI (0.10, 0.30), d = 0.02, p < 0.0001." No reader is fooled for a second.

A fourth caution belongs with the other three, because it is the one most likely to end up in a headline. A significant test result does not prove that anything caused anything. A claim about cause gets its strength from the design, not from the size of a test statistic. That means assigning people at random, having a control condition and controlling for confounding variables. Study A's people chose to take a supplement. Whatever sets them apart from people who did not may also set them apart in diet, income or exercise, and the p-value cannot tell those explanations apart. The same rule holds for a link seen between two measured variables. A small p-value on a correlation says the link is unlikely to be zero, and nothing more. Significance answers "can this pattern be told apart from noise?" Only the design answers "why is the pattern there?"

One last point about precision, because it is misstated all the time. A 95% confidence interval is a statement about the method, not about this one interval. It means this: if you repeated the whole study endlessly and built an interval each time by this method, about 95% of those intervals would contain the true parameter. It does not mean there is a 95% probability that the true parameter lies inside the interval you just worked out. That interval either contains μ or it does not, because the parameter is a fixed number, not a random one. The 95% describes how reliable the machine that made it is over the long run.

Ask "how big?" before you ask "is it significant?" Decide ahead of time what difference would be large enough to change what you do. That is the minimum important difference. Then check whether your confidence interval rules it out. A test tells you whether zero is believable. Only the interval tells you whether the effect clears the bar you truly care about.
Interactive Hold a trivially small true drug effect fixed and slide the sample size from 10 to 500,000: a live two-tailed z-test drives p below 0.05 and on to 10⁻¹²³, while the overlapping population curves, Cohen's d, and the confidence interval show the effect never became worth treating. Open full ↑
Key points
  • Because SE = s/√n, large samples make any difference that is not zero statistically significant.
  • Statistical significance answers "not zero?" Practical significance answers "big enough to matter?"
  • Report an effect size and a confidence interval alongside the p-value, never the p-value alone.
  • A 95% CI describes how often the method succeeds over the long run, not a 95% probability for this one interval.
  • Significance never proves causation. That comes from randomization and control in the design, not from the p-value.

The chapter in one breath

  • H0 is the no effect explanation, and it carries the equality. Ha is your claim, and it carries the burden of proof. Both are statements about parameters, and the number of tails is chosen before you look.
  • The p-value is P(a result this extreme or more | H0 true and assumptions hold). It is worked out as the standard error, then the test statistic, then the tail area.
  • A p-value is not the probability that the null is true, not the probability of a repeat result and not a measure of how big the effect is.
  • α is a false alarm budget fixed ahead of time. p ≤ α means reject H0, and p > α means fail to reject, never "accept."
  • A Type I error (probability α) is a false alarm, and a Type II error (probability β) is a miss. Power = 1 − β is stated against a named effect size.
  • Shrinking α raises β, and the reverse. Only a larger n or less variability improves both, which is why power analysis comes before data collection.
  • Because SE shrinks with √n, a large enough study makes any trivial difference "significant," and a small study can miss a large one.
  • Every p-value depends on the test's assumptions as well as on H0: random sampling, independence and close enough to normal. State and check them before reporting.
  • Report the estimate, the confidence interval and the effect size. A 95% CI describes how the method behaves over the long run, not this interval's chance of being right.
  • Statistical significance is never evidence of causation. Only the design, meaning randomization, control and handling of confounders, can support a claim about cause.

ReferenceWords worth knowing

A quick reference for the words in this chapter. The definitions are worded to be exact, not casual, because in hypothesis testing the casual wording is most often the wrong one.

Alpha (α, significance level)
The highest probability of a Type I error you agree to accept, fixed before the data are seen. It is most often 0.05, but the value should suit how costly a false alarm would be.
Alternative hypothesis (Ha)
The statement about a population parameter that goes against H0 and states the claim being studied. It may be two sided (≠) or one sided (> or <).
Assumptions (of a test)
The conditions a test's math depends on. For a one sample t test, they are random sampling, independent observations and a sampling distribution close enough to normal. A p-value depends on these as well as on H0, so they must be stated and checked before the result is reported.
Beta (β)
The probability of a Type II error: failing to reject a false H0. It is not set directly. It depends on the effect size, variability, sample size and α.
Confidence interval
A range of parameter values made by a method that, used again and again, catches the true parameter a stated share of the time (for example, 95%). It measures precision, not the probability for one interval.
Critical value
The cutoff on the test statistic's null distribution that marks the edge of the rejection region for a given α. An example is z* = 1.96 for a two-tailed test at α = 0.05.
Effect size
A measure of how big a difference or relationship is, which does not depend on sample size. An example is Cohen's d, the mean difference divided by the standard deviation.
Fail to reject
The verdict when p > α: the evidence is too weak to overturn H0. It is not a conclusion that H0 is true.
Null hypothesis (H0)
The default statement of no effect, no difference or no change. It is pinned to one parameter value so that a sampling distribution can be built.
One-tailed (one-sided) test
A test whose alternative names a direction, so the whole rejection region sits in one tail. It is fair only when the direction is chosen ahead of time for real reasons.
Parameter
A fixed number that describes a population, such as μ, σ or p. Hypotheses are always about parameters.
Power
1 − β: the probability of correctly rejecting H0 when a named alternative is true. It rises with a larger n, larger true effects, less variability and a larger α.
Practical significance
Whether an effect is large enough to matter in the real world, judged against a minimum important difference. It is a separate question from statistical significance.
p-value
The probability, assuming H0 and all model assumptions are true, of getting a test statistic at least as extreme as the one seen.
Rejection region
The set of test statistic values, set by α, that lead to rejecting H0. It is the shaded tail area or areas of the null distribution.
Sampling distribution
The distribution a statistic would follow across all possible samples of a given size. It is the math object that makes a p-value possible to work out.
Standard error (SE)
The standard deviation of a sampling distribution. For a mean, SE = s/√n (or σ/√n when σ is known).
Statistic
A number worked out from a sample, such as x̄ or s. It is used to estimate a parameter and to test hypotheses about it.
Statistically significant
Describes a result whose p-value falls at or below the α set ahead of time. It means the data would be unusual if H0 were true, and it says nothing about size.
Test statistic
A standardized measure of the distance between the data seen and what H0 predicts, in standard errors. An example is t = (x̄ − μ0)/(s/√n).
Two-tailed (two-sided) test
A test whose alternative is simply "different," splitting the rejection region between both tails. It is the safe default when no direction was named beforehand.
Type I error
Rejecting H0 when it is actually true: a false positive. Its probability is exactly α.
Type II error
Failing to reject H0 when it is actually false: a false negative, or missed detection. Its probability is β.

Check yourself

1. A maker claims its bags average 500 grams. You suspect underfilling. Write H0 and Ha, and say how many tails you would use and why.
H0: μ ≥ 500 grams; Ha: μ < 500 grams; one-tailed (lower). The suspicion of underfilling points one way, and it is stated before the data are collected. Overfilling would not be a complaint. So a lower one-tailed test is fair. Note that the hypotheses are about μ, the population mean, and the equality lives on the null side.
2. What is wrong with writing "H0: x̄ = 500"?
Hypotheses must be about parameters, not statistics. You already know x̄, since you worked it out from your sample, so there is nothing to guess. The unknown amount is the population mean μ, and that is what H0 must be about.
3. A study reports p = 0.03. A coworker says, "So there is a 3% chance the null hypothesis is true." Correct them exactly.
The p-value is P(data this extreme or more | H0 true), not P(H0 true | data). It says that if the null were true, results this extreme would occur about 3% of the time. Working out the probability that H0 is true would need prior probabilities, which classical hypothesis testing never supplies.
4. A sample of n = 64 gives x̄ = 103 with s = 16, testing H0: μ = 100 two sided. Work out the SE and the test statistic.
SE = 16/√64 = 16/8 = 2.00; t = (103 − 100)/2.00 = 1.50 with df = 63. The sample mean sits 1.5 standard errors above the null value. The two-tailed p-value is about 0.14, so at α = 0.05 you would fail to reject H0.
5. Why do we say "fail to reject H0" instead of "accept H0"?
The whole calculation is done inside the assumption that H0 is true. So the test can only detect strain on that assumption, and it has no way to confirm it. A large p-value may mean there is no effect. Or it may mean the study was too small to detect a real one. Like a jury that acquits for lack of evidence, we decline to convict without declaring innocence.
6. Define Type I and Type II errors, and give the probability of each.
Type I = rejecting a true H0 (false positive), with probability α. Type II = failing to reject a false H0 (false negative), with probability β. You set α directly. β follows from the effect size, variability, sample size and α.
7. A researcher lowers α from 0.05 to 0.01 to be "more careful." What happens to the two error probabilities, and to power?
The Type I error probability falls to 0.01, but β rises and power falls. Shrinking the rejection region makes false alarms rarer and missed detections more common. The only lever that improves both at once is a larger sample (or less noise in measuring).
8. Test H0: μ = 20 against a two sided alternative with σ = 6, n = 36 and α = 0.05. The rejection region is x̄ > 21.96 or x̄ < 18.04. If the true mean is 21.5, what is the power?
About 0.32. SE = 6/√36 = 1.00. Standardize the upper edge against the true mean: z = (21.96 − 21.5)/1.00 = 0.46, and P(Z > 0.46) = 0.3228. The lower edge gives z = −3.46, adding about 0.0003. Power ≈ 0.32, so β ≈ 0.68. The study misses this effect about two thirds of the time.
9. In Question 8, the sample size is raised to n = 144. Show why power rises to about 0.85.
SE = 6/√144 = 0.50, so the upper cutoff becomes 20 + 1.96(0.50) = 20.98. Standardizing against 21.5 gives z = (20.98 − 21.5)/0.50 = −1.04, and P(Z > −1.04) = 0.8508. Making n four times as big halved the standard error. That pulled the cutoff much closer to the true mean and raised power from 32% to about 85%.
10. A single sample of n = 40,000 people has a mean weight change of 0.20 lb with s = 10 lb, tested against H0: μ = 0, and reports p < 0.0001. Work out the 95% CI and Cohen's d, then explain what they mean.
SE = 10/√40000 = 0.05; CI = 0.20 ± 1.96(0.05) = (0.10, 0.30) lb; d = 0.20/10 = 0.02. The effect is real and measured exactly, but it is negligible: a tenth to three tenths of a pound, with an effect size of 0.02. This is statistical significance without practical significance, made by a huge sample.
11. A study with n = 25 finds a mean weight change of 4.0 lb, s = 10 lb, p ≈ 0.057 and a 95% CI of (−0.13, 8.13). Is "the treatment does not work" a fair conclusion?
No. The result is not significant, but the interval fits with a benefit of up to about 8 pounds. SE = 10/√25 = 2.00 and t = 4.0/2.00 = 2.00 with df = 24, so this simply failed to clear α = 0.05. With d = 0.40, the honest conclusion is that the study was too small to decide, not that the effect is absent.
12. State exactly what "95% confidence" means, and say what it does not mean.
It means that if the study were repeated over and over, with an interval built each time by this method, about 95% of those intervals would contain the true parameter. It does not mean there is a 95% probability that the parameter lies inside the one interval you worked out. The parameter is a fixed number, and that interval either contains it or it does not. The 95% is a trait of the method, not of this result.
Statistics Easy Read · Chapter 11

One-Sample Tests

You have a claim about the world, and you have one sample of data. A hypothesis test is the careful way to ask whether the data are surprising enough to make you doubt the claim. This chapter builds a single five step method that never changes. Then it pours three different one sample cases into it. The first is a mean when the population standard deviation is somehow known. The second is a mean when it is not, which is the far more common case and the reason Student's t distribution exists. The third is a proportion. Every formula here is the same idea in different clothes: how far is the estimate from the claim, measured in standard errors? Get comfortable with that one sentence, and the rest is bookkeeping.

By the end of this chapter you can

  • State a null and an alternative hypothesis in symbols and in words, and choose one-tailed or two-tailed correctly.
  • Carry out the five steps of any hypothesis test in order, without memorizing a separate recipe for each test.
  • Work out and read a z-test for a mean when σ is known.
  • Work out and read a t-test for a mean when σ is unknown, and explain degrees of freedom.
  • Work out and read the one-proportion z-test, including why the standard error uses p0 and not p̂.
  • State a p-value correctly, and say just what it is not.
  • Check the assumptions each test needs, and say what happens when they fail.
  • Tell statistical significance apart from practical importance, and link a test to its matching confidence interval.

Section 1The five steps of a test

A distribution curve with the rejection region shaded in the tail and the non-rejection region in the middle
Reference. Rejection and non-rejection regions. The tail area cut off by the critical value is where a test statistic is judged surprising. Source and license: see the figure credits

One procedure, every test

People often try to memorize hypothesis testing as a pile of unrelated formulas. It is not that. There is one method, and the only thing that changes between tests is which formula you plug into step 3. Learn the skeleton once, and the whole chapter shrinks into something you can manage.

A hypothesis test begins with a claim about a population parameter. That is a fixed, unknown number describing the whole population, like the population mean μ or the population proportion p. You cannot see the parameter. You can only see a statistic worked out from a sample, such as x̄ or p̂. The test asks a single question: if the claim were true, how unusual would a sample like mine be?

StepWhat you doWhat it looks like
1State the hypotheses about the parameter: before looking at the dataH0: μ = 500    Ha: μ ≠ 500
2Choose the significance level α and check the conditions the test requiresα = 0.05; random sample, normal enough
3Compute the test statistic: distance from the claim, in standard errorsz or t = (estimate − claim) ÷ SE
4Find the p-value (or compare to the critical value)p = 0.0124; or |z| > 1.96?
5Decide and interpret in context: in plain words, about the original claim“Reject H0; there is evidence the mean differs from 500.”

Two rules govern step 1. First, the null hypothesis H0 always holds the equality. It is the “nothing unusual is happening” statement, the exact number the math needs. Second, the alternative hypothesis Ha states what you are actually looking for. It must be chosen from the research question, never from the direction the data happened to fall. Picking a one sided alternative after seeing which way the sample leaned doubles your real error rate while pretending it did not.

Reading a p-value without getting it wrong

The p-value is the probability of getting a test statistic at least as extreme as the one you saw, worked out under the assumption that the null hypothesis is true. That last part is not decoration; it is the whole meaning of the number. A small p-value says: “data like these would be rare if H0 held.” That gives grounds for doubting H0.

Say a test gives z = 2.50 with a two-tailed alternative. From the standard normal, the upper tail beyond 2.50 has an area of 0.0062. The alternative is two sided, so both tails count: p = 2 × 0.0062 = 0.0124. Compared with α = 0.05, we have 0.0124 < 0.05, so we reject H0. Compared with a stricter α = 0.01, we have 0.0124 > 0.01, and we would fail to reject. It is the same data and the same evidence; only the cutoff changed. That is worth thinking about, because it shows α is a habit you adopt, not a trait of nature.

Statement about p = 0.0124Correct?Why
“If H0 were true, results this extreme happen about 1.2% of the time.”YesThis is the definition
“There is a 1.2% probability that H0 is true.”NoThe p-value assumes H0; it cannot also measure its probability
“There is a 98.8% probability the alternative is true.”NoSame error, wearing a hat
“The effect is large and important.”Nop-values shrink with sample size; they measure evidence, not size
“A large p-value proves H0 is true.”NoAbsence of evidence is not evidence of absence: we say fail to reject

Notice the awkward phrase fail to reject, chosen on purpose. We never “accept” the null. A test that comes up empty may mean the null is true. Or it may just mean the sample was too small to detect a real difference. Courts acquit for lack of evidence without declaring the defendant a saint, and statistics does the same.

Two ways to be wrong

You are deciding with uncertainty, so you can go wrong in two directions. A Type I error is rejecting a true null, which is a false alarm. Its long run rate is exactly α, which is why you choose α before you look. A Type II error is failing to reject a false null, which is a miss, with rate β. The power of a test is 1 − β, the chance of catching a real effect when one exists. Power rises with larger samples, larger true effects, less variability and a larger α.

H0 is actually trueH0 is actually false
Reject H0Type I error (rate α)Correct decision (power = 1 − β)
Fail to reject H0Correct decisionType II error (rate β)
A p-value is not the probability that the null hypothesis is true. This is the most common error in all of applied statistics, and it turns up in published papers with sad regularity. The p-value is worked out assuming H0. It is the probability of the data given the hypothesis, not the probability of the hypothesis given the data. Those two amounts are truly different numbers. Swapping them is the same mistake as mixing up “most people with this rare disease test positive” with “most people who test positive have this rare disease.”
Interactive Walk three different one-sample tests through the identical five-step procedure, hypotheses, α and conditions, test statistic, p-value, decision, on samples you actually draw, with every number, curve and verdict recomputed live. Open full ↑
Key points
  • Every test follows the same five steps, and only the formula in step 3 changes.
  • H0 holds the equality. Ha comes from the question, never from the data.
  • A p-value is P(data this extreme given H0 is true), not P(H0 is true).
  • We fail to reject; we never accept. α is the Type I error rate, and power = 1 − β.

Section 2Z-test for a mean

The standard normal distribution curve centered at zero with the horizontal axis marked in standard deviations
Reference. The standard normal distribution: the reference curve that every z test statistic is judged against. Source and license: see the figure credits

Where the formula comes from

Take repeated random samples of size n from a population with mean μ and standard deviation σ. The sample means x̄ bounce around, but not wildly and not without a pattern. They center on μ, and they spread out with a standard deviation of σ∕√n. That amount is the standard error of the mean. The √n in the denominator is the math version of a very natural fact: bigger samples give steadier averages. Make the sample four times as big, and you halve the standard error.

Say that, on top of that, the sampling distribution of x̄ is normal. That happens either because the population is normal, or because n is large enough for the Central Limit Theorem to take over. Then standardizing gives a familiar amount:

z = ( x̄ − μ0 ) ∕ ( σ ∕ √n )

Read it out loud in plain English: how many standard errors is my sample mean away from the claimed mean? That is all a test statistic ever is. The z-test is the version you use when σ, the population standard deviation, is known ahead of time and does not have to be estimated from your data.

Be honest about how rare that is. In real research, you almost never know σ while still not knowing μ. The z-test earns its place in two ways. It is the honest tool when a factory process, a calibrated instrument or a standardized test has decades of history pinning σ down. And it is the clean stepping stone that makes the t-test in the next section easy to understand.

A worked example

A bottling line is supposed to fill bottles to a mean of 500 mL. Years of process records show that the fill standard deviation is steady at σ = 4.0 mL. A quality worker pulls a random sample of n = 25 bottles and finds a sample mean of x̄ = 498.2 mL. Is the line off target? Test at α = 0.05.

Step 1: hypotheses. The line could drift either way, and both directions matter, so the test is two-tailed:
H0: μ = 500     Ha: μ ≠ 500

Step 2: level and conditions. α = 0.05. The sample is random, σ is known from the history of the process and fill volumes from a machine are about normal. The conditions are met.

Step 3: test statistic. First find the standard error, then standardize:

SE = σ ∕ √n = 4.0 ∕ √25 = 4.0 ∕ 5 = 0.80 mL
z = (498.2 − 500) ∕ 0.80 = (−1.8) ∕ 0.80 = −2.25

The sample mean sits 2.25 standard errors below the target.

Step 4: p-value. From the standard normal table, the area below z = −2.25 is 0.0122. The alternative is two sided, so we double it:

p = 2 × 0.0122 = 0.0244

The critical value route agrees. For a two-tailed test at α = 0.05, the critical values are ±1.96, and |−2.25| = 2.25 > 1.96. So the statistic lands in the rejection region.

Step 5: decide and explain. Since 0.0244 < 0.05, reject H0. There is statistically significant evidence at the 5% level that the mean fill volume differs from 500 mL, and the sample suggests underfilling by about 1.8 mL. Now say the worker only cared about underfilling and had stated Ha: μ < 500 before collecting data. Then the p-value would be the single lower tail, 0.0122.

The confidence interval says the same thing

A two sided test at level α and a 100(1 − α)% confidence interval are two views of one calculation. The 95% interval here is

498.2 ± 1.96 × 0.80 = 498.2 ± 1.57 → (496.63, 499.77)

The claimed value 500 lies outside that interval, which is just why the test rejected. The rule holds in general. A two sided test rejects H0: μ = μ0 at level α exactly when the 100(1 − α)% interval leaves out μ0. The interval is often the more useful report, because it also tells you the believable size of the gap, which a p-value never does.

Alternativep-value from zCritical value at α = 0.05Reject when
Ha: μ ≠ μ02 × P(Z > |z|)±1.96|z| > 1.96
Ha: μ > μ0P(Z > z)+1.645z > 1.645
Ha: μ < μ0P(Z < z)−1.645z < −1.645
What “95% confident” really means. It is a statement about the method, not about this one interval. Say you repeated the whole business, sampling, working out and building the interval, over and over without end. Then about 95% of the intervals made would contain the true μ. The interval you are holding either contains μ or it does not, because μ is a fixed number, not a random one. Saying “there is a 95% chance μ is between 496.63 and 499.77” treats the parameter as random, and that is not what the method gives.
Interactive Run a complete one-sample z-test on real simulated data: draw a sample, watch its mean form, see the test statistic land on the standard normal curve beside the critical value and the shaded p-value, then repeat the whole test thousands of times to watch the rejection rate settle onto α when the null is true and onto the test's power when it is not. Open full ↑
Key points
  • z = (x̄ − μ0) ∕ (σ∕√n): the estimate's distance from the claim, in standard errors.
  • The standard error σ∕√n shrinks with √n, so four times the data gives half the wobble.
  • Use the z-test only when σ is truly known, not estimated from the sample.
  • A two sided test at α rejects exactly when the matching 100(1 − α)% confidence interval leaves out μ0.

Section 3T-test for a mean

Several Student t distribution curves with different degrees of freedom, showing heavier tails at small df
Reference. Student's t distributions at several degrees of freedom. The tails thicken as df falls, and the curve comes closer to the normal curve as df grows. Source and license: see the figure credits

The problem with substituting s for σ

In real work, σ is unknown, so you estimate it with the sample standard deviation s. The formula looks almost the same:

t = ( x̄ − μ0 ) ∕ ( s ∕ √n )

But something subtle has changed. The z formula had one random amount in it, x̄. The t formula has two, because s jumps around from sample to sample as well. That extra source of noise makes extreme values more common than the normal curve predicts. William Sealy Gosset worked this out around 1908, while running small batch experiments at a brewery. He published under the pen name “Student,” and so it is called Student's t distribution.

The t distribution is symmetric and bell shaped like the normal, and it is centered at zero. But it has heavier tails, meaning more probability far from the center. Heavier tails mean larger critical values, so the t-test needs more evidence before it will reject. That is not a flaw. It is the honest price of not knowing σ.

Degrees of freedom

The t distribution is not one curve but a family, labeled by degrees of freedom. For a one sample t-test, df = n − 1.

Why n − 1 instead of n? Working out s means first working out x̄ from the same data, and that costs you one piece of independent information. Here is a concrete view. If you know four deviations from the mean, the fifth is forced, because the deviations must add up to zero. That is five numbers with four of them free, so four degrees of freedom. Every degree of freedom you spend estimating something is one less left to measure variability.

As df grows, s becomes a reliable stand in for σ, the extra noise fades and the t curve comes closer and closer to the standard normal. You can see this in any table of critical values.

dfnTwo-tailed t* at α = 0.05Comment
562.571Much stricter than 1.96
10112.228Still noticeably stricter
15162.131Closing in
20212.086 
30312.042About 4% above the normal value
60612.000Nearly indistinguishable
∞-1.960The standard normal itself

A worked example

A transit planner claims that the mean one way trip to work in a city area is 30 minutes. A random sample of n = 16 workers gives x̄ = 33.4 minutes with s = 6.4 minutes. Test the claim at α = 0.05.

Step 1. H0: μ = 30     Ha: μ ≠ 30 (the claim could be wrong in either direction).

Step 2. α = 0.05. The sample is random. n = 16 is small, so we need the distribution of trip times to be about symmetric with no big outliers. Look at a dotplot or boxplot before going on.

Step 3.

SE = s ∕ √n = 6.4 ∕ √16 = 6.4 ∕ 4 = 1.60 minutes
t = (33.4 − 30) ∕ 1.60 = 3.4 ∕ 1.60 = 2.125    with df = 16 − 1 = 15

Step 4. The two-tailed critical value at df = 15 is t* = 2.131. Our statistic, 2.125, falls a hair short of it, so the two-tailed p-value is a hair above 0.05. Software gives p ≈ 0.051.

Step 5. Since 0.051 > 0.05, we fail to reject H0. At the 5% level, there is not quite enough evidence to conclude that the mean trip differs from 30 minutes. The matching 95% interval tells the same story: 33.4 ± 2.131 × 1.60 = 33.4 ± 3.41 → (29.99, 36.81), which contains 30, but only barely.

Now watch what a larger sample does. Say the same x̄ = 33.4 and s = 6.4 had come from n = 25:

SE = 6.4 ∕ √25 = 6.4 ∕ 5 = 1.28     t = 3.4 ∕ 1.28 = 2.656, df = 24, t* = 2.064, p ≈ 0.014

The estimated effect is the same, 3.4 minutes, but now we reject with room to spare. Nothing about the world changed; only how exact our measurement was. This is why “not significant” must never be reported as “no difference.” It is also why a study's sample size belongs in every conclusion you read.

α = 0.05 is a habit, not a cliff. A p-value of 0.051 and one of 0.049 carry almost the same evidence. Yet the first is often written up as “no effect” and the second as “an effect.” Report the actual p-value, the confidence interval and the sample size. Let the reader see how strong the evidence is, instead of a verdict made up at a cutoff.
Interactive Drag the degrees of freedom and watch the t curve tighten onto the normal, with a logarithmic tail zoom, a real sampling simulation showing why estimating s fattens the tails, and live-computed critical values that reveal what using 1.960 too soon actually costs. Open full ↑
Key points
  • t = (x̄ − μ0) ∕ (s∕√n). Use it whenever σ is unknown, which is nearly always.
  • Estimating σ with s adds noise, so the t curve has heavier tails and larger critical values than the normal.
  • df = n − 1, because one degree of freedom was spent working out x̄.
  • As df → ∞, the t distribution becomes the standard normal.

Section 4Test for a proportion

A binomial histogram overlaid with a smooth normal curve showing the normal approximation
Reference. The normal approximation to the binomial. It is the math permission slip behind the one-proportion z-test. Source and license: see the figure credits

Counting successes

Often the variable is made of groups (categorical) instead of numbers: yes or no, faulty or fine, voted or did not. The parameter of interest is then the population proportion p. The estimate is the sample proportion p̂ = x∕n, where x is the number of successes.

The count x follows a binomial distribution. When the sample is large enough, a smooth normal curve comes very close to that lumpy binomial histogram, and that is what lets us reuse the z tools. Under H0: p = p0, the sampling distribution of p̂ is about normal, with mean p0 and standard error √( p0(1 − p0) ∕ n ). Standardizing gives the one-proportion z-test:

z = ( p̂ − p0 ) ∕ √( p0(1 − p0) ∕ n )

Note this with care: there is no t-test for a proportion. For a mean, the center and the spread are separate parameters, so estimating the spread costs you degrees of freedom. For a proportion, they are locked together. The variability p0(1 − p0) is fully set by the value p0 that the null already names. Nothing extra is being estimated, so no t fix is needed.

A worked example

A policy group claims that 60% of adults in a region support a proposed measure. An independent random sample of n = 400 adults finds 216 supporters. Does this go against the claim? Test at α = 0.05.

Step 1. H0: p = 0.60     Ha: p ≠ 0.60

Step 2. α = 0.05. Check the success/failure condition using p0: np0 = 400(0.60) = 240 ≥ 10, and n(1 − p0) = 400(0.40) = 160 ≥ 10. The sample is random, and 400 adults is far under 10% of the region's population, so the observations are close enough to independent. The conditions are met.

Step 3. Find the sample proportion and the null standard error:

p̂ = 216 ∕ 400 = 0.54
SE0 = √( 0.60 × 0.40 ∕ 400 ) = √( 0.24 ∕ 400 ) = √0.0006 = 0.02449
z = (0.54 − 0.60) ∕ 0.02449 = (−0.06) ∕ 0.02449 = −2.45

Step 4. The area below z = −2.45 is 0.00714. It is two sided, so p = 2 × 0.00714 = 0.0143.

Step 5. Since 0.0143 < 0.05, reject H0. There is statistically significant evidence that the true support rate differs from 60%, and the sample points to something closer to 54%.

The one place students reliably slip

The test and the confidence interval use different standard errors, and that is not a contradiction. A test is run in the null's world, so it uses the null's variability, p0(1 − p0). A confidence interval assumes no one value, so it must estimate variability from the data, using p̂(1 − p̂).

For our data, the 95% interval is

SE = √( 0.54 × 0.46 ∕ 400 ) = √0.000621 = 0.02492
0.54 ± 1.96 × 0.02492 = 0.54 ± 0.0488 → (0.491, 0.589)

The interval leaves out 0.60, which agrees with the rejection. Because the two standard errors differ a little, a test and interval can now and then disagree in borderline cases. That is a known quirk, not an error on your part.

SituationStandard errorWhy
Hypothesis test√( p0(1 − p0)∕n )Everything is computed assuming H0 is true
Confidence interval√( p̂(1 − p̂)∕n )No null value is assumed, so estimate from the data
Condition to checknp0 ≥ 10 and n(1 − p0) ≥ 10The normal approximation to the binomial must hold
If the condition failsExact binomial testCompute tail probabilities from the binomial directly
Percentages are not proportions until you divide. Every amount in these formulas is a decimal between 0 and 1. Feeding 54 and 60 into the formula instead of 0.54 and 0.60 gives a wildly wrong answer, and it is the most common math failure on proportion problems. Convert first, then work it out, then convert back to a percentage only in your final sentence.
Interactive Run a one-proportion z-test end to end on real simulated data: set the count, watch z land on the curve beside the critical value and shaded p-value, compare the exact binomial distribution against the normal curve the test substitutes for it, and repeat the whole test thousands of times to see its true long-run rejection rate. Open full ↑
Key points
  • p̂ = x∕n, and the test statistic is z = (p̂ − p0) ∕ √(p0(1 − p0)∕n).
  • The test's standard error uses p0, and the confidence interval's uses p̂.
  • Check np0 ≥ 10 and n(1 − p0) ≥ 10. Otherwise, use the exact binomial test.
  • There is no t-test for a proportion, because the null value sets the variability and nothing extra is estimated.

Section 5Assumptions

Sampling distributions of the sample mean drawn from a non-normal population at increasing sample sizes, becoming more bell-shaped
Reference. Sampling distributions of the sample mean from a population that is not normal. As n grows, the distribution of x̄ becomes normal. Source and license: see the figure credits

Three conditions, in order of importance

A p-value is only as trustworthy as the assumptions used to work it out. Every one sample test rests on three conditions, and they are plainly not equally forgiving.

1. Random sampling. The data must come from a random sample of the population you want to describe, or from a randomized experiment. This is the assumption that cannot be rescued. Say your sample is a convenience sample, an online poll where people picked themselves or the volunteers who happened to show up. Then x̄ estimates the wrong thing, and no amount of data fixes it. A bigger biased sample simply gives you a more exact wrong answer.

2. Independence. Each observation must carry information not already held in the others. Sampling with replacement promises it. Sampling without replacement is close enough, as long as n is no more than about 10% of the population. Clustered data break this badly. Measuring five patients from each of ten clinics is not fifty independent observations. Treating it as if it were gives a standard error that is too small and a p-value that looks too impressive.

3. Approximate normality of the sampling distribution. This is the one everyone worries about, and it is the most forgiving of the three. What must be about normal is the sampling distribution of x̄, not the raw data. The Central Limit Theorem says that as n grows, the distribution of x̄ comes closer and closer to normal, whatever the population's shape. Skewed populations just need larger samples to get there.

Sample sizeWhat the data must look likeHow to check
n < 15Close to symmetric, no outliers, no clear skewDotplot or boxplot, and be conservative
15 ≤ n < 40Mild skew acceptable; outliers still a problemHistogram plus a normal quantile plot
n ≥ 40Even fairly skewed data are usually fineStill plot the data; look for outliers and errors
Any n, proportionsnp0 ≥ 10 and n(1 − p0) ≥ 10Arithmetic, not a plot

Robustness, and what to do when a condition fails

A method is robust if it still works well enough when its assumptions are broken a little. The one sample t-test is famously robust to data that are not normal, once n is moderate. But it is not robust to outliers in small samples. A single mistyped value can drag both x̄ and s and flip a conclusion. And no test is robust to a sample that is not random, or to observations that depend on each other. Those failures do not just widen the uncertainty; they make it worthless.

TestRequiresIf violated
z-test for μRandom, independent, σ known, x̄ normalIf σ is estimated, use the t-test instead
t-test for μRandom, independent, population not strongly skewed for small nIncrease n, or use a nonparametric test such as the sign or signed-rank test
One-proportion z-testRandom, independent, np0 ≥ 10 and n(1 − p0) ≥ 10Use the exact binomial test
All threeHypotheses fixed before seeing the dataThe stated α is fiction; the real error rate is higher

The assumption nobody writes down

Beyond the math conditions sits one about method. The hypotheses, the significance level and the direction of the alternative must be settled before the data are looked at. Say you test many outcomes and report only the significant one, or switch to a one-tailed alternative after seeing which way the sample fell. Either one pushes the Type I error rate far above the α you claimed. With twenty independent tests at α = 0.05, you expect one “significant” result by chance alone, even if nothing at all is going on.

Last, remember what a test cannot tell you. Statistical significance means “probably not just noise.” It does not mean large, important or worth acting on. With n = 1,000,000, a difference of 0.02 mL in fill volume gives a standard error of 4.0/√1,000,000 = 0.004 mL and z = 5. That is wildly significant, and fully irrelevant. With n = 8, a difference that would change how patients are treated may fail to reach significance. Report the estimate and its confidence interval alongside the p-value. Judge importance on the scale of the actual measurement, such as minutes, milliliters or percentage points, not on the scale of the p-value.

The Central Limit Theorem fixes shape, not bias. A large n makes the sampling distribution of x̄ beautifully normal even when the population is skewed. But it does nothing at all about a sample that was not random. Convenience samples, surveys where people choose to reply and heavy nonresponse all give estimates centered on the wrong value. A large sample only tightens the interval around that wrong value. Design beats math every time.
Interactive Six real situations and four candidate procedures: decide which one-sample test belongs in each, then break the randomness, independence, and normality assumptions with sliders while a live simulation reports the false-alarm rate the test actually delivers instead of the 5% you asked for. Open full ↑
Key points
  • Random sampling is the unforgiving assumption, since no sample size repairs bias.
  • Independence holds if you sample at random and n is under 10% of the population. Clustering breaks it.
  • Normality applies to the sampling distribution of x̄, and the CLT gives it as n grows.
  • Hypotheses must be fixed before the data are seen, and significance is not the same as importance.

The chapter in one breath

  • Every hypothesis test is the same five steps: hypotheses, level and conditions, test statistic, p-value and a conclusion in context.
  • A test statistic always answers one question: how many standard errors is the estimate from the claim?
  • Use the z-test for a mean, z = (x̄ − μ0)∕(σ∕√n), only when σ is truly known.
  • Use the t-test, t = (x̄ − μ0)∕(s∕√n) with df = n − 1, when σ is estimated. It has heavier tails and larger critical values.
  • Use the one-proportion z-test, z = (p̂ − p0)∕√(p0(1 − p0)∕n). The test uses p0 in the SE, and the interval uses p̂.
  • A p-value is the probability of data this extreme given that the null is true, never the probability that the null is true.
  • We fail to reject instead of accepting. “Not significant” may only mean the sample was too small.
  • Every test assumes randomness, independence and close enough to normal, and randomness is the one nothing can repair.

ReferenceWords worth knowing

A quick reference for the words in this chapter. Skim it now, and come back to it whenever a term in a results section stops making sense.

Alpha (α), significance level
The cutoff chosen ahead of time for how much evidence is needed to reject H0. It is also the long run rate of Type I errors. It is most often 0.05, but that is a habit, not a law.
Alternative hypothesis (Ha)
The statement the researcher is looking for evidence of, written with ≠, > or <. It is chosen from the research question, never from the data seen.
Central limit theorem
The result that the sampling distribution of x̄ comes closer and closer to a normal distribution as n grows, whatever the shape of the population.
Critical value
The cutoff (z* or t*) that marks the edge of the rejection region for a chosen α and alternative.
Degrees of freedom (df)
The number of independent pieces of information left for estimating variability. It is n − 1 for a one sample t-test, because x̄ used up one.
Effect size
A measure of how big a difference is, on the scale of the data or standardized. It is the question a p-value does not answer.
Null hypothesis (H0)
The “no effect, no difference” statement that holds the equality. It is the assumption under which the p-value is worked out.
One-proportion z-test
The test of H0: p = p0 using z = (p̂ − p0) ∕ √(p0(1 − p0)∕n).
One-tailed (one-sided) test
A test whose alternative points in a single direction, which puts the whole rejection region in one tail. It must be named before data collection.
p-value
The probability, assuming H0 is true, of getting a test statistic at least as extreme as the one seen.
Power
1 − β: the probability of correctly rejecting a false null. It rises with a larger n, larger true effects, less variability and a larger α.
Rejection region
The set of test statistic values, in the tail or tails, that lead to rejecting H0 at the chosen α.
Robustness
A method's ability to work well enough when its assumptions are broken a little. The t-test is robust to data that are a bit off normal, but not to outliers in small samples.
Sample proportion (p̂)
The count of successes divided by the sample size, x∕n. It is the point estimate of the population proportion p.
Standard error
The standard deviation of a sampling distribution: σ∕√n for a mean with σ known, and s∕√n when it is estimated.
Statistically significant
Describes a result whose p-value falls below α. It means “unlikely to be noise alone,” not “large” or “important.”
Student's t distribution
A symmetric, bell shaped family of distributions labeled by degrees of freedom, with heavier tails than the normal. It comes closer and closer to the standard normal as df grows.
Test statistic
A standardized measure of how far the sample estimate lies from the null value, in standard errors. Here it is z or t.
Two-tailed (two-sided) test
A test whose alternative is ≠. It splits the rejection region between both tails and doubles the one tail probability to get the p-value.
Type I error
Rejecting a null hypothesis that is actually true: a false alarm. Its long run rate is α.
Type II error
Failing to reject a null hypothesis that is actually false: a miss. Its rate is β.
z-test
A test whose statistic is compared with the standard normal distribution. For a mean, it needs σ to be known.

Check yourself

1. List the five steps of a hypothesis test in order, and state what changes from one test to another.
(1) State H0 and Ha; (2) choose α and check conditions; (3) work out the test statistic; (4) find the p-value or compare with the critical value; (5) decide and explain in context. Only the formula in step 3 changes between tests. And even that is always (estimate − claim) ÷ standard error.
2. A study reports p = 0.03. A classmate says, “So there's only a 3% chance the null hypothesis is true.” Correct them.
That is wrong. The p-value is worked out assuming the null is true, so it cannot be the probability that the null is true. The correct reading: if H0 were true, results at least this extreme would occur about 3% of the time. It is the probability of the data given the hypothesis, not of the hypothesis given the data.
3. Why do we say “fail to reject H0” instead of “accept H0”?
A result that is not significant fits with the null being true or with a real effect that the study was too small to detect. Absence of evidence is not evidence of absence. The test never confirms the null; it only fails to overturn it.
4. A calibrated instrument has a known σ = 4.0. In a random sample of n = 25, x̄ = 498.2. The test is H0: μ = 500 against a two sided alternative. Work out the standard error, z and the p-value, and state the conclusion at α = 0.05.
SE = 4.0∕√25 = 0.80; z = (498.2 − 500)∕0.80 = −2.25; p = 2(0.0122) = 0.0244; reject H0. At the 5% level, there is evidence that the mean differs from 500. Put another way, |−2.25| is bigger than the critical value 1.96.
5. Why does the t distribution have heavier tails than the standard normal?
Because s is estimated from the same sample and varies from sample to sample. That adds a second source of randomness on top of the variation in x̄. The extra noise makes extreme standardized values more common, so the tails are thicker and the critical values larger. That is the honest price of not knowing σ.
6. Explain why the degrees of freedom for a one sample t-test are n − 1.
Working out s needs x̄, which is worked out from the same data, and that uses up one independent piece of information. Once you know n − 1 of the deviations from the mean, the last one is forced, because all n deviations must add up to zero.
7. A random sample of n = 16 gives x̄ = 33.4 and s = 6.4. Test H0: μ = 30 two sided at α = 0.05 (t* = 2.131 at df = 15). Work out t and decide.
SE = 6.4∕4 = 1.60; t = 3.4∕1.60 = 2.125 with df = 15. Since 2.125 < 2.131 (p ≈ 0.051), fail to reject H0. The 95% interval, 33.4 ± 2.131(1.60) = (29.99, 36.81), contains 30, barely. That is the same conclusion in interval form.
8. Use the same x̄ = 33.4 and s = 6.4, but with n = 25 (t* = 2.064 at df = 24). Redo the test. What does the change teach you?
SE = 6.4∕5 = 1.28; t = 3.4∕1.28 = 2.656 > 2.064, so reject H0 (p ≈ 0.014). The estimated effect is the same (3.4 minutes); only the precision changed. “Not significant” can simply mean the sample was too small, so sample size must be reported with every conclusion.
9. In a random sample of n = 400, 216 people support a measure. Test H0: p = 0.60 against a two sided alternative at α = 0.05, showing the conditions and the math.
Conditions: np0 = 240 ≥ 10 and n(1 − p0) = 160 ≥ 10. Then p̂ = 216∕400 = 0.54; SE0 = √(0.6 × 0.4∕400) = √0.0006 = 0.02449; z = −0.06∕0.02449 = −2.45; p = 2(0.00714) = 0.0143; reject H0. There is evidence that the true support rate is not 60%.
10. Why does the one-proportion z-test use p0 in the standard error, while the confidence interval uses p̂?
A test works out everything in the null's world, so it uses the null's variability, p0(1 − p0). A confidence interval assumes no one value of p, so it must estimate variability from the data, using p̂(1 − p̂). Because the two standard errors differ a little, a borderline test and interval can now and then disagree.
11. A researcher surveys 5,000 visitors to their own website and finds a highly significant result. Why does the huge sample size not rescue the study?
The sample is not random. It is a convenience sample of people who picked themselves, so the estimate is centered on the wrong value. The Central Limit Theorem fixes the shape of the sampling distribution, not bias. A larger biased sample just gives a narrower interval around the wrong number.
12. State the three conditions every one sample test needs. Rank them by how forgiving they are, and give one fix for the least serious failure.
Random sampling (least forgiving, since nothing repairs it), independence (sample at random and keep n under 10% of the population) and approximate normality of the sampling distribution of x̄ (most forgiving). For a normality failure, raise n so the CLT takes over, or switch to a test that does not assume a shape (a nonparametric test), such as the sign test or the signed-rank test. For proportions, use the exact binomial test when np0 or n(1 − p0) falls below 10.
Statistics Easy Read · Chapter 12

Two-Sample Tests

Almost every interesting question in statistics is a comparison. Does this treatment beat that one? Do these two groups of customers behave differently? Did the change we made actually change anything? A one sample test asks whether a single group differs from a fixed number. A two-sample test asks whether two groups differ from each other, and that is the question the world most often cares about. This chapter builds the four workhorse methods: two independent means, paired means, two proportions and the confidence intervals that go with them. It shows you just how to decide which one a study calls for. And it works the math all the way through, so you can see there is no magic in it.

By the end of this chapter you can

  • Tell when two samples are independent and when they are paired, and explain why the difference changes the analysis.
  • State the hypotheses, check the conditions and work out the test statistic for a two-sample t-test of independent means.
  • Shrink a matched pairs study to a single sample of differences, and run a paired t-test.
  • Carry out a two-proportion z-test, including the pooled proportion and the success-failure check.
  • Use a decision guide to choose the right test from the study design, and name a sensible other choice when conditions fail.
  • Build and correctly read confidence intervals for a difference of two means or two proportions.
  • Explain how a two sided test and a confidence interval mirror each other, and the one place that breaks down.
  • State just what a p-value and a 95% confidence interval do and do not mean.

Section 1Two independent means

Side-by-side box plots comparing the distribution of a numeric variable across two groups
Reference. Side by side box plots. They are the standard first look at a two group comparison, showing the center, spread and outliers for each group on one scale. Source and license: see the figure credits

Two groups, one question

Say you have measured a numeric outcome on two separate groups of subjects, such as a test score, a reaction time, a blood pressure or a delivery time. The group averages came out different. They always do. Two samples drawn from the very same population will differ by chance alone. The whole job of a two-sample test is to answer one question: is the gap we saw bigger than chance would easily produce?

The samples here are independent, which has an exact meaning. Knowing any value in group 1 tells you nothing about any value in group 2, and no subject appears in both groups. Two treatment arms assigned at random are independent. Men and women in one survey are independent. The same forty people measured in January and again in June are not, and that is Section 2's problem.

Write the population means as μ1 and μ2. The hypotheses are about the difference:

H0: μ1 − μ2 = 0     Ha: μ1 − μ2 ≠ 0

Notice what the null says: the two populations have the same mean. It does not say the two samples had the same mean. They plainly did not, or you would not be testing anything.

The test statistic, and where it comes from

Every test statistic in this book has the same shape: (what we saw) minus (what the null predicted), divided by how much that amount naturally wobbles. Our estimate of μ1 − μ2 is x̄1 − x̄2. Its wobble is measured by the standard error of the difference. Because the two samples are independent, their variances add, never their standard deviations:

SE = √( s12/n1 + s22/n2 )

and the test statistic is

t = ( x̄1 − x̄2 − 0 ) / SE

Since we estimated both standard deviations from data, the reference curve is a t distribution, not the normal. The degrees of freedom are the awkward part. Use Welch's approximation, which statistical software gives you by default and which you should use by default:

df = ( s12/n1 + s22/n2 )2 ÷ [ (s12/n1)2/(n1−1) + (s22/n2)2/(n2−1) ]

This is rarely a whole number, and that is fine. Working by hand without software, you may round the df down to the nearest whole number. That is cautious on purpose. It gives a slightly wider interval and a slightly larger p-value, so you never overstate your evidence.

ConditionWhat it meansHow to check it
Independence withinObservations inside each group do not influence one anotherRandom sample, or random assignment; sample under 10% of the population
Independence betweenNo subject appears in both groups; no natural pairingRead the study design: this is a design fact, not a data fact
Normality (or size)Each population is roughly normal, or each sample is largeA dot plot or box plot for each group. n ≥ 30 per group makes mild skew harmless.
OutliersNo single point is driving the differenceLook at the box plots; investigate, do not silently delete

A worked example, all the way through

A trainer compares two coaching formats. Format A: n1 = 12, x̄1 = 78.4 and s1 = 8.2. Format B: n2 = 15, x̄2 = 71.9 and s2 = 9.6. People were assigned at random, so the groups are independent. Test at α = 0.05, two sided.

Step 1: the observed difference. 78.4 − 71.9 = 6.5 points.

Step 2: the standard error. First find the two pieces:
s12/n1 = 8.22/12 = 67.24/12 = 5.6033
s22/n2 = 9.62/15 = 92.16/15 = 6.1440
The sum is 11.7473, so SE = √11.7473 = 3.4274.

Step 3: the test statistic. t = 6.5 / 3.4274 = 1.896. The gap we saw is about 1.9 standard errors from zero.

Step 4: degrees of freedom.
Numerator: 11.74732 = 138.00
Denominator: 5.60332/11 + 6.14402/14 = 31.397/11 + 37.749/14 = 2.8543 + 2.6963 = 5.5506
df = 138.00 / 5.5506 = 24.9.

Step 5: the p-value and the decision. With about 25 degrees of freedom, the two sided cutoff at α = 0.05 is t* ≈ 2.06. Our 1.896 does not reach it, and the two sided p-value is about 0.07. Since 0.07 > 0.05, we fail to reject H0.

Step 6: say it in plain English. "Format A came out 6.5 points ahead. But with these sample sizes and this much spread, a gap at least that large, in either direction, would arise about 7 times in 100 even if the two formats were truly the same (t = 1.90, df ≈ 24.9, p ≈ 0.07). The data do not give convincing evidence of a difference." Note what we did not say: we did not say the formats are equal. Failing to reject is a failure to convict, not a verdict of innocence, and the study may simply be too small.

Use Welch's test by default. The older "pooled" two-sample t-test assumes the two populations have equal variances. It combines them into one estimate, which buys slightly more degrees of freedom. But you can rarely know whether that assumption holds. When it is wrong and the sample sizes are unequal, the pooled test's error rate is wrong too. Welch's version costs almost nothing when the variances really are equal, and it protects you when they are not. If your software says "Welch two-sample t-test," you are in good hands.
Interactive Draw real samples from two populations you control, watch the difference between their means bounce around, and see exactly where its standard error comes from: variances add, standard errors do not. Open full ↑
Key points
  • Independent samples means no subject is in both groups and no natural pairing exists.
  • Variances add: SE = √(s12/n1 + s22/n2). Standard deviations never add.
  • t = (x̄1 − x̄2) / SE, compared with a t curve with Welch degrees of freedom.
  • "Fail to reject" means the evidence is too weak. It never proves that the means are equal.

Section 2Paired samples

Chart of repeated measurements taken on the same subjects across conditions
Reference. Repeated measurements on the same subjects. When every subject gives more than one value, the observations are linked, not independent, and the analysis must respect that. Source and license: see the figure credits

What makes a pair a pair

Sometimes the two columns of numbers are not two separate crowds of people. They are the same people twice, or two people matched to each other on purpose. Each observation in column 1 has a natural, real partner in column 2. That is a matched pairs (or paired) design, and it shows up all the time:

DesignWhat is pairedTypical example
Before / afterThe same subject at two timesReaction time before and after a training module
Two treatments, one subjectThe same subject under both conditionsLeft eye vs. right eye; two tires on the same car
Matched subjectsTwo different subjects paired on key traitsTwins; customers matched on age, region, and spend
Two raters, one itemThe same item scored twiceTwo graders scoring the same 30 essays
Not pairedNothing links row i of one group to row i of the other40 people in treatment, 45 different people in control

Here is the beautiful part: a paired analysis is not a new theory. Work out each pair's difference, d = (value 1) − (value 2), and throw away the original columns. Then run an ordinary one sample t-test on the single column of differences against a null value of 0.

H0: μd = 0     Ha: μd ≠ 0     t = d̄ / ( sd / √n )     df = n − 1

Here n is the number of pairs, not the number of measurements. Eight people measured twice give you n = 8 and df = 7, not n = 16.

The method is a one sample t-test, so its conditions are the one sample conditions. But they apply to the column of differences, not to the original two columns. This is the point people most often skip.

ConditionWhat it meansHow to check it
Independence of pairsOne pair's difference tells you nothing about another pair'sA random sample of pairs, or a random order within pairs. The sample is under 10% of the population.
Normality of the differencesThe population of differences is roughly normal, or there are enough pairsA dot plot or histogram of the d column. n ≥ 30 pairs makes mild skew harmless. The two original columns may be skewed; only d matters.
Outliers among differencesNo single pair is driving d̄Scan the d column. One huge difference in a small study can create or erase significance.

In the worked example below there are only eight pairs, so the normality of the differences carries real weight. The eight differences run from −3 to 14 with no gaps or outliers. That fits a population that is about symmetric, so the t method is reasonable. With a clearly skewed difference column, or one full of outliers, and this few pairs, the Wilcoxon signed-rank test of Section 4 would be the safer choice.

Why pairing is worth doing

People differ hugely from one another, and that person to person variation is pure noise when you are trying to detect a treatment effect. Pairing subtracts that noise away. A person who is naturally slow is slow in both columns, so the difference is not affected by how slow they are. What is left in the difference column is the effect plus measurement noise, a much quieter signal to listen to. That is why a paired design can detect an effect with eight subjects that an independent design would miss with forty. Section 4 shows this on real numbers.

A worked example, all the way through

Eight people did a task, and their reaction time in milliseconds was recorded before and after a short training module. It was the same eight people both times, so the data are paired. Test at α = 0.05, two sided, with d = before − after (so a positive d̄ means they got faster).

ParticipantBefore (ms)After (ms)d = before − after
141240012
23853805
3401404−3
44304219
539638214
64214192
74084017
844543510
Mean412.25405.257.00

Step 1: mean difference. The differences add up to 12 + 5 − 3 + 9 + 14 + 2 + 7 + 10 = 56, so d̄ = 56/8 = 7.00 ms. (Happily, this equals 412.25 − 405.25. The mean of the differences is always the difference of the means.)

Step 2: standard deviation of the differences. The deviations from 7 are 5, −2, −10, 2, 7, −5, 0 and 3. Their squares are 25, 4, 100, 4, 49, 25, 0 and 9, which add up to 216.
sd2 = 216 / (8 − 1) = 30.857, so sd = 5.555 ms.

Step 3: standard error. SE = 5.555 / √8 = 5.555 / 2.8284 = 1.964 ms.

Step 4: test statistic and df. t = 7.00 / 1.964 = 3.564, with df = 8 − 1 = 7.

Step 5: p-value and decision. On 7 degrees of freedom, the two sided cutoff at α = 0.05 is 2.365, and the cutoff at α = 0.01 is 3.499. Our 3.564 clears both, so the two sided p-value is a little under 0.01, about 0.009. We reject H0.

Step 6: say it in plain English. "Reaction times got better by an average of 7.0 ms after training. A mean change at least this large, in either direction, would occur in fewer than 1% of studies if training truly had no effect (paired t = 3.56, df = 7, p ≈ 0.009). So there is convincing evidence that reaction time changed." This was a before and after study with no control group, so we should stop short of crediting the training itself. Practice effects and simply getting used to the task are rival explanations that were not ruled out. The test is valid; the claim about cause is limited by the design.

Pairing is decided by the design, not by the data. You cannot look at two columns of equal length, notice they line up nicely and declare them paired. Nor can you unpair truly linked data because the independent test looks tidier. Ask one question of the study: does row 3 of column A have a specific reason, set up ahead of time, to be matched with row 3 of column B? If yes, pair. If the rows could be shuffled without losing information, they are independent.
Interactive Sort ten real study designs into paired and independent, then watch one crossover study's identical numbers analyzed both ways: live sliders for the effect, the spread, the pairing correlation ρ and the number of pairs drive six computed SVG charts that show exactly what the pairing is worth. Open full ↑
Key points
  • Paired data means every observation has one specific partner: the same subject twice, or subjects matched on purpose.
  • Shrink the pairs to differences and run a one sample t-test on them: t = d̄ / (sd/√n), df = n − 1.
  • n is the number of pairs. Eight people measured twice give df = 7.
  • Check the conditions on the difference column: independent pairs, differences that are about normal (or enough pairs) and no outlier that takes over.
  • Pairing removes the variation from subject to subject, which is why it is far more powerful for the same sample size.

Section 3Two proportions

Diagram comparing event rates between two groups and how their ratio is computed
Reference. Two groups, two event rates. This is the setup behind every comparison of proportions, whether reported as a difference or as a ratio. Source and license: see the figure credits

When the outcome is yes-or-no

Now the outcome is not a number but a group with two levels: clicked or did not click, recovered or did not recover, passed or failed. Each group is summed up by a sample proportion, p̂ = (number of successes) / (group size). "Success" simply labels the outcome you are counting; it does not mean anything cheerful.

H0: p1 − p2 = 0     Ha: p1 − p2 ≠ 0

Here the reference curve is the standard normal, so the statistic is a z, not a t. The reason is that a proportion's standard deviation is fully set by the proportion itself: √(p(1−p)). So once you assume a value for p, there is no separate variance to estimate from data, and no degrees of freedom to lose.

The pooled proportion, and why it appears only in the test

The null hypothesis says the two population proportions are equal to some shared value. If that is true, the best estimate of that shared value uses every observation you have, ignoring the group labels:

p̂pool = (x1 + x2) / (n1 + n2)

And the standard error used for the test is built from that single pooled value:

SEpool = √( p̂pool(1 − p̂pool) × (1/n1 + 1/n2) )     z = (p̂1 − p̂2) / SEpool

A confidence interval, on the other hand, is not built under the null. It is an estimate of whatever the difference really is, so it uses the unpooled standard error, with each group's own proportion. That difference is the most common slip in this section, and Section 5 comes back to it.

The conditions are independence (as before) plus the success-failure condition. The normal approximation only works if you have enough of both outcomes. For the test, check it with the pooled proportion. All four of n1p̂pool, n1(1−p̂pool), n2p̂pool and n2(1−p̂pool) should be at least 10.

A worked example, all the way through

An email is sent in two versions. With Version 1, 45 of 150 people replied. With Version 2, 30 of 160 replied. People were assigned to a version at random. Test at α = 0.05, two sided.

Step 1: the sample proportions.
p̂1 = 45/150 = 0.300   p̂2 = 30/160 = 0.1875
The difference we saw = 0.300 − 0.1875 = 0.1125, which is 11.25 percentage points.

Step 2: the pooled proportion. p̂pool = (45 + 30)/(150 + 160) = 75/310 = 0.24194.

Step 3: check success-failure. 150(0.24194) = 36.3 and 150(0.75806) = 113.7. 160(0.24194) = 38.7 and 160(0.75806) = 121.3. All four are over 10. ✓

Step 4: pooled standard error.
p̂pool(1 − p̂pool) = 0.24194 × 0.75806 = 0.18340
1/150 + 1/160 = 0.006667 + 0.006250 = 0.012917
The product = 0.18340 × 0.012917 = 0.0023688, so SEpool = √0.0023688 = 0.04867.

Step 5: the test statistic. z = 0.1125 / 0.04867 = 2.31.

Step 6: p-value and decision. For the standard normal, the area beyond z = 2.31 in one tail is 0.0104. Doubling it for a two sided test gives p = 0.021. Since 0.021 < 0.05, we reject H0.

Step 7: say it in plain English. "Version 1 drew replies from 30.0% of people, versus 18.8% for Version 2, an 11.3 percentage point difference. If the two versions worked equally well, a gap this large or larger, in either direction, would appear in about 2% of experiments (z = 2.31, p = 0.021). So there is convincing evidence that reply rates differ." Because the assignment was random, reading this as cause is fair here, in a way it was not in Section 2.

QuantityFormulaUsed forIn our example
Differencep̂1 − p̂2Both test and interval0.1125
Pooled p̂(x1+x2)/(n1+n2)Test only0.24194
SE, pooled√(p̂pool(1−p̂pool)(1/n1+1/n2))The z-statistic0.04867
SE, unpooled√(p̂1(1−p̂1)/n1 + p̂2(1−p̂2)/n2)Confidence interval only0.04850
Percentage points are not percent. Going from 18.8% to 30.0% is a rise of 11.3 percentage points. It is also a 60% relative increase (0.1125 / 0.1875 = 0.60). Both numbers are true and describe the same data, and headlines choose whichever sounds larger. State which one you mean, every time.
Interactive Run a two-arm trial patient by patient, watch the gap between two sample proportions bounce around, and see why the test and the confidence interval are built from two different standard errors. Open full ↑
Key points
  • Two proportions use a z statistic, because there are no degrees of freedom to estimate.
  • The pooled proportion is used for the test, because the null claims the proportions are equal.
  • The confidence interval uses the unpooled standard error, because it does not assume the null.
  • Check success-failure: at least 10 successes and 10 failures expected in each group.

Section 4Choosing the right test

Diagram of the null hypothesis significance testing framework
Reference. The framework for testing a null hypothesis. Every method in this chapter is the same skeleton with a different standard error bolted on. Source and license: see the figure credits

Two questions get you there

People often try to memorize a dozen tests. You do not need to. In the two sample world, two questions settle it almost every time.

Question 1: what kind of outcome did you measure? If each subject gave a number you could sensibly average, such as minutes, dollars or millimeters of mercury, you are comparing means. If each subject gave a yes or no label that you are counting, you are comparing proportions. (A satisfaction rating from 1 to 5 is a true gray area. Treating it as a number is common and most often fair, but say what you did.)

Question 2: how are the two groups related? If every value in one group has a specific partner in the other, the data are paired. Otherwise, they are independent. You answer this by reading the study design, never by staring at the numbers.

OutcomeGroup relationshipTestStatisticReference curve
NumericIndependentTwo-sample (Welch) t-test(x̄1−x̄2)/√(s12/n1+s22/n2)t, Welch df
NumericPairedPaired t-testd̄/(sd/√n)t, df = n−1
Yes/noIndependentTwo-proportion z-test(p̂1−p̂2)/SEpoolStandard normal
Yes/noPairedMcNemar's testBuilt only from the discordant pairsChi-square, df = 1
Numeric, badly skewed / tiny nIndependentWilcoxon rank-sum (Mann-Whitney)Rank-basedIts own distribution
Numeric, badly skewed / tiny nPairedWilcoxon signed-rankRank-basedIts own distribution
Yes/no, small countsIndependentFisher's exact testExact enumeration(exact)

What the choice actually costs you

This is not bookkeeping, because the wrong choice changes the answer. Take the same eight people from Section 2, and pretend, wrongly, that the "before" and "after" columns came from two unrelated groups of eight people. The two column means do not change: 412.25 and 405.25, a difference of 7.00 ms. But now the spread from person to person is back in the denominator. Working from those columns, sbefore = 19.33 and safter = 19.08, so

SE = √(19.332/8 + 19.082/8) = √(46.71 + 45.49) = √92.20 = 9.602

t = 7.00 / 9.602 = 0.73, df ≈ 14, p ≈ 0.48

The same seven millisecond effect goes from p ≈ 0.009 (paired, correct) to p ≈ 0.48 (independent, wrong). It goes from convincing evidence to nothing at all. The paired standard error was 1.96 ms, and the independent one was 9.60 ms, nearly five times larger. That is because it is dominated by the fact that person 8 is simply slower than person 2. Pairing sweeps that irrelevant fact out of the math. Analyze paired data as independent, and you will often fail to find effects that are really there.

The reverse mistake is worse. If the data are truly independent, there is no way to line them up into pairs. Forcing a pairing, by sort order or by row number in a spreadsheet, makes up a relationship that does not exist. It gives a p-value with no meaning at all.

Three decisions to make before you look

Fix these ahead of time, because deciding them after seeing the data makes the p-value worthless:

The design chooses the test; the p-value never does. If two methods give different answers on the same data, that is not a menu, because one of them is wrong for that design. Write down which test the design calls for before you work anything out. Stick to it, whichever way the number lands.
Interactive Walk a decision tree from a study's description to the right two-sample test, then watch the test at the end of your path run live on the real data beside the test you would have reached by answering differently, and simulate thousands of studies to see what the last question is actually worth. Open full ↑
Key points
  • Two questions choose the test: a number or a yes or no outcome, and independent or paired groups.
  • Paired numbers → paired t. Independent numbers → Welch t. Independent yes or no → two-proportion z. Paired yes or no → McNemar.
  • Analyzing paired data as independent inflates the standard error and hides real effects.
  • Fix your direction, your α and your number of comparisons before seeing results.

Section 5Two-sample confidence intervals

Illustration of a confidence interval around an estimate
Reference. A confidence interval around an estimate. It shows the range of believable values that a point estimate alone cannot show. Source and license: see the figure credits

From a verdict to a measurement

A test gives a verdict: reject, or fail to reject. That is a thin answer. It does not say how big the difference is, and "significant" and "important" are fully different words. A confidence interval for the difference answers the better question: how big, give or take how much? And every two sample interval in this chapter has one shape:

(point estimate) ± (critical value) × (standard error)

ComparisonPoint estimateStandard errorCritical value
Two independent meansx̄1 − x̄2√(s12/n1 + s22/n2)t*, Welch df
Paired meansd̄sd/√nt*, df = n − 1
Two proportionsp̂1 − p̂2√(p̂1(1−p̂1)/n1 + p̂2(1−p̂2)/n2): unpooledz* (1.96 for 95%)

The product of the last two columns is the margin of error. Nothing else changes from method to method.

Worked: the interval for Section 1's data

Go back to the coaching study: x̄1 − x̄2 = 6.5, SE = 3.4274 and df ≈ 24.9.

Step 1: critical value. For 95% confidence with about 25 degrees of freedom, t* ≈ 2.06. (Rounding df down to 24 gives 2.064, and the difference cannot be seen at two decimals.)

Step 2: margin of error. 2.06 × 3.4274 = 7.06 points.

Step 3: the interval. 6.5 − 7.06 = −0.56 and 6.5 + 7.06 = 13.56, giving (−0.56, 13.56) points.

Step 4: read it. The interval contains 0, so "no difference" is among the believable values. That matches the earlier decision to fail to reject at α = 0.05 exactly. But it says far more than the test did. It says Format A could believably be half a point worse, or as much as thirteen and a half points better. That is a huge range. The honest conclusion is not "the formats are the same." It is "this study was too small to tell us anything useful, and it should be repeated with more people."

The other two examples work the same way. For the paired reaction times: 7.00 ± 2.365 × 1.964 = 7.00 ± 4.65, giving (2.35, 11.65) ms. That is fully above zero, which matches p ≈ 0.009. For the two email versions, use the unpooled SE = √(0.300×0.700/150 + 0.1875×0.8125/160) = √(0.001400 + 0.000952) = 0.04850. The interval is 0.1125 ± 1.96 × 0.04850 = 0.1125 ± 0.0951, giving (0.017, 0.208). That is between 1.7 and 20.8 percentage points, all positive.

Duality, and the one place it leaks

For the two t methods, the interval and the two sided test are two views of one calculation. A 95% interval that leaves out 0 matches exactly a two sided test that rejects at α = 0.05. An interval that contains 0 matches exactly a test that fails to reject. Both use the same point estimate, the same standard error and the same critical value.

For two proportions, this match is only approximate, because the test uses the pooled standard error and the interval uses the unpooled one. When a result sits very near the edge, the two can disagree. You might get a p-value of 0.048 alongside an interval whose lower limit is a hair below zero. Neither is a mistake; they are answering slightly different questions. Report both, and describe the finding as borderline, which is what it is.

What a confidence interval actually means

Here is the sentence to memorize, because the tempting version is wrong. The parameter μ1 − μ2 is a fixed, unknown number. Your interval is what varied at random, since a different sample would have given a different one. So the 95% describes the method. If you repeated this whole study without end, about 95% of the intervals it made would cover the true difference. It does not say there is a 95% chance that the true difference lies in the one interval you happen to be holding. That interval either covers the parameter or it does not, because the coin has already landed.

The p-value needs the same care. p = 0.021 means this: if the null were true, data at least this extreme would occur about 2.1% of the time. It is not the probability that the null is true, not the probability that the result was a fluke and not a measure of effect size. A trivial difference becomes "significant" with a large enough sample, and a large difference stays "not significant" with a small one. This is just why you report the interval alongside the p-value. The p-value tells you whether you can see the effect, and the interval tells you whether it is worth caring about.

"Zero is in the interval" is not "the groups are the same." An interval of (−0.56, 13.56) and an interval of (−0.20, 0.25) both contain zero, and both fail to reject. But the first is an admission that we do not know. The second is real evidence that any difference is tiny. Only the width of the interval tells you which one you have, and the test statistic alone never will.
Interactive Build a confidence interval for a difference between two groups from live samples, watch it widen with confidence and narrow with sample size, and work out what it really means when the interval covers zero. Open full ↑
Key points
  • Every two sample interval is (estimate) ± (critical value)(SE). Only the SE and the critical value change.
  • Use t* for means (Welch df, or n−1 when paired) and z* for proportions, with the unpooled SE.
  • An interval that contains 0 matches a two sided test that fails to reject. The match is exact for t methods and approximate for proportions.
  • The 95% belongs to the method over the long run, not to the single interval in front of you.
  • A p-value is not the probability that the null hypothesis is true.

The chapter in one breath

  • A two-sample test asks whether a gap seen between two groups is larger than chance alone would easily produce.
  • For independent means, variances add: SE = √(s12/n1 + s22/n2), and t = (x̄1 − x̄2)/SE on Welch degrees of freedom.
  • For paired data, shrink each pair to a difference and run a one sample t-test on the differences with df = n − 1, where n counts pairs.
  • Pairing removes the variation from subject to subject. The same 7 ms effect gave p ≈ 0.009 when paired and p ≈ 0.48 when analyzed (wrongly) as independent.
  • For two proportions, use a z statistic, with the pooled proportion in the test and the unpooled SE in the interval. Check success-failure.
  • The design picks the test: a number vs. a yes or no outcome, and independent vs. paired groups. Decide before any math.
  • Every two sample confidence interval is (estimate) ± (critical value)(SE). It reports the size of the effect that the test only votes on.
  • The 95% describes the method over the long run. A p-value is the probability of the data given the null, never the probability that the null is true.

ReferenceWords worth knowing

A quick reference for the terms in this chapter. Skim it now, or come back whenever a word trips you up.

Alternative hypothesis (Ha)
The claim that there is a difference. In this chapter, it is most often μ1 − μ2 ≠ 0 or p1 − p2 ≠ 0.
Confidence interval
A range of believable values for a parameter, built as (estimate) ± (critical value)(standard error). Its confidence level describes how often the method succeeds over the long run.
Degrees of freedom
The number that sets the shape of a t curve. It is n − 1 for a paired test, and Welch's approximation for two independent means.
Independent samples
Two groups in which no subject appears twice and no observation is naturally matched to another.
Margin of error
The half width of a confidence interval: the critical value times the standard error.
Matched pairs
A design in which each observation in one condition has one specific partner in the other: the same subject twice, or subjects matched on purpose.
Nonparametric test
A method that does not assume a normal population and most often works from ranks. Examples are the Wilcoxon rank-sum and Wilcoxon signed-rank tests.
Null hypothesis (H0)
The claim of no difference between the two populations, against which the data are weighed.
Paired t-test
A one sample t-test applied to the differences within pairs, testing μd = 0.
Point estimate
The single best guess at a parameter from the sample. Here it is x̄1 − x̄2, d̄ or p̂1 − p̂2.
Pooled proportion
(x1 + x2)/(n1 + n2), the shared proportion estimated under the null. It is used in the two-proportion test only.
Pooled two-sample t-test
The older version that assumes equal population variances and combines them into one estimate. Welch's test is the safer default.
p-value
The probability of seeing data at least as extreme as yours if the null hypothesis were true. It is not the probability that the null is true.
Sampling distribution
The distribution of a statistic across all possible samples. For a difference of means, it is about a t curve centered on the true difference.
Significance level (α)
The cutoff, fixed ahead of time, at which a p-value counts as convincing. Put another way, it is the accepted rate of Type I error.
Standard error
The estimated standard deviation of a statistic: how much the difference between the two samples would wobble from study to study.
Success-failure condition
The rule of at least 10 expected successes and 10 expected failures in each group before trusting the normal approximation for proportions.
t-distribution
A bell curve with heavier tails than the normal, used when the standard deviation is estimated from data. It comes closer and closer to the normal as df grows.
Test statistic
(Observed − hypothesized) divided by the standard error: the difference seen, given in standard errors.
Two-sample t-test
The test of μ1 − μ2 = 0 from two independent samples of a numeric outcome.
Type I error
Rejecting a null hypothesis that is actually true: a false positive. Its long run rate is α.
Welch's t-test
The two-sample t-test that does not assume equal variances. It uses a formula that approximates the degrees of freedom, and it is the advised default.

Check yourself

1. A study measures cholesterol in 40 people before a diet and in the same 40 people after it. A coworker runs a two-sample t-test with n1 = n2 = 40. What is wrong, and what should be done instead?
The samples are not independent. They are the same 40 people twice, so this is a matched pairs design. Work out the 40 differences within each person, and run a paired t-test on them with df = 39. Treating paired data as independent leaves all the variation from person to person in the standard error. That inflates it and makes a real effect much harder to detect.
2. Two independent samples have s1 = 6 with n1 = 9, and s2 = 8 with n2 = 16. Work out the standard error of the difference in means.
SE = 2.828. s12/n1 = 36/9 = 4; s22/n2 = 64/16 = 4; the sum = 8; √8 = 2.828. Note that the variances are added, never the standard deviations. Adding 6 and 8 would be a serious error.
3. A two sided test gives p = 0.03 at α = 0.05. A classmate says, "There is a 3% chance the null hypothesis is true." Correct them exactly.
The p-value is the probability of data at least this extreme given that the null is true. It is not the probability that the null is true. The null is either true or false, and it has no probability in this framework. The correct reading: if the two populations really were the same, results this extreme would occur about 3% of the time.
4. In the paired reaction time example, d̄ = 7.00 ms, sd = 5.555 and n = 8. Work out t again, and give the degrees of freedom.
t = 3.56 with df = 7. SE = 5.555/√8 = 5.555/2.8284 = 1.964, and t = 7.00/1.964 = 3.564. The degrees of freedom are n − 1 = 7, where n is the number of pairs. It is not 16 measurements, and not df = 15.
5. Why does the two-proportion test use a pooled proportion while the confidence interval does not?
The test is worked out assuming the null is true. The null says both populations share one proportion, so the best estimate of it uses all the data combined. A confidence interval makes no such assumption. It estimates whatever the difference really is, so each group adds its own p̂ to the standard error.
6. Group 1 has 24 successes in 80. Group 2 has 12 successes in 60. Work out the two sample proportions and the pooled proportion, and check the success-failure condition.
p̂1 = 0.300, p̂2 = 0.200 and p̂pool = 36/140 = 0.2571. The condition is met. The expected counts are 80(0.2571) = 20.6 and 80(0.7429) = 59.4, and 60(0.2571) = 15.4 and 60(0.7429) = 44.6. All four are at least 10, so the normal approximation is safe.
7. A 95% confidence interval for μ1 − μ2 is (2.1, 8.7). State two things you can conclude, and one common statement you must avoid.
Conclude: (a) zero is not in the interval, so a two sided test at α = 0.05 would reject the null; (b) the believable size of the difference runs from about 2 to about 9 units, with group 1 larger. Avoid: "there is a 95% chance the true difference is between 2.1 and 8.7." The parameter is fixed, and the 95% refers to how the method performs across repeated studies over the long run.
8. Explain why a paired design can find an effect that an independent design of the same size misses.
Pairing subtracts out the variation from subject to subject, which is noise as far as the treatment effect goes. Each person serves as their own control, so a naturally high or low starting level cancels in the difference. The result is a much smaller standard error. In the chapter's example, it was 1.96 ms paired versus 9.60 ms unpaired, which shifted p from about 0.009 to about 0.48 for the same 7 ms effect.
9. For two independent means, x̄1 − x̄2 = 5.0, SE = 2.0 and df ≈ 30, so t* = 2.042. Build the 95% confidence interval, and state the test decision it implies.
(0.92, 9.08), and the two sided test rejects H0 at α = 0.05. Margin of error = 2.042 × 2.0 = 4.084; 5.0 − 4.084 = 0.916 and 5.0 + 4.084 = 9.084. Because zero lies outside the interval, "no difference" is not a believable value at this confidence level.
10. When would you reach for a Wilcoxon rank-sum test instead of a two-sample t-test, and when for McNemar's test?
Wilcoxon rank-sum: a numeric outcome and independent groups, but small samples with clear skew or outliers, so the normality condition fails. McNemar: a yes or no outcome measured on paired subjects. The two-proportion z-test assumes independent groups and would be wrong for paired yes or no data.
11. A researcher gets a two sided p of 0.08. Then she switches to a one sided test to get p = 0.04 and declares significance. What is the problem?
The direction of the test must be fixed before seeing the data. Choosing it afterward doubles the real false positive rate. A one sided test is fair only when a difference the other way would be of no interest at all, and only when that choice is registered ahead of time (pre-registered). Switching after the fact (post hoc) makes the reported p-value meaningless.
12. Interval A is (−0.56, 13.56), and interval B is (−0.20, 0.25). Both contain zero, so both tests fail to reject. Why are these two results very different for science?
Interval A is wide. It fits with no effect but also with a large effect, so the study simply tells us little and should be repeated with a bigger sample. Interval B is narrow and pinned near zero, which is real evidence that any true difference is too small to matter. "Fail to reject" is the same in both cases. Only the interval shows the difference between not knowing and knowing exactly.
Statistics Easy Read · Chapter 13

Chi-Square & ANOVA

Every test you have met so far has compared one mean, or two. Real questions are rarely that tidy. You may want to know whether a whole set of groups falls out the way somebody claimed. You may want to know whether two categorical variables travel together, or whether three, four or five groups have the same average. This chapter gives you three tools for just those jobs: the chi-square goodness-of-fit test, the chi-square test of independence and one-way analysis of variance. Then it tells you the truth that most courses rush past. It covers what these tests need before you may trust them, and what to do the moment one of them comes back significant. The math is mostly subtraction, squaring and division. If you can do that, you can do this.

By the end of this chapter you can

  • Work out expected counts and the chi-square statistic, χ2 = Σ(O − E)2/E, by hand.
  • Run a goodness-of-fit test to decide whether data match a claimed distribution, using df = k − 1.
  • Run a test of independence on a two-way table, using df = (r − 1)(c − 1), and describe the link you find.
  • Split variability into between-group and within-group sums of squares, and build a complete ANOVA table.
  • Explain why the F statistic is a ratio of two variance estimates, and why many t tests are a bad stand in for one F test.
  • State and check the assumptions behind chi-square and ANOVA, and name the right other test when one fails.
  • Carry out and read a post-hoc comparison (Tukey's HSD or a Bonferroni correction) after a significant F.
  • Read p-values, confidence intervals and effect sizes exactly, without the usual overstatements.

Section 1Chi-square goodness of fit

A chi-square distribution curve with the right-hand tail shaded to show the p-value region
Reference. A chi-square distribution with the right tail shaded. Every chi-square test puts its p-value in that upper tail. Source and license: see the figure credits

The question this test answers

You have one categorical variable with k groups (categories), and somebody has made a claim about how the population splits across them. A maker says its bags of candy are 30% red, 30% brown and 40% yellow. A textbook says a fair die lands on each face one sixth of the time. A subscription service says its customers split 25/40/35 across three tiers. You collect a sample and count. The counts never match the claim exactly, because sampling sees to that. The goodness-of-fit test asks a single question: is the mismatch bigger than sampling noise can easily explain?

The hypotheses are stated in words as much as symbols:

Notice that the alternative is vague on purpose. It says something is off, but it does not say which group or in which direction. That vagueness is the price of testing all the groups at once. It comes back to bite us in Section 5, in the ANOVA setting.

Observed, expected, and the statistic

The observed counts O are what you actually tallied. The expected counts E are what the null hypothesis predicts on average for a sample of your size: Ei = n × pi. Expected counts are often not whole numbers. 200 × 0.35 = 70 is tidy, but 137 × 0.35 = 47.95 is not, and you must not round it. Rounding expected counts is one of the most common ways a chi-square gets quietly wrecked by hand.

The statistic adds up one share per group:

χ2 = Σ (O − E)2 / E

Read that formula slowly, because it is the whole chapter in small. The top part, (O − E)2, measures how far a group strayed from the prediction. It is squared so that going over and going under both count as evidence. Dividing by E puts that miss on a fair scale. Being 10 counts off when you expected 20 is a scandal; being 10 counts off when you expected 2,000 is nothing. Every term is a square divided by a positive number, so χ2 is never negative, and a value near zero means the data hug the claim. Big values, and only big values, are evidence against H0. That is why the chi-square test is always right-tailed.

The degrees of freedom are df = k − 1, one less than the number of groups. Here is the gut sense. Once you know the total and all but one group count, the last one is forced, so only k − 1 counts are free to vary. (Say you had to estimate m parameters from the data to build the expected counts, such as when fitting a Poisson model. Then you subtract those too: df = k − 1 − m.)

A worked example, start to finish

A meal plan service claims its members split across three tiers as Bronze 25%, Silver 40% and Gold 35%. A random sample of n = 200 members gives Bronze 40, Silver 95 and Gold 65. Test at α = 0.05.

Step 0: check the conditions first. The four rules are laid out in Section 4, and they are met here. The data are raw counts, not percentages. The sample is random. Each member is counted once and lands in just one tier, so the observations are independent. And every expected count worked out in Step 1 is at least 5 (the smallest is 50). Do this before you look at any p-value, not after.

Step 1: expected counts. EBronze = 200(0.25) = 50, ESilver = 200(0.40) = 80 and EGold = 200(0.35) = 70. They add up to 200, which is a useful math check, since expected counts always total n.

CategoryObserved OClaimed pExpected E = npO − E(O − E)2/E
Bronze400.2550−10100/50 = 2.0000
Silver950.4080+15225/80 = 2.8125
Gold650.3570−525/70 = 0.3571
Total2001.002000χ2 = 5.170

Step 2: the statistic. 2.0000 + 2.8125 + 0.3571 = χ2 = 5.17.

Step 3: degrees of freedom and critical value. There are k = 3 groups, so df = 3 − 1 = 2. From the table below, the critical value at α = 0.05 with df = 2 is 5.991.

Degrees of freedomα = 0.10α = 0.05α = 0.01
12.7063.8416.635
24.6055.9919.210
36.2517.81511.345
47.7799.48813.277
59.23611.07015.086
610.64512.59216.812

Step 4: decide. 5.17 is less than 5.991, so we fail to reject H0. The p-value is about 0.075, which is larger than 0.05 and confirms the same decision.

Step 5: say what that means, with care. "At the 5% level, these data do not give enough evidence that the true tier proportions differ from the claimed 25/40/35 split." That sentence is doing something exact. It does not say the claim is true. We fail to reject H0; we never accept it. Those are different verdicts, just as "not guilty" is not "innocent." A sample of 200 simply may not have had the power to detect a mismatch of the size that is really there. Absence of evidence is not evidence of absence. And the p-value of 0.075 is not a 7.5% chance that the service is right. It means this: if the claimed split were exactly correct, samples of 200 would give a mismatch this extreme or worse about 7.5% of the time. The probability lives in the process that makes the data, not in the hypothesis.

The biggest term tells you the story. Even when you fail to reject, look at which group added the most. Here Silver added 2.81 of the 5.17, since the sample had 95 Silver where 80 were predicted. That is the direction to watch if you collect more data. The overall test is a smoke alarm, and the single terms tell you which room to check.
Interactive Set a claimed color mix and a hidden truth, then open real sampled bags of candy and watch chi-square assemble itself one cell at a time: expected counts from the claim, misses squared and scaled, stacked against the critical value and verified over thousands of simulated bags. Open full ↑
Key points
  • Goodness of fit compares one categorical variable's observed counts against a claimed distribution.
  • E = n × p. Never round expected counts, and check that they add up to n.
  • χ2 = Σ(O − E)2/E is never negative, and the test is always right-tailed. df = k − 1.
  • A p-value is the probability of data this extreme given H0, not the probability that H0 is true.
  • Check the four conditions before the p-value, and remember that fail to reject never means accept.

Section 2Chi-square test of independence

A two-way contingency table showing counts arranged in rows and columns with marginal totals
Reference. A contingency table: two categorical variables crossed, with row, column and grand totals in the margins. Source and license: see the figure credits

Two variables, one table

Now you have two categorical variables measured on the same people. You cross them into a contingency table (also called a two-way table or crosstab) with r rows and c columns. Does exercise habit go with sleep quality? Does region go with brand choice? Does treatment group go with the kind of outcome? The test of independence asks whether knowing a person's row tells you anything about their column.

The statistic is the same formula as in Section 1, cell by cell, and the test is still right-tailed. Only two things change: how you get the expected counts, and how you count degrees of freedom.

Expected counts from the margins

Under independence, the probability of landing in a given row and a given column is the product of the two separate probabilities. Turn that into counts, and you get the working formula every cell obeys:

E = (row total × column total) / grand total

Here is why it works. The row total divided by n estimates the probability of that row. Multiply by the column total, and you get how many of that column's members should fall in that row if the row split were the same everywhere. That last phrase is the practical meaning of independence: every row has the same column profile.

The degrees of freedom are df = (r − 1)(c − 1). The logic is the same as before. With the margins fixed, once you fill in an (r − 1) by (c − 1) block of the table, subtraction forces every other cell.

A worked example, start to finish

A researcher surveys n = 300 adults, recording whether they exercise regularly and how they rate their sleep. Test for a link at α = 0.05.

Observed countsGood sleepFair sleepPoor sleepRow total
Exercises regularly755025150
Does not exercise455550150
Column total12010575300

Step 1: expected counts. Top left: (150 × 120)/300 = 60.0. Top middle: (150 × 105)/300 = 52.5. Top right: (150 × 75)/300 = 37.5. The two row totals happen to be equal here, so the bottom row repeats those values. Every expected count is at least 5, so the test is safe to run.

CellObserved OExpected EO − E(O − E)2/E
Exercise & Good7560.0+15.0225/60 = 3.7500
Exercise & Fair5052.5−2.56.25/52.5 = 0.1190
Exercise & Poor2537.5−12.5156.25/37.5 = 4.1667
No exercise & Good4560.0−15.0225/60 = 3.7500
No exercise & Fair5552.5+2.56.25/52.5 = 0.1190
No exercise & Poor5037.5+12.5156.25/37.5 = 4.1667
Total300300.00χ2 = 16.071

Step 2: the statistic. Adding the last column: χ2 = 16.07.

Step 3: degrees of freedom. There are r = 2 rows and c = 3 columns, so df = (2 − 1)(3 − 1) = 2. The critical value at α = 0.05 is again 5.991.

Step 4: decide and explain. 16.07 is far above 5.991, and the p-value is about 0.0003. We reject H0. There is strong evidence of a link between regular exercise and how people rate their own sleep in this population.

Step 5: describe the link. The test says "associated" and stops there, so you have to look at the cells yourself. The two largest shares are the two "Poor" cells, at 4.1667 each. These are Exercise and Poor (observed 25, expected 37.5) and No exercise and Poor (observed 50, expected 37.5). Next come the two "Good" cells, at 3.7500 each. The row totals happen to be equal here, so the shares come in mirrored pairs. So it is the Good and Poor columns together that drive the result. People who exercise landed in "Good" more often and "Poor" less often than independence predicts, and people who do not exercise did the reverse. A tidier way to say the same thing is the standardized residual, (O − E)/√E. For Exercise and Good, that is 15/√60 = +1.94. For Exercise and Poor, it is −12.5/√37.5 = −2.04. The no exercise row reverses both signs. Residuals beyond about ±2 mark the cells that drove the result. Here only the two Poor cells clear that bar, with the two Good cells just short of it.

Step 6: measure how big it is. With 300 people, even a modest link gets a tiny p-value, so report an effect size. Cramér's V = √[χ2 / (n × min(r−1, c−1))] = √[16.071 / (300 × 1)] = √0.05357 = 0.23. On a scale from 0 to 1, that is a real but moderate link. It is clear in the statistics, but modest in practice.

Association is not causation, and a survey cannot make it one. These data come from watching, not from an experiment (they are observational). Exercise may improve sleep. Good sleep may make people feel like exercising. Or a third factor, such as age, stress, shift work or long lasting pain, may drive both. A significant χ2 shows that the variables move together. Only a randomized experiment shows which one pushes.
Interactive Survey real people, cross-tabulate two categorical variables, build the expected counts from the row and column totals, and test whether the two variables are associated. Open full ↑
Key points
  • The test of independence crosses two categorical variables in an r × c table.
  • E = (row total × column total)/grand total, and df = (r − 1)(c − 1).
  • Rejecting H0 means "associated," not "which way." Read the cells and the standardized residuals to describe the pattern.
  • Report an effect size such as Cramér's V. With a large n, significance alone says very little about importance.

Section 3One-way ANOVA

An F distribution curve with the rejection region in the upper tail shaded
Reference. The F distribution with its upper tail rejection region. It is the reference curve for every ANOVA. Source and license: see the figure credits

Why not just run a lot of t tests?

Say you have three training methods, and you want to know whether their mean test scores differ. The obvious move is three t tests: A vs B, A vs C and B vs C. The obvious move is wrong, and it is worth seeing just why.

Each test at α = 0.05 has a 5% chance of a false alarm. If the three tests were independent, the chance that at least one raises a false alarm would be 1 − (0.95)3 = 1 − 0.857 = 0.143. With five groups, there are ten pairwise tests, and the figure climbs to 1 − (0.95)10 = 0.401. Be honest about that math. Pairwise tests on the same groups are not independent, because every pair reuses a sample the other pairs also used. So treat 14% and 40% as pictures of the size of the problem, not exact rates. The direction is what matters, and it is not in doubt. You set out to run a 5% risk and quietly took on a far larger one. This inflated risk is the family-wise error rate, and it is the reason ANOVA exists: one test, one α, one answer.

The idea: two ways to measure spread

The name is honest: you analyze variance in order to learn about means. Here is the trick. If all the group means were truly equal, then two fully different calculations would both estimate the same population variance σ2:

So the ratio

F = MSB / MSW = (signal + noise) / noise

should sit near 1 when the means are equal, and grow large when they are not. That is why ANOVA, like chi-square, is a right-tailed test: only big F values are evidence against H0. And both mean squares are sums of squares divided by positive degrees of freedom. So neither can be negative, and F is never negative either.

Here are the building blocks. N = total observations, k = number of groups, nj and x̄j are the size and mean of group j, and x̄ is the grand mean:

A worked example, start to finish

There are three training methods, with five people each (N = 15, k = 3), and the data are test scores. Check the conditions first, as always. The groups are independent, each is about symmetric with no outliers and the response is a number (quantitative). The equal variance condition is checked plainly with these very numbers in Section 4. ANOVA is the right tool here.

GroupScoresSumnjMean x̄jΣ(x − x̄j)2
A68, 71, 72, 73, 7636057216+1+0+1+16 = 34
B72, 75, 77, 79, 8238557725+4+0+4+25 = 58
C78, 80, 82, 83, 8741058216+4+0+1+25 = 46
Overall-115515x̄ = 77SSwithin = 138

Step 1: grand mean. (360 + 385 + 410)/15 = 1155/15 = 77.

Step 2: between-group sum of squares. SSbetween = 5(72 − 77)2 + 5(77 − 77)2 + 5(82 − 77)2 = 5(25) + 5(0) + 5(25) = 125 + 0 + 125 = 250.

Step 3: within-group sum of squares. Add the last column of the table: 34 + 58 + 46 = 138.

Step 4: check the split. SStotal should equal 250 + 138 = 388. Working it out directly from all fifteen deviations about 77 gives 159 + 58 + 171 = 388. The identity holds, which is a strong sign the math is right.

Step 5: mean squares and F. MSB = 250/2 = 125.00. MSW = 138/12 = 11.50. F = 125.00/11.50 = 10.87.

SourceSSdfMS = SS/dfFp-value
Between groups250k − 1 = 2125.0010.87≈ 0.0020
Within groups (error)138N − k = 1211.50--
Total388N − 1 = 14---

Step 6: decide. The critical value for F(2, 12) at α = 0.05 is 3.89. Our 10.87 sails past it, with p ≈ 0.0020, so we reject H0.

Numerator df (k − 1)Denominator df (N − k)Critical F, α = 0.05
2123.89
2203.49
3203.10
3302.92
4302.69

Step 7: explain it exactly. "There is strong evidence that at least one of the three method means differs from the others." That is all the F test earns you. It does not say A differs from B, and it does not say every pair differs. Section 5 is where you find out which pairs are really apart, and the answer will surprise you.

Step 8: report an effect size. Eta squared, η2 = SSbetween/SStotal = 250/388 = 0.64. About 64% of the variation in test scores is explained by which method a person got. That is a large effect, and a far more useful number to a decision maker than "p < 0.05."

With exactly two groups, ANOVA and the pooled t test are the same test. Run both on the same two samples, and you will find F = t2, with the same p-values. ANOVA is not a different idea from the two-sample t test. It is the same idea, widened so it does not fall apart when you add a third group.
Interactive Drag each group's mean bar apart or widen the within-group scatter and watch the one-way ANOVA F statistic, its sums-of-squares decomposition, p-value, and a live power simulation all recompute in real time. Open full ↑
Key points
  • Running many pairwise t tests inflates the family-wise error rate: about 14% with three groups and 40% with five.
  • ANOVA compares MSB (between-group variability) with MSW (within-group noise): F = MSB/MSW.
  • SStotal = SSbetween + SSwithin. The df are k − 1, N − k and N − 1.
  • A significant F means at least one mean differs, never "all means differ." Report η2 alongside it.

Section 4Assumptions

A histogram of sample data with a normal curve overlaid to assess whether the data are approximately normal
Reference. A histogram checked against a normal curve. This is the everyday way to judge the normality condition. Source and license: see the figure credits

What chi-square requires

A p-value is a promise, and the promise comes with conditions. Every chi-square p-value assumes four things, and software will happily print a number even when all four are broken.

1. The data are counts. Chi-square uses raw frequencies: how many people, how many items. Feeding it percentages, proportions or group means is the most common misuse. If your table holds "42%" instead of "42 people," convert back to counts first. If you cannot, you do not have the data you need.

2. Observations are independent, and each falls in just one cell. There should be one row of data per person or item. Say the same person is counted twice, such as before and after an intervention. Then the observations are paired, and chi-square is the wrong test. Use McNemar's test for a paired 2 × 2 table.

3. Expected counts are large enough. The chi-square curve is a smooth approximation to a problem about whole number counts, and the approximation frays when expected counts are tiny. The common working rule is that all expected counts are ≥ 5. Cochran's slightly more forgiving version allows up to 20% of cells to have an E between 1 and 5, as long as none falls below 1. Note that this is a condition on expected counts, not observed ones, so an observed zero is perfectly fine.

4. The sample is random. Every claim about the population depends on the sample standing for it. No formula repairs a convenience sample.

When rule 3 fails, you have real choices. You can merge sparse groups into a sensible larger one, such as two rarely used answer levels next to each other becoming a single "other" group. You can collect more data. Or you can switch to Fisher's exact test, which works out the probability directly and needs no large sample approximation at all.

What ANOVA requires

1. Independence, both within and between groups. This is the assumption ANOVA is least willing to forgive, and no amount of data fixes a breach of it. If the same subjects appear in every group, you need repeated-measures ANOVA instead.

2. Approximate normality of the response within each group (or in the same way, of the residuals). ANOVA truly holds up well here (it is robust). With group sizes about equal and a sample of decent size, moderate skew barely dents the F test, and the Central Limit Theorem is on your side. The condition matters most when groups are small (under about 15), or the data are strongly skewed or full of outliers. Check it with a histogram or normal quantile plot for each group, not with a formal normality test on tiny samples.

3. Homogeneity of variance: the spreads in the populations are equal across groups. MSW pools all the groups' scatter into one number, and that pooling only makes sense if there is one shared σ2 to pool. There are two quick checks. The largest sample standard deviation should be less than about twice the smallest. Or, in the same way, the largest variance should be less than about four times the smallest. Levene's test is the formal version.

4. The response is quantitative and measured on an interval or ratio scale. You cannot average a group label.

Let us actually run check 3 on the Section 3 data. The within-group sums of squares were 34, 58 and 46, each with df = 4:

GroupSSs2 = SS/(n−1)s
A3434/4 = 8.502.92
B5858/4 = 14.503.81
C4646/4 = 11.503.39

The largest s divided by the smallest s = 3.81/2.92 = 1.31, well under 2. The largest variance over the smallest = 14.50/8.50 = 1.71, well under 4. The equal variance condition is met, so the pooled MSW of 11.50 was a fair thing to work out.

When a condition fails

A failed assumption is not the end of the analysis. It is a signpost to a different test.

Condition that failedSymptomWhat to do instead
Expected counts too smallAny E < 5, sparse tableCombine categories; or use Fisher's exact test
Paired categorical dataSame subjects measured twiceMcNemar's test
Unequal ANOVA variancessmax/smin > 2, especially with unequal nWelch's ANOVA (does not pool variances)
Strong non-normality, small groupsHeavy skew or clear outliersKruskal-Wallis test (rank-based)
Same subjects in every groupRepeated measurementsRepeated-measures ANOVA
Non-random sampleConvenience or self-selected dataDescribe only; no valid inference to a population
Check the conditions before you look at the p-value, not after. Once you have seen a promising p-value, the urge to declare the assumptions "close enough" is nearly impossible to resist, and the decision is no longer honest. Write the assumption check as step one of your method. Let its verdict stand, whichever way the test comes out.
Interactive A live assumption checker for the chi-square test and one-way ANOVA: move sliders to watch expected cell counts, group standard deviations, the variance ratio, normality, and independence get evaluated in real time, with the χ² statistic and p-value computed from a fresh sample. Open full ↑
Key points
  • Chi-square needs counts, independent observations, expected counts ≥ 5 and a random sample.
  • ANOVA needs independence, approximate normality within groups, equal variances and a quantitative response.
  • Rules of thumb: all E ≥ 5, and smax/smin < 2 (or a variance ratio < 4).
  • Failed conditions point to a specific stand in test: Fisher's exact, McNemar, Welch or Kruskal-Wallis.

Section 5After a significant ANOVA

Side-by-side boxplots comparing the distributions of several groups
Reference. Side by side boxplots: the natural picture for comparing several groups after an ANOVA. Source and license: see the figure credits

The F test leaves you with a question

We rejected H0 in Section 3 with F = 10.87. What we know is that the three method means are not all equal. What we do not know is which ones differ. That gap is just what post-hoc ("after this") comparisons fill. They go back through the pairs one at a time, while keeping the total false alarm risk across the whole family of comparisons at α.

And this is where you cannot simply run ordinary t tests, for the very reason ANOVA existed in the first place. Three unadjusted pairwise tests carry a family-wise error rate of about 14%. Post-hoc methods are pairwise tests with the inflation built out.

Two workhorses: Bonferroni and Tukey

The Bonferroni correction is the simplest honest fix in all of statistics. If you plan m comparisons, test each one at α/m. With three groups, m = 3, and each comparison is judged at 0.05/3 = 0.0167. Put another way, multiply each raw p-value by 3 and compare it with 0.05. It works for any set of comparisons, and it takes ten seconds to explain. It is also somewhat cautious (conservative). It guards against false alarms so firmly that it can miss real differences, most of all when m is large.

Tukey's HSD (Honestly Significant Difference) is built for the one job of comparing all pairs after an ANOVA, and for that job it is more powerful than Bonferroni. Instead of a t distribution, it uses the studentized range distribution q. That already accounts for the fact that you are looking at the largest gaps among k means. For equal group sizes, the rule is beautifully simple: any two means further apart than the HSD value are significantly different.

HSD = qα, k, N−k × √(MSW / n)

Working it out on our data

From the ANOVA table: MSW = 11.50, N − k = 12, k = 3 and n = 5 per group. The studentized range value q for α = 0.05, k = 3 and df = 12 is 3.77.

Step 1: the standard error piece. √(MSW/n) = √(11.50/5) = √2.30 = 1.517.

Step 2: the HSD cutoff. HSD = 3.77 × 1.517 = 5.72. Any two sample means more than 5.72 points apart are significantly different, and any pair closer than that is not.

Step 3: compare every pair. The means were A = 72, B = 77 and C = 82.

ComparisonDifference in means|Difference|vs. HSD = 5.72Conclusion
A vs B72 − 77 = −55.005.00 < 5.72Not significant
A vs C72 − 82 = −1010.0010.00 > 5.72Significant
B vs C77 − 82 = −55.005.00 < 5.72Not significant

Read that result with care, because it is the whole point of the section. The overall F was highly significant, yet only one of the three pairs is apart. Method C beats method A, but neither can be told apart from the middle method B. Say an analyst reported, "The ANOVA was significant, so all three methods differ." That analyst would have gotten the science wrong while getting the math right.

Step 4: give intervals, not just verdicts. Tukey also gives confidence intervals: difference ± HSD. For A vs C, that is −10 ± 5.72, or (−15.72, −4.28). The interval leaves out zero, so the difference is significant. And the interval says far more than the p-value does. It says the believable edge of C over A runs from about 4 to about 16 points. Say what such an interval means with care. The method that made it catches the true mean difference in 95% of all possible samples. It is not a 95% chance that this one interval, already worked out and sitting on the page, contains the parameter. The parameter is fixed, and the interval is what varies from sample to sample.

Step 5: cross check with Bonferroni. The standard error of a difference is √[MSW(1/n + 1/n)] = √[11.50(0.4)] = √4.60 = 2.145. For A vs C, t = 10/2.145 = 4.66. For A vs B, t = 5/2.145 = 2.33. The Bonferroni critical value is the t for α = 0.0167 two-tailed with df = 12, about 2.78. So A vs C (4.66) clears it, and A vs B (2.33) does not. That is the same conclusion Tukey reached, which is reassuring.

Choosing a method, and when not to bother

MethodBest used forCharacter
Tukey's HSDAll pairwise comparisons after ANOVAThe default choice; most powerful for this exact job
BonferroniA small, pre-specified set of comparisonsSimple, universally valid, conservative
Dunnett's testEvery group vs. a single control groupMore powerful than Tukey when only control contrasts matter
Scheffé's methodAny contrast, including ones you thought of afterwardMost flexible, most conservative
Games-HowellPairwise comparisons with unequal variancesThe post-hoc partner to Welch's ANOVA

Two habits keep this honest. First, if the overall F is not significant, do not go fishing through the pairs hoping one turns up. That is just the error inflation the F test protected you from. (Planned contrasts, named before seeing the data, are the fair exception.) Second, always show the picture. Side by side boxplots of the three groups show the overlap between A and B, and the clean gap between A and C, faster than any table of p-values.

A significant F is a beginning, not a conclusion. It tells you the groups are not all the same. Everything a reader truly wants comes from the post-hoc comparisons, the confidence intervals and the effect size. That means which groups differ, by how much, with what uncertainty and whether it matters in practice. Report all four, and your analysis is complete.
Interactive A significant ANOVA says the arms are not all alike but not which ones: run the post-hoc comparisons live, watch confidence intervals widen under a correction, and simulate how uncorrected pairwise testing inflates the false-alarm rate. Open full ↑
Key points
  • A significant F says "at least one mean differs." Post-hoc tests find which pairs.
  • Tukey's HSD = q × √(MSW/n) is the standard for all pairwise comparisons. Bonferroni (α/m) is the simple, all purpose fix.
  • Significant overall does not mean every pair differs. Here only A vs C were apart.
  • A 95% interval is a statement about the method over the long run, not a 95% chance for the interval in front of you.

The chapter in one breath

  • Every chi-square test uses χ2 = Σ(O − E)2/E. It is never negative, and it is always right-tailed.
  • Goodness of fit tests one categorical variable against a claimed distribution: E = np and df = k − 1.
  • The test of independence tests two categorical variables for a link: E = (row × column)/total and df = (r − 1)(c − 1). And association is not causation.
  • One-way ANOVA compares three or more means with F = MSB/MSW, avoiding the family-wise error that many t tests would create.
  • The split SStotal = SSbetween + SSwithin is both the engine of ANOVA and a built in math check.
  • Chi-square needs counts, independence and expected counts ≥ 5. ANOVA needs independence, rough normality and equal variances. Each failure has a named other test.
  • A significant F means at least one mean differs. Tukey's HSD or a Bonferroni correction tells you which pairs, without inflating α.
  • Always pair a p-value with an effect size (Cramér's V, η2) and an interval, and state both as exactly as they demand.

ReferenceWords worth knowing

A quick reference for the terms in this chapter. Skim it now, or come back whenever a word trips you up.

Alpha (α)
The significance level: the risk of a false alarm you agree to accept before collecting data. It is most often 0.05.
Analysis of variance (ANOVA)
A method that compares three or more population means by comparing two estimates of variance, between-group and within-group.
Bonferroni correction
Testing each of m planned comparisons at α/m, so the family-wise error rate stays at α. It is simple and cautious.
Chi-square statistic (χ2)
Σ(O − E)2/E, a measure of total mismatch between observed and expected counts that is never negative.
Contingency table
A two-way table of counts crossing two categorical variables, with row, column and grand totals in the margins.
Cramér's V
An effect size for a contingency table, √[χ2/(n × min(r−1, c−1))]. It runs from 0 (no link) to 1.
Degrees of freedom
The number of values free to vary once the limits are set. It is k − 1 for goodness of fit, (r−1)(c−1) for independence and (k−1, N−k) for ANOVA.
Eta squared (η2)
SSbetween/SStotal: the share of variation in the response explained by which group a person is in.
Expected count (E)
The count a cell would show on average if the null hypothesis were true. Never round it.
F statistic
The ratio MSB/MSW. It is near 1 when group means are equal and large when they are not. It is never negative, and it is always tested in the upper tail.
Family-wise error rate
The probability of at least one false alarm across a whole family of tests. It inflates fast as the number of comparisons grows.
Goodness-of-fit test
A chi-square test of whether one categorical variable's observed counts match a claimed distribution.
Homogeneity of variance
The ANOVA condition that all groups share the same population variance. It is checked with smax/smin < 2 or Levene's test.
Kruskal-Wallis test
A rank based stand in for one-way ANOVA, used when the normality condition fails badly.
Mean square (MS)
A sum of squares divided by its degrees of freedom, which makes it a variance estimate. MSB and MSW are the two that build F.
Observed count (O)
The actual tally in a group or cell of your sample.
p-value
The probability of getting data at least as extreme as yours if the null hypothesis were true. It is not the probability that the null hypothesis is true.
Post-hoc test
A follow up comparison run after a significant ANOVA to find which groups differ, with the family-wise error rate controlled.
Standardized residual
(O − E)/√E for one cell. Values beyond about ±2 flag the cells driving a significant chi-square.
Sum of squares (SS)
A total of squared deviations. In ANOVA, SStotal splits exactly into SSbetween + SSwithin.
Test of independence
A chi-square test of whether two categorical variables measured on the same subjects are linked.
Tukey's HSD
Honestly Significant Difference: q × √(MSW/n). It is the standard post-hoc method for comparing all pairs of means after ANOVA.

Check yourself

1. A study claims that a population splits 40/35/25 across three groups. In a sample of 400, what are the expected counts, and what are the degrees of freedom?
E = 160, 140 and 100; df = 2. The expected counts are E = np: 400(0.40) = 160, 400(0.35) = 140 and 400(0.25) = 100, which add up to 400 as a check. With k = 3 groups, df = k − 1 = 2.
2. Why is a chi-square test always right-tailed, and why can χ2 never be negative?
Every term is a squared amount divided by a positive expected count, so the sum cannot be negative, and only large values show a mismatch. A χ2 near zero means the observed counts nearly equal the expected ones, which supports H0. So evidence against H0 can only show up in the upper tail.
3. A goodness-of-fit test gives χ2 = 5.17 with df = 2 and p = 0.075. A classmate writes, "There is a 7.5% chance the company's claim is correct." Fix the sentence.
"If the claimed distribution were exactly true, about 7.5% of samples of this size would show a mismatch this large or larger." A p-value is a probability about data, worked out under the null hypothesis. It is never the probability that the hypothesis itself is true. Also, since 0.075 > 0.05, we fail to reject, which is not the same as proving the claim correct.
4. In a 3 × 4 contingency table with a grand total of 500, a cell sits in a row totaling 200 and a column totaling 125. Find its expected count and the table's degrees of freedom.
E = (200 × 125)/500 = 50; df = (3 − 1)(4 − 1) = 6. Expected counts in a test of independence always come from the margins. The degrees of freedom are (r − 1)(c − 1), not rc − 1.
5. A test of independence on 300 people gives χ2 = 16.07, df = 2 and p ≈ 0.0003. What may you conclude, and what may you not?
You may conclude that the two variables are linked in the population. You may not conclude that one causes the other, nor read a direction from the test statistic alone. Data from watching cannot rule out reverse causation or a hidden third variable. To describe the pattern, look at the cells and the standardized residuals. To judge size, work out Cramér's V (here √(16.07/300) = 0.23, a moderate link).
6. Why not simply run three two-sample t tests instead of one ANOVA when comparing three groups?
Because the family-wise error rate inflates: 1 − (0.95)3 ≈ 0.143. That is about a 14% chance of at least one false alarm instead of 5%. With five groups (ten pairwise tests), it reaches 1 − (0.95)10 ≈ 0.40. ANOVA answers the question with a single test at a single α.
7. Four groups of 8 subjects each give SSbetween = 180 and SSwithin = 336. Build the ANOVA table and work out F.
F = 5.00 on (3, 28) degrees of freedom. N = 32 and k = 4. dfbetween = 3, so MSB = 180/3 = 60. dfwithin = 32 − 4 = 28, so MSW = 336/28 = 12. F = 60/12 = 5.00. SStotal = 516 with df = 31, and η2 = 180/516 = 0.35.
8. Explain in plain language why F = MSB/MSW should be near 1 when the null hypothesis is true.
If all population means are equal, MSB and MSW are two independent estimates of the same population variance σ2. So their ratio hovers around 1. When the means truly differ, real separation adds to the top number, while the bottom number still measures only within-group noise. That pushes F well above 1, which is why only large F values count as evidence.
9. A 2 × 2 table has expected counts of 3.2, 6.8, 4.1 and 8.9. What is the problem, and what are two ways forward?
Two expected counts fall below 5, so the chi-square approximation cannot be trusted. The choices are to collect more data, or to merge groups where that makes real sense. The standard fix for a small 2 × 2 table is Fisher's exact test, which needs no large sample approximation. Note that the rule applies to expected counts, not observed ones.
10. Three groups have sample standard deviations of 4.0, 7.5 and 9.0. Does the equal variance condition for ANOVA look satisfied?
Just barely not: smax/smin = 9.0/4.0 = 2.25, above the rule of thumb limit of 2 (the variance ratio is 81/16 = 5.06, above 4). Confirm with Levene's test and a look at side by side boxplots. If the condition really fails, most of all with unequal group sizes, use Welch's ANOVA, followed by Games-Howell comparisons instead of Tukey's HSD.
11. An ANOVA on three groups is significant. The group means are 72, 77 and 82; MSW = 11.5, n = 5 per group and q0.05, 3, 12 = 3.77. Which pairs differ by Tukey's HSD?
Only the 72 vs 82 pair. HSD = 3.77 × √(11.5/5) = 3.77 × 1.517 = 5.72. The gaps are 5, 5 and 10. Only 10 is bigger than 5.72, so the lowest and highest groups differ, while neither can be told apart from the middle group. A significant F plainly does not mean every pair differs.
12. Tukey gives a 95% confidence interval of (−15.72, −4.28) for μA − μC. State what that interval means, and what it does not.
It means the method for building the interval catches the true mean difference in 95% of all possible samples. Because the interval leaves out 0, the difference is significant at the 5% level. It does not mean there is a 95% probability that this one interval, already worked out, contains μA − μC. The parameter is a fixed number, and the interval is what varies from sample to sample. In practice, the data fit with group C averaging about 4 to 16 points higher than group A.
Statistics Easy Read · Chapter 14

Correlation & Regression

Almost every interesting question in the world is a question about two things at once. Does studying more raise a score? Does a heavier dose lower a symptom? Does price move with square footage? Correlation and regression are the two tools that answer those questions honestly. Correlation puts a single number on how tightly two quantitative variables track each other. Regression draws the one straight line that fits the cloud of points better than any other line could, and it lets you use that line to predict. Neither tool needs you to be fast at math. Every formula in this chapter is built from things you already know: means and standard deviations. What they do need is care in reading the results, because this is the corner of statistics where confident people say wrong things most often.

By the end of this chapter you can

  • Build and read a scatterplot, and describe a relationship by its form, direction and strength.
  • Put the explanatory and response variables on the correct axes.
  • Work out the correlation coefficient r by hand from deviations, and read its size and sign correctly.
  • State the cautions on r: it covers straight lines only, outliers sway it, a narrow range shrinks it and correlation is not causation.
  • Find the least-squares regression line, and explain just what amount "least squares" makes smallest.
  • Read the slope and intercept in the units of the problem, without sneaking in a claim about cause.
  • Work out residuals and r2, and read a residual plot for curves, spread and outliers.
  • Use the line to predict, and tell when a prediction is unfair extrapolation.
  • State the assumptions behind inference on the slope, and word a p-value and a confidence interval correctly.

Section 1Scatterplots

A scatterplot of paired data showing a strong positive relationship between two variables
Reference. A scatterplot with a strong positive relationship; each dot is one person or thing measured on two variables. Source and license: see the figure credits

One dot, one individual, two measurements

Everything up to this point in the book has described one variable at a time, such as the mean of a set of scores or the spread of a set of blood pressures. A scatterplot is the first graph that shows two quantitative variables measured on the same people or things. Each one gives a single dot, placed by its two values. If you measure six students on hours studied and exam score, you get six dots, not twelve.

Which variable goes where is not random. The explanatory variable (also called the predictor, or x) goes on the horizontal axis. The response variable (the outcome, or y) goes on the vertical axis. This habit shows the direction we care about. We are asking whether x helps us say something about y, not the reverse. Hours studied explains exam score far more naturally than exam score explains hours studied, so hours goes on the x axis. Sometimes neither variable is plainly the explainer, such as a person's arm span and their height. Then the choice is yours, but you must make it before you draw, because the regression line in Section 3 depends on it.

Form, direction, strength, and then outliers

Describing a scatterplot is a careful habit, and the habit is a fixed order of four questions.

Form asks what shape the cloud takes. Is it a straight band, a curve that bends, two separate clusters or a blob with no shape at all? Form comes first, because it decides whether the rest of this chapter even applies. Correlation and least-squares regression are tools for linear (straight line) form. Point them at a U shaped cloud, and they will hand you a number, and the number will be a lie.

Direction asks which way the band tilts. Positive means high x values tend to come with high y values, so the cloud rises from left to right. Negative means high x comes with low y, and the cloud falls. Note the word tend. Direction is a statement about the general drift of the whole cloud, not a promise about any single pair of points.

Strength asks how tightly the points hug that form. A narrow band as thin as a pencil is strong, and a fat, fuzzy band is weak. Strength is about the scatter around the pattern, not about how steep the pattern is. This is the most common misreading of a scatterplot, and it is worth pausing on. Points that lie almost exactly on a nearly flat line make a strong relationship with a small slope. A steep spray of widely scattered points is a weak relationship with a large slope. Steepness and tightness are different questions.

Outliers are the last question. An outlier in a scatterplot is a point that sits far from the overall pattern. Note that it need not be extreme in x alone or y alone. Think of a student with an ordinary 5 hours of study and an ordinary 95 on the exam. That student may be nothing special on either variable alone, yet fall well off the joint pattern. Only the picture with both variables shows that.

QuestionWhat you are looking atVocabulary to use
FormThe shape of the cloudLinear, curved (nonlinear), clustered, no pattern
DirectionWhich way a linear pattern tiltsPositive, negative, or neither
StrengthHow tightly points hug the patternStrong, moderate, weak
OutliersPoints far from the overall patternOutlier; influential point (Section 4)

The data we will carry through this chapter

To keep the math honest, one small data set will run through the next four sections. Six students recorded their total study hours before an exam, and we recorded their exam score out of 100.

StudentABCDEF
Hours studied (x)2457810
Exam score (y)726970808394

Sketch it in your head, or on paper; the form is about linear. The direction is positive: the students with few hours sit low, and the student with ten hours sits highest. The strength looks good but not perfect. Student A studied only 2 hours and outscored student B, who studied 4. That single crossing is just the kind of flaw that keeps r below 1. We will see it show up in the numbers in Section 2, and again as a residual in Section 4.

Draw the picture before you work out the number. A correlation coefficient sums things up in one number, and every one number summary throws information away. The scatterplot is the only place you will ever see curves, clusters or a single point dragging the whole analysis around. Working out r without looking at the plot is like reporting a patient's average temperature without noticing that it spiked to 104 once.
Interactive Shape a relationship, draw real samples from it, and learn to read a scatterplot in order, form, direction, strength, while a live-computed correlation shows exactly what that one number can and cannot see. Open full ↑
Key points
  • A scatterplot shows two quantitative variables on the same people or things, with one dot for each.
  • The explanatory variable goes on the horizontal axis, and the response goes on the vertical.
  • Describe every scatterplot in the same order: form, direction, strength, outliers.
  • Strength is not steepness. A shallow but tight band is a strong relationship, and a steep but fuzzy one is weak.

Section 2The correlation coefficient

Anscombe's quartet: four very different scatterplots that share the same correlation and regression line
Reference. Anscombe's quartet: four data sets with nearly the same means, correlations and regression lines, but fully different shapes. Source and license: see the figure credits

What r actually measures

The correlation coefficient, written r (and formally called the Pearson correlation), is a single number between −1 and +1. It measures the direction and strength of a straight line relationship between two quantitative variables. Its sign gives the direction, and its distance from zero gives the strength. An r of exactly +1 means every point lies exactly on an upward line. −1 means every point lies exactly on a downward line, and 0 means no straight line tendency at all.

The formula looks scary until you see what it is doing:

r = Σ(x − x̄)(y − ȳ) ÷ √[ Σ(x − x̄)2 × Σ(y − ȳ)2 ]

Read the top part first. For each person, we ask two questions. Were they above or below average on x, and above or below average on y? If both answers agree, above on both or below on both, the product of the two deviations is positive. If they disagree, the product is negative. Adding those products across everyone asks the whole data set to vote; a large positive total means agreement wins. The bottom part then rescales that total so it can never be bigger than 1 in size. That is what lets you compare r across studies, and what makes it fully free of units.

Another form, which gives the same result, makes the unit free part obvious. Say zx and zy are the standardized scores of the two variables. Then

r = [ 1 ÷ (n − 1) ] × Σ zx zy

Correlation is nothing more than the average product of z-scores. That is also why r does not change if you convert inches to centimeters or dollars to euros: standardizing washes the units out.

Computing r, step by step

Take the six students. First the means: Σx = 2 + 4 + 5 + 7 + 8 + 10 = 36, so x̄ = 36 ÷ 6 = 6 hours. And Σy = 72 + 69 + 70 + 80 + 83 + 94 = 468, so ȳ = 468 ÷ 6 = 78 points. Now build the deviation table; this one table will serve us for the rest of the chapter.

xyx − x̄y − ȳ(x−x̄)(y−ȳ)(x−x̄)2(y−ȳ)2
272−4−6241636
469−2−918481
570−1−88164
78012214
8832510425
10944166416256
Sums: 364680012642466

There are two built in checks before going on. The raw columns must give back the means (36 ÷ 6 = 6 and 468 ÷ 6 = 78). And both deviation columns must add up to exactly 0. They do; now put in the numbers:

r = 126 ÷ √(42 × 466) = 126 ÷ √19,572 = 126 ÷ 139.90 = 0.9006

So r ≈ +0.90. Round to two decimals for reporting; the sign is positive, which matches the upward tilt we saw. The size, 0.90, is close to 1, which confirms a strong straight line relationship. It is strong but not perfect, because student A outscored student B.

If you prefer the z-score route, you need the standard deviations: sx = √(42 ÷ 5) = √8.4 = 2.898 hours and sy = √(466 ÷ 5) = √93.2 = 9.654 points. Then r = 126 ÷ [5 × 2.898 × 9.654] = 126 ÷ 139.89 = 0.9006, the same answer. Keep sx and sy handy, because Section 3 uses them.

Four cautions that matter more than the formula

1. r measures straight line (linear) association only. Think of hours of sleep versus alertness. Too little is bad, too much leaves you groggy, and the relationship is an arch. Such data can give an r very near zero, while the two variables are in fact tightly related, just not in a straight line. An r near 0 means "no linear pattern," never "no relationship."

2. r is not resistant. It is built from means and squared deviations, so a single far off point can drag r sharply up or down. This is the lesson of Anscombe's quartet in the figure above. Four data sets share almost the same means, the same r and the same regression line, yet look nothing alike. One is truly linear, and one is a clean curve. One is a perfect line ruined by a single outlier. And one is a vertical stack plus one lone point that makes up the whole correlation.

3. A narrow (restricted) range shrinks r. Say you work out the correlation between admission test scores and college grades using only the students who were admitted. You have thrown away the whole low end of the x range. Cutting the range of x lowers r as a matter of math. That is why picky samples so often make good predictors look useless.

4. Correlation is not causation. This is the one everyone can recite and almost no one applies. A strong r between two variables fits at least four different worlds. x may cause y. y may cause x; a third, hidden lurking variable may cause both. Or the pattern may be chance in a small sample. Ice cream sales correlate with drowning deaths, because hot weather drives both. The correlation is real, but the story about cause is fiction. Only a randomized experiment breaks the link between the treatment and every lurking variable at once. So only that kind of study allows a claim about cause from data like these.

Two smaller notes are worth keeping. r needs both variables to be quantitative, so there is no correlation between eye color and height. And r is symmetric: the correlation of x with y equals the correlation of y with x. That symmetry is a warning in itself, because it means r alone can never tell you which variable is doing the explaining.

Value of rWhat it saysWhat it does not say
r = +1Every point on one upward straight lineNothing about how steep that line is
r = +0.90Strong positive linear associationThat x causes y
r = −0.90Strong negative association: exactly as strong as +0.90That the relationship is "worse" than a positive one
r = 0.05Almost no linear tendencyThat the variables are unrelated: the form may be curved
r = −1.4Nothing: this is impossiblecheck your arithmetic; r lives in [−1, +1]
The sign and the size are two separate messages. Read r = −0.87 as two facts glued together. The direction is negative, and the strength is 0.87, which is strong. A common exam error is calling −0.87 "weaker" than +0.60 because it is a smaller number. Strength is the distance from zero, so −0.87 is clearly the stronger of the two.
Interactive Drag points around a live scatterplot and watch the correlation coefficient r, the least-squares line, and r² recompute in real time. Open full ↑
Key points
  • r measures the direction and strength of a linear relationship, and it always lies between −1 and +1.
  • r = 126 ÷ √(42 × 466) = 0.90 for our study hours data, which is strong and positive.
  • r has no units, does not change with rescaling and is symmetric in x and y.
  • r is not resistant to outliers. It is blind to curves, it shrinks under a narrow range and it never proves causation.

Section 3The regression line

A scatterplot with a fitted straight regression line drawn through the points
Reference. A least-squares regression line fitted through a cloud of points. Source and license: see the figure credits

What "least squares" means

Once a scatterplot looks linear, you can lay a straight line through it and use that line as a model. But endless lines pass through a cloud of points, so we need a rule that picks just one. The rule is least squares.

For any line you try, and for each data point, measure the vertical distance from the point to the line. That is how far off the line's prediction was. That distance is the residual: residual = y − ŷ, where ŷ ("y-hat") is the value the line predicts. Square every residual, so that misses above and below both count as errors and cannot cancel. Then add them up. The least-squares regression line is the one and only line that makes that sum, Σ(y − ŷ)2, as small as it can possibly be.

Two details in that definition carry real weight. First, the distances are vertical, not perpendicular. That is because we are predicting y from x, and vertical distance is exactly the error in predicting y. Second, we square instead of taking absolute values. A side effect is that a large miss counts far more than its size. That is why one outlier can tilt a regression line so easily.

Squaring vertical distances has a direct result. The regression line of y on x is not the same as the line of x on y. Correlation is symmetric, but regression is not. Swap the roles of the variables, and you get a different line. So decide which variable you are predicting before you fit anything.

Slope and intercept

Write the line in the familiar form ŷ = a + bx, where b is the slope and a is the y intercept. The least-squares answer is remarkably tidy:

b = Σ(x−x̄)(y−ȳ) ÷ Σ(x−x̄)2    equivalently    b = r × (sy ÷ sx)

a = ȳ − b x̄

The second slope formula is worth staring at. The slope is the correlation, turned from standardized units back into real ones by the ratio of the two standard deviations. It also tells you that the slope and r always share a sign, so a positive correlation promises an upward line. And the intercept formula is a rearranged form of ȳ = a + bx̄. That says something useful in its own right: the least-squares line always passes through the point of averages (x̄, ȳ). If your line misses that point, you have made a math error.

Fitting the line to our data

Everything we need is already in the Section 2 table; the slope is:

b = 126 ÷ 42 = 3

Check it the other way: b = r × sy ÷ sx = 0.9006 × (9.654 ÷ 2.898) = 0.9006 × 3.331 = 3.00. They agree; now the intercept:

a = ȳ − bx̄ = 78 − (3)(6) = 78 − 18 = 60

The least-squares line is ŷ = 60 + 3x. Check the point of averages: at x = 6, ŷ = 60 + 18 = 78 = ȳ; it is correct.

Reading the slope. The slope is a rate, and its units are the units of y per unit of x: 3 exam points per hour of study. State it as a prediction, not a promise: "for each extra hour studied, the model predicts an increase of about 3 points in exam score, on average." Do not say "an extra hour raises your score by 3 points." That is a claim about cause, and these data come from watching, not an experiment. A lurking variable, such as how well prepared a student was before, could be producing both.

Reading the intercept. The intercept is the predicted y when x = 0. A student who studies 0 hours is predicted to score 60. Sometimes that means something and sometimes it is nonsense. The deciding question is always whether x = 0 is inside the range of the data we actually saw. Our hours ran from 2 to 10, so x = 0 sits outside the data: close by, but outside. Treat that 60 as an anchor that places the line, not as a real forecast about a student who never opens the book.

Proving the line is best

"Least squares" is a claim we can test with math. Our line gives the following predictions and errors. At x = 2, ŷ = 66, and the actual score was 72, an error of +6. At x = 4, ŷ = 72 versus 69, an error of −3. At x = 5, ŷ = 75 versus 70, an error of −5. At x = 7, ŷ = 81 versus 80, an error of −1. At x = 8, ŷ = 84 versus 83, an error of −1. At x = 10, ŷ = 90 versus 94, an error of +4. Squaring and adding: 36 + 9 + 25 + 1 + 1 + 16 = 88.

Now try a steeper line. Keep it through the point of averages, because for any slope you fix, the best intercept is a = ȳ − b x̄. So the best line at that slope always passes through (x̄, ȳ). With a slope of 3.5, a = 78 − 3.5(6) = 57, and ŷ = 57 + 3.5x. Its errors are +8, −2, −4.5, −1.5, −2 and +2, and the squared total is 64 + 4 + 20.25 + 2.25 + 4 + 4 = 98.5. That is worse. A shallower slope of 2.5 gives a = 63 and errors of +4, −4, −5.5, −0.5, 0 and +6. Its squared total is 16 + 16 + 30.25 + 0.25 + 0 + 36 = 98.5. That is also worse, and by exactly the same amount, because the penalty for missing the best slope is symmetric.

Candidate lineSlopeInterceptΣ(y − ŷ)2Verdict
ŷ = 63 + 2.5x2.56398.5Too shallow
ŷ = 60 + 3x36088Least squares: the best line
ŷ = 57 + 3.5x3.55798.5Too steep

No other slope beats 88. That number has a name we will use all through Section 4: the sum of squared errors, SSE.

Fit a line only after the scatterplot earns it. Least-squares math will happily fit a straight line to a perfect parabola and report a slope with a straight face. The formula has no way of knowing the form is wrong. That check is yours, made with your eyes before you work anything out, and confirmed afterward with the residual plot in the next section.
Interactive Tilt and shift a line through a fixed cloud of points and watch the sum of squared residuals fall to its unique minimum, with each residual drawn as a literal square and a live SSR-vs-slope landscape. Open full ↑
Key points
  • The least-squares line makes Σ(y − ŷ)2, the sum of squared vertical distances, as small as possible.
  • b = Σ(x−x̄)(y−ȳ) ÷ Σ(x−x̄)2 = r sy ÷ sx, and a = ȳ − b x̄.
  • Our line is ŷ = 60 + 3x: the predicted score rises about 3 points per extra study hour.
  • The line always passes through (x̄, ȳ), and the slope always shares the sign of r.
  • Regression is not symmetric: predicting x from y gives a different line.

Section 4r-squared and residuals

A residual plot showing the residuals from a fitted regression line scattered about zero
Reference. A residual plot from an ordinary least-squares fit, with residuals scattered about the zero line. Source and license: see the figure credits

Residuals: what the line missed

A residual is the leftover: residual = observed − predicted = y − ŷ. A positive residual means the actual value sat above the line, so the person did better than the model expected. A negative residual means it sat below. The residuals are the raw material for everything in this section, so work them out with care.

x (hours)y (actual)ŷ = 60 + 3xResidual y − ŷResidual2
27266+636
46972−39
57075−525
78081−11
88384−11
109490+416
Sums--088

The residuals add up to exactly zero; that is not luck. It is a math promise of least squares, and so it is a free error check every time you do this by hand. Student A, who studied 2 hours and scored 72, has the largest residual: 6 points better than the model predicted. Student C, at 5 hours and 70 points, came in 5 points short.

r2: how much variation the line explains

Before we had a line, our only guess for any student's score would have been the overall mean, 78. The total variation in y around that mean is the total sum of squares, SST = Σ(y − ȳ)2 = 466, which we already worked out in Section 2. After fitting the line, the variation still left over is SSE = Σ(y − ŷ)2 = 88. So the line accounted for 466 − 88 = 378 of the original variation.

The coefficient of determination is that accounted for share:

r2 = 1 − (SSE ÷ SST) = 1 − (88 ÷ 466) = 1 − 0.1888 = 0.8112

And it lives up to its name: it really is the square of the correlation. From Section 2, r = 0.9006, and 0.90062 = 0.8111, the same value up to rounding. So we report r2 = 0.81, or 81%.

The correct sentence is: about 81% of the variation in exam scores is explained by the linear relationship with hours studied. The other 19% is variation the line does not capture, such as sleep, prior knowledge, test anxiety and luck. Here are three wordings that sound alike and are all wrong. It does not mean 81% of the points lie on the line. It does not mean predictions are 81% accurate, and it does not mean studying causes 81% of exam performance. r2 is a statement about variation, nothing else.

Because it is a square, r2 always falls between 0 and 1 and is never negative. That means it throws away the direction of the relationship. Report r alongside it, or your reader cannot tell whether the link was positive or negative.

Reading a residual plot

A residual plot graphs the residuals on the vertical axis against x (or against ŷ) on the horizontal. Its whole purpose is to magnify what the original scatterplot hides. In the original plot, a gentle curve can be swamped by the steep overall rise. Subtracting the line removes that rise and leaves the misfit standing alone.

What you want to see is nothing. That means a band of points with no shape, scattered above and below the zero line, with about the same width all along. That is the residual plot's way of saying the straight line model is good enough. Any shape is a message.

What the residual plot showsWhat it meansWhat to do
Formless horizontal band around zeroA line is an adequate modelProceed: report slope, r, r2
A clear U or arch (curvature)The true form is curved, not linearDo not use the line; transform a variable or fit a curve
A fan widening left to rightSpread of y grows with x (non-constant variance)Predictions are far less reliable at the wide end
One point far from the rest verticallyAn outlier in the y directionInvestigate it; report results with and without it
One point far out in x with a small residualA high-leverage, possibly influential pointRefit without it: if the line moves a lot, say so

Our six residuals, in x order, run +6, −3, −5, −1, −1 and +4. They start high, dip negative in the middle and come back up, in a faint U. With only six points, that is far too little evidence to drop the straight line model. But it is just the pattern you would flag and watch if you collected forty students instead of six.

The difference in the last two table rows deserves stress. Leverage is about being extreme in x. A point far to the right or left of the other x values sits at the end of a long lever and can swing the line. Influence is about actually changing the answer. A point is influential if removing it clearly moves the slope, the intercept or r. High leverage points are the ones most likely to become influential. But the only way to know is to refit without the point and compare.

A high r2 does not mean the model is right. Anscombe's curved data set and his data set driven by an outlier both show a respectable r2, while being badly served by a straight line. r2 tells you how much variation the line soaked up. The residual plot tells you whether a line was the right shape in the first place. Always report both, and trust the residual plot when they disagree.
Interactive Split a variable's variation into the share the regression line explains (r-squared) and the share left over, then read a live residual plot across four scenarios to tell a good fit from a wrong-shaped line or growing spread. Open full ↑
Key points
  • Residual = observed − predicted = y − ŷ. Residuals from a least-squares line always add up to 0.
  • SST = 466 (variation about ȳ) and SSE = 88 (variation left after the line), so r2 = 1 − 88÷466 = 0.81.
  • Say it as: "81% of the variation in y is explained by the linear relationship with x." It does not mean 81% of points, 81% accurate or 81% caused.
  • r2 is never negative, so it hides direction. Report r too.
  • A good residual plot shows no pattern. A curve, a fan shape or a lone stray point each mean something different.

Section 5Prediction

A regression line shown with prediction bands widening away from the center of the data
Reference. A fitted line with prediction bands. Note how the bands widen away from the center of the data. Source and license: see the figure credits

Using the line

Prediction is mechanical. Put a value of x into the equation, and read off ŷ. With ŷ = 60 + 3x, a student who studies 6 hours is predicted to score 60 + 3(6) = 78. A student who studies 9 hours is predicted to score 60 + 3(9) = 87.

What is not mechanical is knowing what that number means. The regression line predicts the average y for people with that x, not the value any one person will get. Our own data prove the point. Student E studied 8 hours, the line predicted 84 and the actual score was 83, off by one. Student A studied 2 hours, the line predicted 66 and the actual score was 72, off by six. A prediction from a regression line is a center of gravity, not a promise.

You can measure the typical miss. The standard error of the estimate measures the typical size of a residual:

se = √[ SSE ÷ (n − 2) ] = √(88 ÷ 4) = √22 = 4.69 points

We divide by n − 2 instead of n − 1, because fitting a line used up two pieces of information: a slope and an intercept; here is what it means. Single scores fall about 4.7 points away from the regression line, on average. So the prediction of 87 for a student who studies nine hours is better read as "somewhere in the mid to high 80s, give or take five points or so." A rough working range of ŷ ± 2se, about 78 to 96, is a usable ballpark. It is only a ballpark. A proper prediction interval is wider than that near the edges of the data, which is just the flaring you see in the figure above.

Interpolation is safe; extrapolation is not

Interpolation means predicting at an x value inside the range you saw. Our hours ran from 2 to 10, so predicting for 6 hours is interpolation. It rests on evidence, because we watched what happened to students on both sides of 6.

Extrapolation means predicting outside that range. It rests on an assumption you cannot check: that the straight line pattern goes on where you have no data. Very often it does not. Watch what our perfectly reasonable line does when it is pushed:

Hours (x)Prediction ŷ = 60 + 3xInside the data (2 to 10)?Verdict
369YesInterpolation: trustworthy
678YesInterpolation: trustworthy
987YesInterpolation: trustworthy
060No (just outside)The intercept: anchors the line, not a real forecast
15105NoImpossible: the exam is out of 100
25135NoAbsurd: the model has left reality behind

The line never warns you. It will happily give 135 for a student who studies 25 hours, because a line goes on forever and math has no common sense. The real relationship must flatten out. Scores are capped at 100, and past some point, extra hours give nothing or actually hurt through tiredness. Our data never visited that region, so our line knows nothing about it. Always state the range of x your model was built on, and refuse predictions outside it.

Four more habits before you predict

Do not predict backward with the same line. Our line predicts score from hours. To predict hours from score, you must refit with the roles reversed. That line has a slope of 126 ÷ 466 = 0.27, not 1 ÷ 3. Turning a regression line around with algebra gives the wrong answer.

Remember regression to the mean. The slope is r × sy ÷ sx, and r is less than 1 in size. So predictions are always pulled toward ȳ, compared with how extreme x was. A student one full standard deviation above average in hours is predicted to be only r = 0.90 standard deviations above average in score. This is not a flaw; it is a result of imperfect correlation. It explains why great performances tend to be followed by more ordinary ones, without any cause at all.

Check the conditions before you trust any inference. The tools that describe, r, the slope and r2, only need a scatterplot that is about linear. But the moment you attach a p-value or a confidence interval to the slope, you are relying on a model, and that model has four stated assumptions. Linearity: the true relationship between x and y is a straight line. Check the scatterplot, and confirm with a residual plot that has no pattern. Independence: the observations do not depend on one another. This comes from how the data were collected, not from anything you can see in a plot. Constant variance: the spread of y about the line is the same across the range of x. The fanning row in the Section 4 table is just this condition failing. Approximate Normality: the residuals are about Normal around the line, checked with a histogram or Normal plot of the residuals. Our six students are far too few to check any of this convincingly, and saying so is the honest report.

Be exact about the language of uncertainty. Regression output most often includes a test of whether the slope differs from zero, along with a p-value and a confidence interval. Three statements must be kept straight. First, a p-value is the probability of getting data at least this extreme if the true slope were zero. It is not the probability that the true slope is zero, and not the probability that your finding is wrong. Second, a large p-value means you fail to reject the hypothesis of zero slope. It does not let you accept that the slope is zero. Absence of evidence for a relationship is not evidence that there is none, since a small sample can easily hide a real slope. Third, a 95% confidence interval for the slope describes how the method behaves over the long run. If you repeated the whole study many times, about 95% of the intervals built this way would contain the true slope. It does not mean there is a 95% chance that the true slope lies inside the one interval in front of you. That interval either contains it or it does not.

Every prediction should come with three sentences. Give the value ("about 87 points"), the typical error ("single scores fall about 4.7 points from the line") and the range where it holds ("this model was built on students studying 2 to 10 hours"). A prediction reported without its uncertainty and its limits is not a statistic. It is a guess wearing a decimal point.
Interactive Fit a least-squares line to childhood height data (ages 2 to 9), then slide a prediction age from inside the data out to adulthood and watch the line, trustworthy in range, insist a grown adult should be over eleven feet tall; every prediction, error, and reality-check computes live against the true growth curve. Open full ↑
Key points
  • Putting x into the line predicts the average y at that x, not any one person's value.
  • se = √[SSE ÷ (n−2)] = √22 = 4.69: the typical distance of a point from the line.
  • Interpolation (inside the x range you saw) is backed by data. Extrapolation is not, and it gave an impossible 105 at 15 hours.
  • To predict x from y, refit. Do not turn the equation around.
  • Inference about the slope assumes linearity, independence, constant variance and residuals that are about Normal. State and check them.
  • A p-value is not the probability that the null is true. Failing to reject a zero slope is not accepting it. And a 95% CI describes the method over the long run, not this one interval.

The chapter in one breath

  • A scatterplot shows two quantitative variables on the same people or things. Describe it as form, direction, strength, outliers, with the explanatory variable on the x axis.
  • r measures the direction and strength of a linear relationship. It lies in [−1, +1], has no units and is symmetric. For our data, r = 126 ÷ √(42×466) = 0.90.
  • r is blind to curves, open to sway by outliers, shrunk by a narrow range and silent about cause. A lurking variable can produce any correlation you like.
  • The least-squares line makes Σ(y−ŷ)2 as small as possible. b = r sy÷sx = 3 and a = ȳ − b x̄ = 60, giving ŷ = 60 + 3x, which passes through (6, 78).
  • The slope is a predicted rate of change (3 points per hour). The intercept only means something if x = 0 sits within the data.
  • Residuals (y − ŷ) add up to zero and give SSE = 88. With SST = 466, r2 = 0.81: 81% of the variation in scores is explained by the linear relationship with hours.
  • A residual plot should look like nothing at all. Curves, fanning and stray points each point to a different failure that r2 alone would hide.
  • Interpolate freely, but never extrapolate. Our line predicts an impossible 105 at 15 hours. Report every prediction with its typical error, se = 4.69, and the range where it holds.
  • Inference on the slope assumes linearity, independence, constant variance and residuals that are about Normal. A p-value is not the probability that the null is true, failing to reject is not accepting and a 95% CI is a claim about the method.

ReferenceWords worth knowing

A quick reference for the terms in this chapter. Skim it now, or come back whenever a word trips you up.

Coefficient of determination (r2)
The share of the variation in y explained by the linear relationship with x. It equals 1 − SSE÷SST, and it equals the square of r.
Correlation coefficient (r)
A number with no units between −1 and +1 that measures the direction and strength of a straight line relationship between two quantitative variables.
Explanatory variable
The variable used to explain or predict the other. It is plotted on the horizontal axis and written x. It is also called the predictor or independent variable.
Extrapolation
Predicting at an x value outside the range of the data you saw. It is not backed by evidence, and it is a common source of absurd results.
Fitted value (ŷ)
The value the regression line predicts for a given x, also called the predicted value.
Influential point
An observation whose removal clearly changes the slope, intercept or r. It is most often a high leverage point, one that is extreme in the x direction and sits at the end of a long lever. But only refitting without it can confirm influence.
Intercept (a)
The predicted value of y when x = 0. It is worked out as ȳ − b x̄, and it means something only if x = 0 falls within the data.
Interpolation
Predicting at an x value inside the range you saw. It is the fair use of a regression line.
Least-squares regression line
The one and only line ŷ = a + bx that makes the sum of squared vertical distances from the points to the line as small as possible.
Lurking variable
A third variable, not measured, that affects both x and y. It can create a correlation with no link of cause between them.
Outlier
A point lying far from the overall pattern of the scatterplot. It need not be extreme on either variable alone.
Regression to the mean
The tendency for predicted y values to be less extreme than their x values. This happens because the slope is r times sy÷sx, and |r| is less than 1.
Residual
Observed minus predicted, y − ŷ. It is positive above the line and negative below, and the residuals always add up to zero for a least-squares fit.
Residual plot
A graph of residuals against x (or against ŷ); a good one shows no pattern at all.
Response variable
The outcome being explained or predicted; it is plotted on the vertical axis and written y; it is also called the dependent variable.
Restricted range
A sample that covers only part of the possible x values. As a matter of math, that shrinks r and can hide a real relationship.
Scatterplot
A graph of two quantitative variables measured on the same people or things, with one dot for each.
Slope (b)
The predicted change in y for a one unit increase in x. It equals r × sy ÷ sx and always shares the sign of r.
Spurious correlation
A strong link between variables that have no link of cause, most often produced by a lurking variable or by chance.
Standard error of the estimate (se)
The typical size of a residual, √[SSE ÷ (n − 2)]. It is a root mean square measure of how far the points fall from the line. It divides by n − 2 because the fit used up a slope and an intercept.
Sum of squared errors (SSE)
Σ(y − ŷ)2, the variation in y left unexplained after fitting the line.
Total sum of squares (SST)
Σ(y − ȳ)2, the total variation in y about its mean, before any line is fitted.

Check yourself

1. A scatterplot of daily temperature (x) against heating cost (y) shows a tight band of points falling steadily from upper left to lower right, with one point far above the band. Describe the relationship in the four needed terms.
Form: linear. Direction: negative. Strength: strong. Outliers: one point lies well above the pattern. Use that fixed order every time. Form comes first, because if the form were curved, r and a least-squares line would both be wrong tools, no matter how tight the band looked.
2. Two scatterplots are shown. In plot P, the points are scattered loosely around a very steep line. In plot Q, the points lie almost exactly on a nearly flat line. Which shows the stronger relationship, and why?
Plot Q. Strength is about how tightly the points hug the pattern, not how steep the pattern is. Q's points barely stray from its line, so Q has the larger |r|. P's steep slope tells you about the rate of change, which is a separate question from strength.
3. For a data set, you work out Σ(x−x̄)(y−ȳ) = 60, Σ(x−x̄)2 = 40 and Σ(y−ȳ)2 = 250. Find r, and explain what it means.
r = 60 ÷ √(40 × 250) = 60 ÷ √10,000 = 60 ÷ 100 = 0.60. It is a moderate positive straight line relationship. Above average x values tend to come with above average y values, but with a lot of scatter. Note that r2 = 0.36, so only 36% of the variation in y is explained.
4. A classmate says, "r = −0.85 is a weaker relationship than r = +0.60 because −0.85 is a smaller number." Correct them.
Strength is the distance from zero, so −0.85 is clearly the stronger relationship. The sign carries only the direction: −0.85 means a strong downward pattern. Sign and size are two separate messages packed into one number.
5. The number of firefighters sent to a fire correlates strongly with the damage the fire causes. Should cities send fewer firefighters? Explain in the words of this chapter.
No. This is a lurking variable, not causation. The size of the fire drives both. Big fires draw more firefighters and cause more damage. The correlation is real, but the reading as cause is false. Only a randomized experiment could support a claim about cause, and no one would run that one.
6. A researcher measures hours of sleep and daytime alertness and reports r = 0.04, concluding that the two are unrelated. What has been missed?
An r near zero means no straight line tendency, not no relationship. Alertness rises and then falls with sleep, in an arch. The upward half and the downward half cancel in the top part of r. A scatterplot would have shown the curve at once, which is why you always plot before you work anything out.
7. Given x̄ = 50, ȳ = 200, sx = 10, sy = 30 and r = 0.60, find the least-squares regression line.
b = r sy ÷ sx = 0.60 × 30 ÷ 10 = 1.8; a = ȳ − b x̄ = 200 − 1.8(50) = 200 − 90 = 110. So ŷ = 110 + 1.8x. Check the point of averages: at x = 50, ŷ = 110 + 90 = 200 = ȳ; it is correct.
8. Our chapter line is ŷ = 60 + 3x for exam score on hours studied. Write a correct reading of the slope, and explain what makes the tempting version wrong.
"For each extra hour studied, the model predicts an increase of about 3 points in exam score, on average." The tempting version says, "studying one more hour raises your score by 3 points." That claims cause from data that came from watching, not an experiment. It also drops "on average," which suggests a promise for every person. The residuals of +6 and −5 flatly go against that.
9. The same line has an intercept of 60. Is that a meaningful prediction? Why or why not?
Not really. The hours we saw ran from 2 to 10, so x = 0 lies outside the data. The intercept is needed in the math to place the line. But predicting a score of 60 for a student who studies zero hours is extrapolation. An intercept is a fair forecast only when x = 0 falls inside the range you saw.
10. For our data, r2 = 0.81; which of these are correct readings? (a) 81% of the points lie on the line. (b) Predictions are 81% accurate. (c) 81% of the variation in exam scores is explained by the linear relationship with hours studied. (d) Studying causes 81% of exam performance.
Only (c). r2 = 1 − SSE÷SST = 1 − 88÷466 is a statement about variation. (a) mixes up variation with a count of points; in our data, zero points lie exactly on the line. (b) makes up an accuracy rate. (d) sneaks in cause, which no correlation can give.
11. Student C studied 5 hours and scored 70. Work out the residual, and state what its sign means. Then say what the six residuals must add up to.
ŷ = 60 + 3(5) = 75; residual = 70 − 75 = −5. The negative sign means the actual score fell below the line, so C did 5 points worse than the model predicted. All residuals from a least-squares line add up to exactly 0 (+6 − 3 − 5 − 1 − 1 + 4 = 0), which is a free math check.
12. A manager uses ŷ = 60 + 3x to argue that a student studying 20 hours would score 120. What is wrong, and what should the manager say instead?
This is extrapolation. 20 hours is double the largest value we saw, 10. And the "prediction" of 120 is above the 100 point maximum, which alone proves the line has left reality. The correct statement is this. The model was built on students studying 2 to 10 hours, and it only holds in that range. Beyond it, the relationship almost surely flattens as scores near their ceiling, and we have no data to describe that region.