Practice Problems
The quiz and the flashcards ask you to recognize a right answer. This page asks you to produce one. Every problem here gives you numbers small enough for a calculator and a sheet of paper, and every solution shows the whole path: the formula, the numbers going into it, the arithmetic, and the sentence you would actually write in a report.
How to use it: read the scenario, work the answer out on paper, and open the solution only afterwards. The value is in comparing your working to the steps, not your final number to an answer key. If a step loses you, the § link under each solution goes straight to the lesson it comes from.
- 📊 Stats 1 · Foundations
25 problems · data types → probability → z, t, proportions, χ², correlation and regression - 📝 Exam-style · A Stats 1 midterm
8 problems · §1.1 to §1.12, worked off the printed tables - 🔗 Stats 2 · Groups & relationships
21 problems · ANOVA → contrasts → factorial → regression → rank tests - 📝 Exam-style · A Stats 2 midterm
8 problems · §2.1 to §2.5, tables completed and read backwards - 📐 Regression · Several predictors
11 problems · multiple regression → omitted-variable bias → missing data - 🎲 Advanced · Modern methods
13 problems · Bayes → model comparison → latent variables → rotation - 🧪 Stats 3 · Latent variables & causal inference
8 problems · loading matrices → factor scores → a posterior as a table → IV, RD and DiD - 🔍 Research Toolkit · Spot the problem
6 problems · design, sampling, ethics, writing
📊 Stats 1 · Foundations
Twenty-five problems that follow the Stats 1 syllabus. They cover what kind of data you have, how to describe it, how far a score is from average, and how a sample mean leads to a confidence interval and then a z-test or a t-test. Three problems practice the probability rules, and the set ends with a proportion, a two-way table of counts, and a correlation and a fitted line worked by hand.
1What the library actually measured
Warm-upA city library logs eight things about every visitor who fills in the front-desk survey. The systems team wants a monthly report and has asked for "the average of each column".
- Membership number (e.g. 40118)
- Age in whole years
- Postcode district (M14, M20, M21…)
- Satisfaction, 1 = very dissatisfied to 5 = very satisfied
- Books borrowed in the last year
- Reading-room temperature in °C at the time of the visit
- Branch (Central, Didsbury, Withington)
- Position in the returns queue (1st, 2nd, 3rd…)
- Give the level of measurement for each column.
- Which columns can be averaged without an argument?
- The report comes back with a mean postcode district of 17.4. What has gone wrong?
- Is a reported mean satisfaction of 3.8 defensible?
Worked solution
- Classify each column
Column Level Why Membership number Nominal Numeric, but it is a name for a person, not a quantity Age in years Ratio Equal intervals and a real zero, so 40 is twice 20 Postcode district Nominal A label with digits in it Satisfaction 1–5 Ordinal Ordered, but the gap 1→2 need not equal 4→5 Books borrowed Ratio A count; zero books means zero borrowing Temperature °C Interval Equal intervals, arbitrary zero: 20 °C is not twice as warm as 10 °C Branch Nominal Unordered categories Queue position Ordinal Ranks; the gap between 1st and 2nd is not a fixed quantity - Which can be averaged Age, books borrowed and temperature. Interval and ratio data support addition and division, which is all a mean is.
- The postcode mean The digits in M14 encode a place, not an amount. Averaging them produces a number that refers to nothing: there is no location "17.4", and moving from M14 to M20 is not "six units" of anything.
- Mean satisfaction of 3.8 Strictly, a mean assumes equal spacing, and Likert points are only ordered. In practice psychology and market research report Likert means constantly, and with five or more points and roughly symmetric responses the distortion is small. Report the median and the full response distribution alongside it, and the reader can judge for themselves.
Three of the eight columns are nominal, two are ranks, one is interval and two are ratio. Only age, books borrowed and temperature are safely averageable, and a satisfaction mean needs a footnote.
From §1.2 Types of Data.
2The bakery's odd Saturday
Warm-upA small bakery counts the sourdough loaves it sells each day for nine days. One of those days was the street festival.
- Compute the mean and the median.
- Compute the sample standard deviation.
- Which of the two centers should the baker use to plan next Tuesday's flour order, and why?
Worked solution
- Mean x̄ = Σx / n Σx = 12+14+15+16+17+19+21+25+41 = 180 x̄ = 180 / 9 = 20.0 loaves
- Median The values are already in order and n = 9 is odd, so the median is the 5th value. Median = 17 loaves
- Deviations and their squares (x − x̄): −8, −6, −5, −4, −3, −1, 1, 5, 21 (x − x̄)²: 64, 36, 25, 16, 9, 1, 1, 25, 441 Σ(x − x̄)² = 618
- Variance, then standard deviation s² = Σ(x − x̄)² / (n − 1) = 618 / 8 = 77.25 s = √77.25 = 8.789 ≈ 8.79 loaves Divide by n − 1, not n: these nine days are a sample of the bakery's trading, not the whole of it.
- Which center to plan with The mean of 20 is dragged up by the single festival day. Drop that day and the mean of the remaining eight is 139 / 8 = 17.4, close to the median. For an ordinary Tuesday, plan with the median of 17, and plan for festival days separately.
Mean = 20.0, median = 17, s = 8.79 loaves. Order for about 17, and order extra for festival days separately.
Rounding: keep the full 8.7892 if the figure feeds another calculation, and round to 8.79 only when reporting.
From §1.3 Describing Data · check it in the Descriptives calculator.
3Priya's two marks
Warm-upPriya sat two papers that were marked on different scales by different examiners. She wants to know which one she actually did better on.
- Statistics: Priya scored 68. Cohort M = 60, SD = 10.
- Research Methods: Priya scored 74. Cohort M = 65, SD = 12.
- Convert both marks to z-scores.
- Which paper was her stronger performance relative to the cohort?
- Express both as T-scores, where T = 50 + 10z.
Worked solution
- Formula z = (x − μ) / σ
- Statistics z = (68 − 60) / 10 = 8 / 10 = 0.80
- Research Methods z = (74 − 65) / 12 = 9 / 12 = 0.75
- Compare The raw marks say Methods (74 > 68). The z-scores say Statistics, by a whisker: 0.80 SDs above her cohort against 0.75. The bigger raw mark came on the paper where everyone scored higher and the spread was wider.
- T-scores T = 50 + 10z Statistics: 50 + 10(0.80) = 58.0 Methods: 50 + 10(0.75) = 57.5
Statistics z = 0.80 (T = 58.0), Methods z = 0.75 (T = 57.5). Her Statistics paper was marginally the stronger performance, and the raw marks pointed the other way.
4Resting heart rate at the clinic
Exam-levelA clinic's records show that resting heart rate in healthy adults is close to normally distributed with a mean of 72 bpm and a standard deviation of 8 bpm. The nurse wants three numbers for a screening protocol.
- What proportion of adults have a resting heart rate below 60 bpm?
- What proportion fall between 64 and 84 bpm?
- What rate do only the highest 5% of adults exceed? Round to a whole bpm.
Worked solution
- Below 60 bpm: standardize z = (60 − 72) / 8 = −12 / 8 = −1.50 P(Z < −1.50) = .0668 About 6.7% of adults, or roughly 1 in 15.
- Between 64 and 84 bpm: two z-scores z₁ = (64 − 72) / 8 = −1.00 z₂ = (84 − 72) / 8 = +1.50
- Subtract the two cumulative areas P(−1.00 < Z < 1.50) = P(Z < 1.50) − P(Z < −1.00) = .9332 − .1587 = .7745 About 77.5%.
- The top 5%: go backwards from the area The cutoff leaves .95 below it, so z = 1.645 x = μ + zσ = 72 + 1.645(8) = 72 + 13.16 = 85.16 Round to 85 bpm for the protocol.
6.7% below 60 bpm, 77.5% between 64 and 84 bpm, and the top 5% above roughly 85 bpm.
Rounding: 1.645 is the conventional two-decimal z for the 95th percentile (1.6449 exactly). Using 1.64 gives 85.12 and using 1.65 gives 85.20, so at whole-bpm precision the choice does not matter here. It would matter if the protocol were written to one decimal.
From §1.5 Z-Scores & The Normal Distribution · check the areas in Statistical Tables.
5Who cycles to work
Warm-upA company surveys all 200 of its staff about commuting and cross-tabulates the answers by age band.
| Cycles | Does not | Total | |
|---|---|---|---|
| Under 30 | 48 | 52 | 100 |
| 30 or over | 22 | 78 | 100 |
| Total | 70 | 130 | 200 |
- Pick one employee at random. What is P(cycles)?
- What is P(cycles | under 30)?
- What is P(under 30 and cycles)?
- Are age band and cycling independent?
Worked solution
- Marginal probability P(cycles) = 70 / 200 = .35
- Conditional probability: the denominator shrinks P(cycles | under 30) = 48 / 100 = .48 Conditioning on "under 30" throws away the other row, so the denominator is that row's total, not 200.
- Joint probability P(under 30 and cycles) = 48 / 200 = .24
- Independence check If independent: P(A and B) = P(A) × P(B) P(under 30) × P(cycles) = .50 × .35 = .175 Observed joint = .24 ≠ .175
- Read it the other way too P(cycles | under 30) = .48 against P(cycles) = .35. Knowing someone's age band changes the probability that they cycle, so the two variables are dependent.
.35, .48, .24, and no: the two variables are dependent. Under-30s cycle at nearly twice the rate of over-30s (48% against 22%).
From §1.7 Probability Basics · test the dependence formally with a chi-square test (Problem 40 below).
6Sharpening the estimate
Exam-levelA driving-simulator lab knows from years of testing that braking reaction times in its population have a standard deviation of 60 ms. A new study will estimate the population mean.
- What is the standard error of the mean for a sample of 25 drivers?
- The lab raises the sample to 100. What happens to the standard error?
- How many drivers would be needed for a standard error of 4 ms?
- In one sentence, what does the standard error describe that the SD does not?
Worked solution
- Formula SE = σ / √n
- n = 25 SE = 60 / √25 = 60 / 5 = 12 ms
- n = 100 SE = 60 / √100 = 60 / 10 = 6 ms Four times the sample halves the standard error, because √4 = 2. The standard error shrinks with the square root of n, so each extra hundred drivers reduces it by less than the hundred before.
- Solve for n 4 = 60 / √n → √n = 60 / 4 = 15 n = 15² = 225 drivers
- SD against SE The SD describes how much individual drivers differ from each other, and it does not shrink when you collect more of them. The SE describes how much a sample mean would bounce around from study to study, and it shrinks as √n grows.
SE = 12 ms at n = 25, 6 ms at n = 100, and 225 drivers are needed for an SE of 4 ms.
7Thirty-six pizzas
Exam-levelA pizza chain's delivery times have a mean of 28 minutes and a standard deviation of 9 minutes. The distribution is clearly right-skewed: most deliveries cluster near the mean, and a long tail of bad nights stretches out to over an hour. A regional manager samples 36 deliveries.
- The population is skewed. Why can the manager still use the normal curve for the sample mean?
- What is the probability the sample mean exceeds 30 minutes?
- What is the probability it falls between 27 and 29 minutes?
Worked solution
- Why normality applies here The central limit theorem is about the distribution of the sample mean, not about the raw deliveries. With n = 36 the sampling distribution of x̄ is close to normal even though individual delivery times are not. The skew has to be extreme, or n small, for this to fail.
- Standard error SE = σ / √n = 9 / √36 = 9 / 6 = 1.5 min
- P(x̄ > 30) — standardize the mean, not a delivery z = (30 − 28) / 1.5 = 2 / 1.5 = 1.333 P(Z > 1.333) = 1 − .9088 = .0912
- P(27 < x̄ < 29) z₁ = (27 − 28) / 1.5 = −0.667 z₂ = (29 − 28) / 1.5 = +0.667 P(−0.667 < Z < 0.667) = .7475 − .2525 = .4950
- Sanity check A single delivery taking over 30 minutes is common. A mean of 36 deliveries doing so is not, at about 9%. The mean's standard error is 1.5 minutes, against an SD of 9 for a single delivery.
The CLT covers the sample mean regardless of the skew. P(x̄ > 30) = .091, and P(27 < x̄ < 29) = .495, so almost exactly half of such sample means are within a minute of the true mean.
Rounding: carry z = 1.333, not 1.3. Rounding to 1.3 gives .0968 instead of .0912, an error of more than half a percentage point.
8How much do first-years sleep?
Exam-levelA student union surveys 25 randomly selected first-years about weeknight sleep. The sample averages 6.8 hours with a standard deviation of 1.5 hours. Sleep hours are roughly symmetric with no outliers.
- Build a 95% confidence interval for the mean weeknight sleep of first-years.
- Public health guidance recommends 8 hours. What does the interval say about that?
- The union repeats the survey with 100 students and gets the same mean and SD. How does the interval change?
Worked solution
- Formula: t, not z, because σ is unknown CI = x̄ ± t* × (s / √n), df = n − 1
- Standard error SE = 1.5 / √25 = 1.5 / 5 = 0.30 h
- Critical value df = 25 − 1 = 24, t*(.025, 24) = 2.064
- Margin of error 2.064 × 0.30 = 0.619 h
- The interval 6.8 ± 0.619 = [6.18, 7.42] hours
- Against the 8-hour guidance 8 is well outside the interval, so 8 hours is not a plausible value for the population mean given this sample. Equivalently, a one-sample t-test against 8 would reject at α = .05. What the interval does not say is that 95% of first-years sleep between 6.18 and 7.42 hours: the interval is about the mean, not about individuals.
- With n = 100 SE = 1.5 / 10 = 0.15, df = 99, t* = 1.984 margin = 1.984 × 0.15 = 0.298 CI = [6.50, 7.10] hours Four times the sample gives an interval about half as wide, and t* also drifts down towards 1.96 as df grows.
95% CI [6.18, 7.42] hours. First-years sleep less than the recommended 8 hours, and quadrupling the sample narrows the interval to [6.50, 7.10].
From §1.11 Confidence Intervals · look up t* in Statistical Tables.
9What Marek thinks p means
Exam-levelAn allotment society tests a seaweed feed on tomatoes. Twenty-four plots, twelve fed and twelve not, yield measured in kilograms. The write-up reports a mean difference of 0.42 kg, t(22) = 2.31, p = .030. Marek reads it and writes in the newsletter: "There is only a 3% chance the seaweed feed makes no difference."
- State what p = .030 actually means here.
- Marek's neighbor replies: "So there is a 97% chance the effect is real." Is that a different mistake?
- At α = .05, what is the decision, and which error could it be?
- The society repeats the trial on 8 plots and gets p = .21. Has it now shown the feed does nothing?
- If twenty societies each ran one properly conducted trial of a feed that does nothing, at α = .05, how many "significant" results would you expect to see published?
Worked solution
- What p actually is If the feed made no difference, 3% of trials run this way would produce a difference of at least 0.42 kg in one direction or the other. It is the probability of data this extreme given the null hypothesis, written P(data | H₀).
- Marek's error He has flipped the conditional into P(H₀ | data). Those two are not interchangeable, and turning one into the other needs a prior probability that the test never supplies.
- The neighbor's version This is the same inversion. 1 − p is not the probability that the alternative is true, and it is not the probability the result replicates either.
- The decision p = .030 < α = .05 → reject H₀ If the feed does nothing, this rejection is a Type I error. Setting α = .05 caps that error rate at 5% over the long run; it says nothing about whether this particular result is the mistake.
- The 8-plot repeat No. A non-significant result means the data are compatible with no effect, not that the effect is zero. With 8 plots the test has very little power, so a real effect of this size would be missed most of the time. Failing to detect it is a Type II error. Report the confidence interval: if it stretches from −0.3 to +1.1 kg, the study is simply too small to settle the question.
- Twenty null trials Expected false positives = 20 × .05 = 1 One society in twenty would find "significant" evidence for a feed that does nothing. If only the exciting result gets into the newsletter, the newsletter reports an effect that is not there.
p is P(data at least this extreme | H₀ true), so both Marek and his neighbor have inverted the conditional. The decision is to reject at α = .05, with Type I error as the risk. The 8-plot follow-up shows nothing either way, and one false positive per twenty null trials is the expected background rate.
From §1.12 Hypothesis Testing Logic and §3.1 Effect Size & Power.
10Does the typing course deliver?
Exam-levelA typing course advertises that its graduates average 65 words per minute. A consumer group tests 16 graduates chosen at random and records a mean of 61.5 wpm with a standard deviation of 6.4 wpm.
- State the hypotheses.
- Compute the test statistic and its degrees of freedom.
- Make the decision against the critical value, and report the p-value.
- Compute Cohen's d and write the result as you would in a report.
Worked solution
- Hypotheses H₀: μ = 65 H₁: μ ≠ 65 Two-tailed, because the consumer group would report the course being better than claimed as well as worse.
- Standard error SE = s / √n = 6.4 / √16 = 6.4 / 4 = 1.60
- Test statistic t = (x̄ − μ₀) / SE = (61.5 − 65) / 1.60 t = −3.5 / 1.60 = −2.1875 df = n − 1 = 15
- Critical value t*(.025, 15) = 2.131 |−2.1875| = 2.188 > 2.131 → reject H₀
- p-value p = 2 × P(T₁₅ > 2.1875) = .045
- Effect size d = (x̄ − μ₀) / s = −3.5 / 6.4 = −0.55 A medium shortfall of just over half a standard deviation.
- Write-up Graduates typed more slowly than the advertised 65 wpm, M = 61.5, SD = 6.4, t(15) = −2.19, p = .045, d = −0.55, 95% CI [58.09, 64.91].
Reject H₀. The 65 wpm claim is not supported, though at p = .045 with n = 16 the evidence is thin, and the confidence interval reaches almost up to 65.
Rounding matters here. Carry t = −2.1875 rather than rounding the standard error first; this test clears its critical value by 0.06, so an early round-off can flip the decision. Report t to two decimals and p to three.
From §1.13 One-Sample & Paired t-Tests · format the sentence with the APA formatter.
11Ten students, one mnemonic
Exam-levelTen students learn a mnemonic technique. Each recalls a 20-item word list before training and a matched list afterwards. The difference scores (after − before) are recorded.
- Why is a paired test right here rather than an independent-samples test?
- Compute the mean difference and its standard deviation.
- Run the paired t-test at α = .05, two-tailed.
- Report the effect size.
Worked solution
- Why paired Each after-score is tied to a specific person's before-score. Subtracting within a person removes that person's baseline memory ability, and differences in baseline ability between people are most of the noise in these scores. An independent test would treat the twenty scores as twenty unrelated people and leave that noise in.
- Mean difference Σd = 3+5−1+4+6+2+0+7+3+1 = 30 d̄ = 30 / 10 = 3.00 items
- SD of the differences (d − d̄): 0, 2, −4, 1, 3, −1, −3, 4, 0, −2 (d − d̄)²: 0, 4, 16, 1, 9, 1, 9, 16, 0, 4 → Σ = 60 s_d = √(60 / 9) = √6.667 = 2.582
- Standard error and t SE = s_d / √n = 2.582 / √10 = 2.582 / 3.162 = 0.8165 t = d̄ / SE = 3.00 / 0.8165 = 3.674 df = n − 1 = 9
- Decision t*(.025, 9) = 2.262 3.674 > 2.262 → reject H₀ p = 2 × P(T₉ > 3.674) = .005
- Effect size for a paired design d_z = d̄ / s_d = 3.00 / 2.582 = 1.16 Large. Note that d_z is scaled by the SD of the differences, so it is not comparable with a between-groups d computed from raw score SDs. Say which one you used.
Recall improved by 3.00 items on average, t(9) = 3.67, p = .005, d_z = 1.16. With ten students and no control group, this shows the scores went up; it does not rule out practice or test-order effects.
From §1.13 One-Sample & Paired t-Tests · effect-size conversions in the converter.
12The study that could not see straight
StretchTwo ways of teaching fractions are compared in a small trial. Twelve children learn by manipulatives, twelve by worked examples, and all twenty-four sit the same end-of-topic test out of 100.
- Manipulatives: n = 12, M = 78.0, s = 8.0
- Worked examples: n = 12, M = 71.5, s = 9.0
- α = .05, two-tailed; variances judged similar enough to pool
- Run the independent-samples t-test.
- Compute Cohen's d.
- The researcher concludes "the two methods work equally well". Assess that.
- How many children per group would an 80%-powered replication need?
Worked solution
- Pooled variance s²_p = [(n₁−1)s₁² + (n₂−1)s₂²] / (n₁ + n₂ − 2) = [11(64) + 11(81)] / 22 = (704 + 891) / 22 = 1595 / 22 = 72.50 → s_p = √72.50 = 8.515
- Standard error of the difference SE = s_p × √(1/n₁ + 1/n₂) = 8.515 × √(1/12 + 1/12) = 8.515 × √0.1667 = 8.515 × 0.4082 = 3.476
- Test statistic t = (78.0 − 71.5) / 3.476 = 6.5 / 3.476 = 1.870 df = 12 + 12 − 2 = 22
- Decision t*(.025, 22) = 2.074 1.870 < 2.074 → fail to reject H₀, p = .075
- Effect size d = (M₁ − M₂) / s_p = 6.5 / 8.515 = 0.76 By Cohen's benchmarks that is medium-to-large, just short of the 0.80 mark, even though the test is not significant.
- Assess the conclusion "Equally well" is not supported. A non-significant result means the data do not rule out zero difference, and here the best estimate of the difference is 6.5 marks with d = 0.76. With 12 per group the study had about 43% power to detect an effect that size, so it was more likely to miss it than to find it. The trial was too small to decide either way.
- Sample size for a replication Two-sample t, d = 0.76, α = .05, power = .80 n = 29 per group (58 children total) 28 per group falls just short at 79.8% power, so the answer rounds up to 29. Planning for a medium d = 0.50 instead would need 64 per group. Powering a study on the effect size your own underpowered pilot produced is optimistic, because a pilot that reached significance has almost certainly overestimated the effect.
t(22) = 1.87, p = .075, d = 0.76. Not significant, not "no difference": a large point estimate measured with far too little precision. A replication needs at least 29 per group.
From §1.14 Independent Samples t-Test and §3.1 Effect Size & Power · redo the sample size in the Power calculator.
13Two electives, one overlap
Warm-upA department checks the records of all 400 final-year students. Two electives are on offer, and a student may take either, both, or neither.
- Took the statistics elective: 240
- Took the research-methods elective: 180
- Took both: 120
- Pick one student at random. What is P(statistics or methods)?
- What is P(neither elective)?
- How many took statistics but not methods?
- Are the two electives independent?
Worked solution
- The three probabilities you are given P(S) = 240 / 400 = .60 P(M) = 180 / 400 = .45 P(S and M) = 120 / 400 = .30
- General addition rule P(S or M) = P(S) + P(M) − P(S and M) = .60 + .45 − .30 = .75 Adding .60 and .45 gives 1.05, which is already impossible. The 120 students in the overlap were counted in both totals, so one copy of them has to be subtracted.
- Check it by counting people 240 + 180 − 120 = 300 students → 300 / 400 = .75
- Neither, by the complement rule P(neither) = 1 − P(S or M) = 1 − .75 = .25 → 100 students
- Statistics but not methods 240 − 120 = 120 students → .30 Methods but not statistics is 180 − 120 = 60, and the four groups 120 + 120 + 60 + 100 rebuild the 400.
- Independence check If independent: P(S and M) = P(S) × P(M) = .60 × .45 = .27 Observed: .30 ≠ .27 P(M | S) = 120 / 240 = .50 against P(M) = .45 Not independent, though the dependence is mild: taking statistics raises the chance of taking methods from .45 to .50.
.75, .25, 120 students, and no: .30 against the .27 independence would require. The gap is small, so run a formal test before making anything of it.
From §1.7 Probability Basics · the same table shape is tested for independence in §1.16 Chi-Square Tests.
14The screening letter
Exam-levelA health service offers a screening test for a condition that 2% of the eligible population has. The test detects 95% of the people who have it, and correctly clears 90% of the people who do not. Ten thousand people are screened. One of them opens a letter saying the result was positive.
- Prevalence: P(ill) = .02
- Sensitivity: P(positive | ill) = .95
- Specificity: P(negative | healthy) = .90
- Cohort: 10,000 people
- Fill in the four leaf counts of the tree.
- What is P(ill | positive)?
- What is P(healthy | negative)?
- The leaflet calls the test "95% accurate". What share of all 10,000 results does it actually get right, and is that the number the letter's reader needs?
Worked solution
- Split the cohort by the condition Ill: 10,000 × .02 = 200 Healthy: 10,000 − 200 = 9,800
- Split each branch by the test result Ill and positive: 200 × .95 = 190 Ill and negative: 200 − 190 = 10 Healthy and positive: 9,800 × .10 = 980 Healthy and negative: 9,800 − 980 = 8,820 The four leaves add back to 10,000. Check this every time.
- P(ill | positive): condition on the positives Positives in total: 190 + 980 = 1,170 P(ill | positive) = 190 / 1,170 = .162 → 16.2% The same answer from Bayes' rule, with the law of total probability underneath the line: (.02 × .95) / (.02 × .95 + .98 × .10) = .019 / .117 = .162.
- P(healthy | negative): condition on the negatives Negatives in total: 10 + 8,820 = 8,830 P(healthy | negative) = 8,820 / 8,830 = .9989 → 99.9% A negative result here is close to conclusive, while a positive one is mostly a false alarm.
- What "accurate" means, and what it hides Correct results: 190 + 8,820 = 9,010 → 9,010 / 10,000 = 90.1% The 95% in the leaflet is the sensitivity, P(positive | ill), which describes the test's behavior on people already known to be ill. The person reading the letter knows only the result and needs P(ill | positive), which is 16.2%. Overall accuracy, 90.1% here, is a third number. It is high mainly because 9,800 of the 10,000 people are healthy and the test clears 90% of them.
190 / 10 / 980 / 8,820. P(ill | positive) = 16.2%, P(healthy | negative) = 99.9%, overall accuracy 90.1%. Roughly five out of six positive letters go to someone who does not have the condition, so a positive screen is normally followed by a second, more specific test, not a diagnosis.
From §1.7 Probability Basics · rebuild the tree with the sliders in that lesson's Base-Rate Tree.
15Bikes back at the dock
Exam-levelA bike-share operator records X, the number of bikes returned to one quiet dock in an hour, over a long stretch of weekday mornings. The relative frequencies settle down into the distribution below.
| x | 0 | 1 | 2 | 3 | 4 |
|---|---|---|---|---|---|
| P(X = x) | .10 | .25 | .35 | .20 | .10 |
- Show that this is a legitimate probability distribution.
- Find the mean μ.
- Find the variance and standard deviation, by the definition and by the shortcut.
- What is P(X ≥ 2)?
- Would μ = np have given the mean more quickly?
Worked solution
- Two conditions to check Every P(X = x) lies between 0 and 1 ✓ .10 + .25 + .35 + .20 + .10 = 1.00 ✓
- Mean: μ = Σ x · p 0(.10) + 1(.25) + 2(.35) + 3(.20) + 4(.10) = 0 + .25 + .70 + .60 + .40 = 1.95 bikes The mean of a random variable need not be a value the variable can take. No hour ever sees 1.95 bikes returned.
- Variance by the definition: σ² = Σ (x − μ)² · p (0−1.95)²(.10) = 3.8025 × .10 = .380250 (1−1.95)²(.25) = 0.9025 × .25 = .225625 (2−1.95)²(.35) = 0.0025 × .35 = .000875 (3−1.95)²(.20) = 1.1025 × .20 = .220500 (4−1.95)²(.10) = 4.2025 × .10 = .420250 σ² = 1.2475
- Variance by the shortcut: σ² = E(X²) − μ² E(X²) = 0(.10) + 1(.25) + 4(.35) + 9(.20) + 16(.10) = 5.05 σ² = 5.05 − 1.95² = 5.05 − 3.8025 = 1.2475 ✓ σ = √1.2475 = 1.117 bikes The two routes must agree exactly, and the second is far less error-prone on a calculator, because it never subtracts the mean five separate times.
- A tail probability is a sum over the table P(X ≥ 2) = .35 + .20 + .10 = .65
- Why the binomial shortcut does not apply μ = np and σ = √(np(1 − p)) belong to a binomial count, which needs a fixed number of independent trials each carrying the same success probability. Nothing here supplies an n or a p: the table was measured, not derived from trials. So only the general formulas apply.
Valid distribution; μ = 1.95, σ² = 1.2475, σ = 1.117, P(X ≥ 2) = .65. The binomial shortcut needs a fixed n and a constant p, and this distribution has neither.
From §1.8 The Binomial Distribution · the same two sums, run on a binomial, give np and √(np(1 − p)).
16Fifteen visitors in one room
Exam-levelA museum times how long each of fifteen visitors spends in one small exhibition room, to the nearest minute. The times are already sorted.
- Give the five-number summary, using the textbook rule for the quartiles.
- Apply the 1.5 × IQR rule. Where are the fences, and which times fall outside them?
- Sketch the boxplot: say where the box edges, the median line, the two whisker ends and any separate points go.
- The same data in R returns Q1 = 9.5 and Q3 = 18.5. Does the flagged set change?
Worked solution
- Median first, because the quartiles are built from it n = 15 is odd, so the median is the 8th value. Median = 14 min
- Quartiles: median of each half, the median itself left out Lower half (7 values): 3, 6, 7, 9, 10, 12, 12 → Q1 = 4th = 9 Upper half (7 values): 15, 16, 18, 19, 21, 24, 41 → Q3 = 4th = 19 IQR = 19 − 9 = 10 min With an odd n the middle value belongs to neither half. Include it in both and you get different quartiles. This is one of the most common ways to lose a mark on this question.
- Five-number summary Min = 3 · Q1 = 9 · Median = 14 · Q3 = 19 · Max = 41
- Fences, then flags Lower: Q1 − 1.5 × IQR = 9 − 15 = −6 Upper: Q3 + 1.5 × IQR = 19 + 15 = 34 Only 41 lies outside [−6, 34] A negative lower fence is fine and quite common. It says nothing in this batch could have been low enough to flag, since the times cannot go below zero.
- The boxplot Box from 9 to 19, with the median line at 14, left of center inside the box. The left whisker runs to the minimum, 3. The right whisker stops at 24, the largest value still inside the upper fence, not at the maximum. The 41 is drawn as its own point beyond the whisker.
- The software answer R: Q1 = 9.5, Q3 = 18.5, IQR = 9 Fences: 9.5 − 13.5 = −4 and 18.5 + 13.5 = 32 The quartiles differ because R interpolates between neighboring values instead of taking the median of a half. The box would be drawn very slightly narrower, and 41 is still the only flagged time. The two conventions give slightly different quartiles but, as usually happens, the same conclusion.
Five-number summary 3, 9, 14, 19, 41. Fences at −6 and 34, so the 41 is the single flagged time. Box 9 to 19 with the median at 14, whiskers to 3 and 24, and 41 as a separate point. R's quartiles (9.5 and 18.5) move the fences to −4 and 32 and flag the same value.
Rounding: none needed. Every quartile here is a data value or halfway between two, so the arithmetic is exact.
From §1.3 Describing Data and §1.4 Visualizing Data · check it in the Descriptives calculator, prefilled, where the Quartiles switch turns the textbook answer into R's.
17Nine readings, one blood pressure
Exam-levelA clinic's automatic monitor comes with a calibration certificate: repeated readings on the same person vary with a standard deviation of 4 mmHg, and that figure is treated as known. A patient is measured nine times in one sitting and the readings average 138 mmHg.
- Give the standard error and the 95% z-interval for this patient's true mean pressure.
- Rebuild it at 99% confidence. How much wider is it, and what causes the extra width?
- The clinic wants a 95% margin of error no larger than 1.5 mmHg. How many readings does that take?
- A colleague reads the 95% interval as "a 95% probability the true mean lies between those two numbers". Say what is wrong with that sentence.
Worked solution
- Standard error, then the margin σ is known, so this is a z-interval and nothing is estimated in the denominator. SE = σ/√n = 4/√9 = 4/3 = 1.3333 mmHg m = z* × SE = 1.960 × 1.3333 = 2.6133 mmHg
- The 95% interval 138 ± 2.6133 = [135.39, 140.61] mmHg
- The same data at 99% m = 2.576 × 1.3333 = 3.4347 mmHg 138 ± 3.4347 = [134.57, 141.43] mmHg The width goes from 5.23 to 6.87 mmHg, about 31% wider, and the ratio of the two widths is 2.576/1.960. Nothing about the data changed. The interval is wider because a 99% procedure may miss only one time in a hundred, against one time in twenty at 95%.
- How many readings for m ≤ 1.5 Rearrange m = z*σ/√n for n. n = (z*σ/m)² = (1.960 × 4 / 1.5)² = 5.2267² = 27.32 Round up: n = 28 readings Markers often give a separate mark for the rounding direction. With 27 readings the margin comes out at 1.5088, which is over the limit; with 28 it is 1.4816.
- What the interval does not say The true mean is a fixed number, not a random one. This particular interval either contains it or it does not, and once the data are in, no probability applies to that. The 95% describes the procedure: if you built intervals this way again and again, 95% of them would contain the true mean.
SE = 1.3333 mmHg. The 95% interval is 138 ± 2.61 = [135.39, 140.61] and the 99% interval is 138 ± 3.43 = [134.57, 141.43], about 31% wider. A margin of 1.5 mmHg needs n = 28 readings. The "95% probability" reading is wrong because confidence describes the long-run behavior of the procedure, not any one interval.
Rounding: z* values taken as the printed 1.960 and 2.576. Intervals given to 2 dp; the sample size is always rounded up.
From §1.11 Confidence Intervals · watch it assemble in the Interval Builder, prefilled, and read z* off the printed Table D.
18Bulbs that may be dimmer than promised
Exam-levelA supplier advertises a mean lifetime of 1,200 hours for its LED bulbs. Years of testing across the industry put the standard deviation at 100 hours, and it is treated as known. A consumer group suspects the bulbs do not last as long as claimed, buys 25 of them and burns them out. The 25 last 1,165 hours on average.
- Write H₀ and H₁. The wording decides how many tails; say which words did it.
- Compute the standard error and the test statistic.
- Find the p-value and give the decision at α = .05 and at α = .01.
- A colleague argues the test should have been two-sided. Recompute the p-value that way, and say why the tail cannot be picked after the data arrive.
Worked solution
- Hypotheses, from the wording H₀: μ = 1,200 H₁: μ < 1,200 "Do not last as long as claimed" names a direction, so this is a left-tailed test. Had the group asked whether the advertised figure was simply wrong, H₁ would be μ ≠ 1,200.
- Standard error and statistic SE = σ/√n = 100/√25 = 100/5 = 20 h z = (x̄ − μ₀)/SE = (1,165 − 1,200)/20 = −35/20 = −1.75
- The p-value, left tail One tail, so read the area below −1.75 straight from Table A. p = P(Z < −1.75) = .0401
- Two decisions, two thresholds At α = .05: .0401 < .05, so reject H₀ At α = .01: .0401 > .01, so fail to reject H₀ The evidence is the same in both lines: z = −1.75 is past the .05 cutoff of −1.645 and short of the .01 cutoff of −2.326. So report α in the write-up, because "significant" means nothing without the threshold it was judged against.
- The two-sided version p = 2 × P(Z < −1.75) = 2 × .0401 = .0801 Doubling it pushes the result past .05, so a two-sided test keeps H₀ at both thresholds. The tail has to be fixed in advance, because choosing it once the sample mean is known means always taking the half that helps. That turns a nominal 5% false-alarm rate into an actual 10% one.
- The sentence to write At α = .05, one-tailed: the 25 bulbs give evidence that mean lifetime falls short of the advertised 1,200 hours, z = −1.75, p = .040. Report the estimated shortfall of 35 hours beside the p-value, since a 3% shortfall may or may not matter to a buyer.
H₀: μ = 1,200 against H₁: μ < 1,200, one-tailed because the group suspected a shortfall. SE = 20, z = −1.75, one-tailed p = .0401: reject at α = .05, fail to reject at α = .01. Two-sided the p-value is .0801, which rejects at neither.
Rounding: p-values to 4 dp from Table A; a printed table gives .0401 for z = −1.75 directly.
From §1.12 Hypothesis Testing Logic · load it into the explorer, prefilled, or look the area up on the printed Table A.
19Sixteen shots off one machine
Exam-levelA café is checking whether its espresso machine is pulling shots to the recipe, which calls for an extraction time of 25 seconds. Over one morning the barista times sixteen shots. They average 27.4 seconds with a sample standard deviation of 3.2 seconds. A histogram of the sixteen times leans mildly to the right and holds no unusual values.
- Give the standard error of the mean and the 95% confidence interval for the true mean extraction time.
- Read the verdict of a two-sided test at α = .05 off that interval, then confirm it by computing t and bracketing its p-value on Table D.
- Rebuild the interval at 99% confidence. Does the conclusion change?
- The times are mildly skewed. Is a t procedure defensible on sixteen observations, and which band of the rule of thumb decides it?
Worked solution
- Standard error, then the multiplier σ is unknown and s has been estimated from the same sixteen shots, so this is a t procedure with df = n − 1 = 15. SE = s/√n = 3.2/√16 = 3.2/4 = 0.800 s Table D, row 15, 95% column: t* = 2.131
- The 95% interval m = t* × SE = 2.131 × 0.800 = 1.705 s 27.4 ± 1.705 = [25.70, 29.11] s
- The verdict, read off the interval 25 is below 25.70, so it is outside the interval. A 95% interval holds exactly the values a two-sided test at α = .05 would not reject, so the test rejects H₀: μ = 25. t = (x̄ − μ₀)/SE = (27.4 − 25)/0.800 = 3.00 On row 15 of Table D, 3.00 falls between the .005 column (2.947) and the .0025 column (3.286), so the upper-tail area is between .0025 and .005 and the two-tailed p is between .005 and .01. Exactly, p = .0090. The interval and the test agree, as they must.
- The same data at 99% t*(15, 99%) = 2.947 → m = 2.947 × 0.800 = 2.357 s 27.4 ± 2.357 = [25.04, 29.76] s Still above 25, though only just. The two-tailed p of .0090 is under .01, so the test also rejects at the stricter threshold. Had p been, say, .03, the 99% interval would have contained 25 and the 95% one would not.
- Is t allowed here Sixteen observations put this in the middle band of the rule of thumb, 15 to 40, where mild skewness is acceptable and outliers are not. The description gives mild skew and no unusual values, so the procedure is defensible. Under 15 observations the same data would have needed a shape much closer to normal, and a single wild shot would have been a problem at any sample size, because it moves the mean and inflates s at once.
- The sentence to write Sixteen shots averaged 27.4 s (SD = 3.2), significantly longer than the 25 s the recipe calls for, t(15) = 3.00, p = .009, 95% CI [25.70, 29.11]. The interval is the more useful part of that sentence: the machine is running long by somewhere between 0.7 and 4.1 seconds. Whether that matters is a question about coffee rather than about statistics.
SE = 0.800 s. The 95% interval is 27.4 ± 1.71 = [25.70, 29.11], which excludes 25, so a two-sided test rejects at α = .05; t(15) = 3.00 with p between .005 and .01 on Table D (.0090 exactly). At 99% the interval is [25.04, 29.76] and still excludes 25. With n = 16, mild skew and no outliers, the middle band of the rule of thumb allows the t procedure.
Rounding: t* values as Table D prints them (2.131 and 2.947); interval limits to 2 dp.
From §1.13 One-Sample & Paired t-Tests · mark t = 3.00 on the t-distribution viz, read t* off the printed Table D, or paste a column into the descriptives calculator.
20Two warm-ups, two degrees of freedom
StretchA sports scientist compares two warm-up routines by measuring vertical jump height. Twelve athletes do the dynamic routine and fifteen do the static one; no athlete does both. The dynamic group averages 46.8 cm with a sample standard deviation of 5.4 cm, the static group 41.9 cm with a standard deviation of 4.1 cm. Working by hand, then checking the result in software, produces two different degrees of freedom.
- Compute the standard error of the difference between the two means, and the t statistic.
- Using the conservative degrees of freedom, give the critical value at α = .05 two-tailed, the decision, and the bracket Table D puts the p-value in.
- Software reports Welch degrees of freedom of 20.12 for the same data. Give the p-value there. Do the two answers agree, and would they always?
- Give the 95% confidence interval for the difference, using the conservative rule.
- Which answer should you write in an exam, and why is the conservative rule safe to accept?
Worked solution
- Standard error of the difference Each group contributes its own variance over its own n. The two contributions add before the square root; the two standard errors are never added. s₁²/n₁ = 29.16/12 = 2.4300 s₂²/n₂ = 16.81/15 = 1.1207 SE = √(2.4300 + 1.1207) = √3.5507 = 1.884 cm t = (46.8 − 41.9)/1.884 = 4.90/1.884 = 2.600
- The conservative degrees of freedom df = min(n₁ − 1, n₂ − 1) = min(11, 14) = 11 Table D, row 11, 95% column: t* = 2.201 2.600 is beyond 2.201, so H₀ of equal means is rejected at α = .05. On the same row, 2.600 is between the .02 column (2.328) and the .01 column (2.718). Those headings are one-tail areas, so the one-tail area is between .01 and .02, and doubling puts the two-tailed p between .02 and .04. Exactly, p = .0247.
- The same statistic on the software's curve Nothing about the data changed: the standard error is still 1.884 and t is still 2.600. Only the curve those numbers are read against moves, from 11 degrees of freedom to 20.12. df = 20.12 → p = .0171 Both reject at α = .05, so the two answers agree here. They would not always. A statistic between the two critical values, anywhere from 2.085 to 2.201 on this data, would clear the software's threshold and miss the hand rule's. The conservative rule is designed to err in that direction.
- The interval for the difference 4.90 ± 2.201 × 1.884 = 4.90 ± 4.147 95% CI = [0.75, 9.05] cm Zero is outside it, which matches the rejection. The width tells you more: with twenty-seven athletes, the dynamic routine's advantage could be anywhere from three quarters of a centimeter to nine, and only the top of that range would interest a coach. At the Welch df the interval tightens slightly, to [0.97, 8.83].
- Which one to write down In an exam, the conservative one. It needs nothing beyond a square root, and its errors all run the same way. It has the fewest degrees of freedom of the three rules, so its t distribution has the heaviest tails, its critical value is the highest and its p the largest. A result that clears that bar would clear either of the others too, so a marker can accept it without checking. Outside an exam, quote whichever df your software printed and say which one it was.
SE = 1.884 cm and t = 2.600. At the conservative df = 11, t* = 2.201, so H₀ is rejected at α = .05, with Table D bracketing the two-tailed p between .02 and .04 (.0247 exactly). At the Welch df of 20.12 the p is .0171; both reject, though they need not always. The conservative 95% CI for the difference is [0.75, 9.05] cm. Write the conservative answer in an exam, because it errs only toward caution.
Rounding: SE and t to three decimal places as a calculator gives them; t* as Table D prints it; interval limits to 2 dp. Pooling instead, which these unequal spreads do not obviously justify, would give sp = 4.716, t = 2.683 on 25 df and p = .0128.
From §1.14 Independent Samples t-Test · compare the three rules live in the Tug-of-War with the conservative df selected, or look t* up on the printed Table D.
21Two hundred riders, three verdicts
Exam-levelA bike-share operator has replaced the docking stations across a city and asks 200 riders whether the new ones are better, about the same, or worse than the old. The riders split into 120 annual members and 80 casual users. The operator wants to know whether the two kinds of rider are answering differently.
- Give the row totals, the column totals and the grand total, then the six expected counts. Do the textbook conditions hold?
- Compute the six components and add them to get χ².
- State the degrees of freedom, bracket the p-value off Table F, and give the decision at α = .05.
- Which cell contributes most, and what does that cell say about the two kinds of rider?
- Give each row's conditional distribution as percentages, and write the finding in one sentence.
Worked solution
- Margins first, then the expected counts Every expected count is its own row total times its own column total, divided by the grand total. Doing the margins first means each one is a single multiplication and a single division. Rows: 70 + 32 + 18 = 120 30 + 28 + 22 = 80 Columns: 100, 60, 40 N = 200 Members: 120 × 100/200 = 60 120 × 60/200 = 36 120 × 40/200 = 24 Casual: 80 × 100/200 = 40 80 × 60/200 = 24 80 × 40/200 = 16 Check the margins of the expected table before going on: 60 + 36 + 24 = 120 and 40 + 24 + 16 = 80, so the expected counts reproduce the observed totals, which they always must. The smallest expected count is 16, so every one clears 1, none is below 5, and the conditions hold comfortably.
- One component per cell Subtract, square, divide by the expected count. Keep four decimal places until the final addition. Members: (70 − 60)²/60 = 1.6667 (32 − 36)²/36 = 0.4444 (18 − 24)²/24 = 1.5000 Casual: (30 − 40)²/40 = 2.5000 (28 − 24)²/24 = 0.6667 (22 − 16)²/16 = 2.2500 χ² = 1.6667 + 0.4444 + 1.5000 + 2.5000 + 0.6667 + 2.2500 = 9.0278
- Degrees of freedom, then Table F df = (2 − 1) × (3 − 1) = 2 On the df 2 row, 9.0278 is between the .02 column (7.824) and the .01 column (9.210), so the p-value is between .01 and .02. Since that whole range is below .05, reject the hypothesis that rider type and verdict are independent. Exactly, p = .0110.
- Where the 9.03 came from The largest component is 2.50, casual riders who said better. Independence expects 40 of them and only 30 said so. The second largest, 2.25, is its mirror image: 22 casual riders called the stations worse where 16 were expected. Members run the other way in both cells. So casual users are markedly less enthusiastic than members, and both ends of their answer distribution show it. The smallest component, 0.44, says the middle option is answered almost identically by the two groups.
- The two conditional distributions A significant χ² says that the two rows differ. Divide each row by its own total to see how. Members: 70/120 = 58.3% 32/120 = 26.7% 18/120 = 15.0% Casual: 30/80 = 37.5% 28/80 = 35.0% 22/80 = 27.5% Everybody: 100/200 = 50% 60/200 = 30% 40/200 = 20% Members split 58 / 27 / 15 and casual users 38 / 35 / 28, against the 50 / 30 / 20 of the survey as a whole. Under independence, both rows would match that last line. The sentence to write: members are the ones happy with the new docks, and approval falls off steeply among casual users, a quarter of whom call the stations worse.
Expected counts 60, 36, 24 for members and 40, 24, 16 for casual riders; all conditions met. Components 1.6667, 0.4444, 1.5000, 2.5000, 0.6667 and 2.2500 give χ² = 9.03 on 2 df. Table F brackets p between .01 and .02 (p = .0110 exactly), so rider type and verdict are associated at α = .05. The biggest contributor is casual riders who chose "better", 30 against an expected 40. Row percentages: members 58.3 / 26.7 / 15.0, casual 37.5 / 35.0 / 27.5.
Rounding: components to 4 dp so the sum is right in the second decimal; χ² to 2 dp and percentages to 1 dp in the report. Reporting it: χ²(2, N = 200) = 9.03, p = .011. Problem 40 takes a different 2 × 3 table on to Cramér's V.
From §1.16 Chi-Square Tests · type the table into the Build a Table explorer to see the same components, the same row percentages and the tint, or look the critical values up on the printed Table F.
22Two reminders, one gap in attendance
Exam-levelA clinic sends appointment reminders two ways and records who turns up. Of 250 patients reminded by text message, 205 attended. Of 200 reminded by email, 148 attended. The practice manager wants to know whether the text reminder really does better, and by how much.
- Check the conditions, then give the two sample proportions and their difference.
- Compute the pooled proportion and the standard error the test uses, then the z statistic and its two-sided p-value.
- Give the 95% confidence interval for the difference.
- The interval's standard error is not the test's. Why not, and which one belongs where?
- Write the result as a sentence, and say what χ² on the same 2 × 2 table would give.
Worked solution
- Conditions, then the proportions Each group needs at least 10 successes and 10 failures. Here it is 205 and 45 in one group and 148 and 52 in the other, so the condition holds. Both samples are also small next to the population of patients a clinic sees. p̂₁ = 205/250 = 0.820 p̂₂ = 148/200 = 0.740 p̂₁ − p̂₂ = 0.080
- The test, which assumes H₀ H₀ says the two population proportions are equal. If that is true there is only one proportion to estimate, and every one of the 450 patients helps estimate it. That single pooled value goes into both halves of the standard error. p̂ = (205 + 148)/(250 + 200) = 353/450 = 0.7844 SE = √(0.7844 × 0.2156 × (1/250 + 1/200)) = √(0.16909 × 0.00900) = √0.0015218 = 0.03901 z = 0.080 / 0.03901 = 2.051 two-sided p = 2 × P(Z > 2.05) = .0403 Table A gives the area left of 2.05 as .9798, so the upper tail is .0202 and doubling it gives .0404. Reject H₀ at α = .05, though not at .01.
- The interval, which assumes nothing about p An interval has no hypothesized value to use, so each group estimates its own spread from its own data and the two variances add. SE = √(0.82 × 0.18/250 + 0.74 × 0.26/200) = √(0.0005904 + 0.0009620) = √0.0015524 = 0.03940 0.080 ± 1.96 × 0.03940 = 0.080 ± 0.077 95% CI = [0.003, 0.157]
- Why the two standard errors differ A proportion's spread depends on the proportion itself, so choosing a value for p also fixes the standard error. The test assumes H₀ is true, and under H₀ there is one shared proportion, so testing that hypothesis with two separate estimates would be inconsistent. The interval assumes nothing about p and has only the two observed proportions to work with. Here the two standard errors are 0.03901 and 0.03940, close enough that the conclusion is the same either way, but the formulas answer different questions, and swapping them loses marks.
- The sentence, and the same test as a χ² Text reminders were followed by attendance more often than email reminders, 82.0% against 74.0%, z = 2.05, p = .040, 95% CI of the difference [0.3%, 15.7%]. Laid out as a 2 × 2 table of attended against missed, the same 450 patients give χ²(1, N = 450) = 4.21, and 4.2055 is 2.0507 squared. The p-value is .040 either way. Report the z version, because it comes with the interval, and the interval is what the practice manager can act on: the advantage could be as small as a third of a percentage point.
p̂₁ = .820, p̂₂ = .740, difference .080. Pooled p̂ = .7844, test SE = .03901, z = 2.05, two-sided p = .040, so reject H₀ at α = .05. The 95% interval uses the unpooled SE = .03940 and runs [0.003, 0.157]. χ² on the same table is 4.21 on 1 df, which is z² exactly, with the same p.
Rounding: proportions to 3 dp, standard errors to 5 dp so the z is right to two decimals, interval limits to 3 dp. Reading z = 2.05 off Table A gives p = .0404 rather than .0403; both round to .040.
From §1.15 Inference for Proportions · set the counts in the One Proportion, or Two explorer, or check the areas on the printed Table A.
23Five wards, one waiting room
Exam-levelA hospital records, for five wards on the same weekday evening, how many nurses were on shift and the average time a patient waited to be seen. The manager wants a number for how strongly the two go together, computed by hand, because the report is due before anyone can get to a computer.
| Nurses on shift (x) | 2 | 4 | 6 | 8 | 10 |
|---|---|---|---|---|---|
| Mean wait, minutes (y) | 45 | 34 | 40 | 30 | 31 |
- Compute both means and both sample standard deviations.
- Build the table of deviations, standardized values and their products, and compute r as the average of the products.
- Interpret the sign and the size, and state what r² adds.
- Which ward contributes nothing to r, and why?
Worked solution
- Means and standard deviations x̄ = 30 / 5 = 6.0 nurses ȳ = 180 / 5 = 36.0 minutes Σ(x − x̄)² = 16 + 4 + 0 + 4 + 16 = 40 sx = √(40/4) = √10 = 3.162 Σ(y − ȳ)² = 81 + 4 + 16 + 36 + 25 = 162 sy = √(162/4) = √40.5 = 6.364
- The table of standardized products
Σ products = −3.180 r = −3.180 / (5 − 1) = −0.795 The shortcut route agrees, and is faster if you trust it: Σ(x − x̄)(y − ȳ) = −64, so r = −64 / √(40 × 162) = −64 / 96.00 = −0.795. Use whichever the question asks for; the standardized table is the one that shows your working.x y x − x̄ y − ȳ (x − x̄)/sx (y − ȳ)/sy product 2 45 −4 +9 −1.265 +1.414 −1.789 4 34 −2 −2 −0.632 −0.314 +0.199 6 40 0 +4 0.000 +0.629 0.000 8 30 +2 −6 +0.632 −0.943 −0.596 10 31 +4 −5 +1.265 −0.786 −0.994 - Interpretation The sign is negative, so more nurses goes with shorter waits. The size, |r| = .80, is a strong linear association by any of the usual benchmarks, though five wards is a very thin basis for it. r² = (−0.795)² = 0.632, so about 63% of the variation in waiting times across these five wards is accounted for by the variation in staffing. The other 37% is down to everything else: how sick the arriving patients were, how the ward is laid out, and plain chance.
- The ward that contributes nothing The six-nurse ward. Its standardized x is exactly zero, because its staffing equals the mean, and zero times its standardized y of +0.629 is zero. Its wait was four minutes longer than average, and r is unaffected. A point moves r only if it is away from both means, and the same arithmetic lets a single point far from both move r a long way.
x̄ = 6.0, ȳ = 36.0, sx = 3.162, sy = 6.364. The five standardized products are −1.789, +0.199, 0.000, −0.596 and −0.994, totalling −3.180, so r = −3.180/4 = −0.795. r² = 0.632. The six-nurse ward contributes nothing, because its standardized x is zero.
Rounding: standardized values and products to 3 dp, r to 3 dp. Carrying only 2 dp through the table gives −0.794, which still rounds to −0.79.
From §1.17 Correlation · step the same shape through the 📏 Correlation, Step by Step viz, or load these five wards straight into the explorer: ?data=2:45,4:34,6:40,8:30,10:31.
24The line from five summary numbers
Exam-levelA study of 60 first-year students records how many hours each slept the night before an exam and the mark they went on to get. The raw data is not in the report; the five numbers below are all the report prints. Sleep in the sample ranged from 4.5 to 9.0 hours.
- Find the least-squares line for predicting mark from sleep.
- Predict the mark for a student who slept 8 hours, and interpret the slope in the study's own units.
- What does the intercept mean here, and how much should anyone rely on it?
- A colleague wants the line for predicting sleep from mark instead, and suggests inverting the slope you already have. Give the right answer and say why the shortcut fails.
Worked solution
- Slope, then intercept b₁ = r · sy / sx = 0.42 × 11.4 / 1.2 = 0.42 × 9.5 = 3.99 b₀ = ȳ − b₁ x̄ = 63.5 − 3.99 × 6.8 = 63.5 − 27.132 = 36.368 ŷ = 36.37 + 3.99x
- Prediction and slope in words ŷ = 36.368 + 3.99 × 8 = 36.368 + 31.92 = 68.29 A student sleeping 8 hours is predicted to score about 68 marks. The slope says that one extra hour of sleep goes with about 4 more marks, on average, across these 60 students. It is an association, not a causal effect: no student was assigned a bedtime, so students who sleep more may differ in other ways that also help.
- The intercept b₀ = 36.4 is the mark the line predicts for a student who slept zero hours. No one in this sample slept less than 4.5 hours, so zero is well outside the data and the line has no evidence behind it there. Read it as the number that puts the line through (x̄, ȳ), not as a claim about sleepless students. Use the line for prediction only between 4.5 and 9.0 hours, where it runs from 54.3 to 72.3 marks.
- Swapping x and y b₁′ = r · sx / sy = 0.42 × 1.2 / 11.4 = 0.0442 hours per mark The inversion would have given 1/3.99 = 0.251, nearly six times too big. Correlation is symmetric and regression is not: the two slopes multiply to r² = 0.1764, not to 1, and they agree only when r = 1. Least squares minimizes vertical distances, and swapping the axes changes which direction "vertical" points, so it is a different line.
ŷ = 36.37 + 3.99x. At 8 hours the prediction is 68.3 marks, and each extra hour of sleep goes with about 4 more marks. The intercept 36.4 is the predicted mark at zero hours, far outside the observed 4.5 to 9.0 range and not interpretable. Reversing the roles gives b₁′ = 0.0442 hours per mark, not 1/3.99 = 0.251, because b₁ · b₁′ = r² = .1764.
Rounding: the slope is exact at 3.99 because 11.4/1.2 = 9.5 exactly; carry the intercept to 3 dp (36.368) before rounding the printed line to 2 dp.
From §1.18 Simple Linear Regression · the same identity is in the fourth block of the formula sheet, and the Correlation & Regression Calculator fits a line to raw columns when you have them.
25Half the variation, and still the wrong shape
Exam-levelA grower tests eight doses of fertilizer, one pot per dose, and counts the tomatoes each pot produces. Software fits the least-squares line ŷ = 17.0 + 2.0x and reports R² = .500, which the grower takes as a decent result and starts writing up.
| Dose, grams (x) | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| Tomatoes (y) | 12 | 20 | 26 | 30 | 32 | 32 | 30 | 26 |
- Compute the eight predicted values and the eight residuals, and check their total.
- Sketch the residuals against dose. Name the pattern and say what it means about the line.
- R² is .500. Reconcile that with your answer to part 2.
- A second grower's residual plot is a wedge instead, narrow at low doses and wide at high ones. Name that pattern and say what it invalidates.
Worked solution
- Predictions and residuals
Σ residuals = (−7 − 1 + 3 + 5) + (5 + 3 − 1 − 7) = 0 The total is zero, and it always is for a least-squares line, so it confirms the arithmetic without saying anything about the fit.x 1 2 3 4 5 6 7 8 ŷ = 17 + 2x 19 21 23 25 27 29 31 33 y 12 20 26 30 32 32 30 26 residual y − ŷ −7 −1 +3 +5 +5 +3 −1 −7 - The pattern Plotted against dose, the residuals rise from −7 to +5 and fall back to −7: a clean arch, negative at both ends and positive through the middle. That pattern means a curved relationship has been fitted with a straight line. Yield climbs with dose, levels off, then falls as the dose becomes too high, and a straight line cannot follow that. The line is too high at both ends and too low in the middle, by up to seven tomatoes.
- Why R² does not notice R² measures how much of the variation the line removes, not whether what is left has a shape. Here Σ(y − ȳ)² = 336 and the residuals leave 49 + 1 + 9 + 25 + 25 + 9 + 1 + 49 = 168, exactly half, so R² = 1 − 168/336 = .500 and r = .707. A rising line does capture the general upward trend over most of the range, and that accounts for half the variation. The other half is not noise but the curve. So draw a residual plot even when R² looks acceptable. This is the situation of Anscombe's second dataset, with different numbers.
- The other grower's wedge A wedge is non-constant spread, which regression calls heteroscedasticity. The line's shape may be perfectly right; what fails is the assumption that the scatter around it is the same size everywhere. Predictions at the wide end are much less reliable than at the narrow end. The standard errors, confidence intervals and p-values that Stats 2 computes all assume one shared spread, so they come out wrong at both ends. The usual repairs are a transformation of the outcome or a standard error that does not assume constant spread.
Predicted values 19, 21, 23, 25, 27, 29, 31, 33; residuals −7, −1, +3, +5, +5, +3, −1, −7, summing to zero. The residual plot is an arch, so the true relationship is curved and a straight line is the wrong shape. R² = .500 anyway, because R² measures variation removed rather than pattern left behind. The wedge is heteroscedasticity, which invalidates the standard errors rather than the shape of the line.
Rounding: none needed. Every predicted value and every residual is a whole number here, and R² is exactly .500 because Σ residual² = 168 is exactly half of Σ(y − ȳ)² = 336.
From §1.18 Simple Linear Regression · see the arch for yourself by loading these eight pots with the residual plot open: ?data=…&resid=1, then press "Snap to best fit". The full treatment is §2.8 Regression Diagnostics.
📝 Exam-style · A midterm on §1.1–§1.12
Eight problems written the way a paper exam asks them: one short scenario, several parts that build on each other, numbers a basic calculator can hold, and every area read off the printed tables rather than out of software. They span the first twelve sections of Stats 1, the usual coverage of a week 4 or week 5 midterm. The set above teaches one idea per problem; this one chains them.
26Four words that must not be swapped
Warm-upA university with 18,400 undergraduates wants to know how much sleep its students get on a weeknight. The registry draws a simple random sample of 250 names from the enrollment list and emails them a one-question form. 175 forms come back usable.
- Undergraduates enrolled: 18,400
- Names sampled: 250 · usable replies: 175
- Reported sleep: mean 6.8 hours, standard deviation 1.3 hours
- Replies reporting under 7 hours: 63
- Name the population, the sample, the parameter and the statistic for the sleep question.
- Write the right symbol for each of four quantities: the mean weeknight sleep of all 18,400; the 6.8; the true share of students sleeping under 7 hours; the share observed here.
- Compute the observed share.
- 75 of the 250 never replied. What does that put at risk, and would sampling 2,000 names instead of 250 repair it?
- Is the sample small enough, relative to the university, for the usual standard-error formulas to apply?
Worked solution
- The four words Population: all 18,400 enrolled undergraduates. Sample: the 175 who returned a usable form. Parameter: the mean weeknight sleep of the whole population, one fixed number that has not been measured. Statistic: the 6.8 hours, computed from the sample, and a different number in every sample the registry could have drawn.
- Notation μ = mean sleep of all 18,400 (parameter, unknown) x̄ = 6.8 hours (statistic, computed) p = true share sleeping under 7 hours (parameter, unknown) p̂ = observed share (statistic, computed) The population gets a Greek letter or a plain p; the sample gets a bar or a hat. Writing μ where you mean x̄ is a costly slip on an early exam, because every sentence after it is then about the wrong quantity.
- The observed share p̂ = 63 / 175 = 0.36 36% of the students who replied sleep under 7 hours. Note the denominator: 175, the people who answered, not the 250 who were asked.
- The 75 who did not reply The selection was random, but the participation was not. The 75 non-respondents chose not to answer, and whatever kept them from answering may well be related to sleep, so the 175 are no longer a random sample of the university. Sampling 2,000 names would give a more precise estimate of the same biased quantity: a bigger sample shrinks the standard error and leaves the bias where it was. The repair is to follow up the non-respondents, not to add more names.
- Sample size against population size 18,400 / 250 = 73.6, so the sample is about 1.4% of the university The usual caution is that the population should be at least ten or twenty times the sample. At 73.6 times, this one clears it comfortably, so the standard error depends on n alone and the size of the university does not enter the formula.
Population: all 18,400 undergraduates. Sample: the 175 usable replies. Parameter: μ, their true mean sleep. Statistic: x̄ = 6.8 hours. The observed share is p̂ = 63/175 = 0.36. The 30% non-response is a bias that a larger sample cannot fix, and at 1.4% of the population the sampling fraction is small enough to ignore.
From §1.1 What Is Statistics? and §1.6 Producing Data & Sampling Design.
27Thirteen calls to the help desk
Exam-levelA university IT help desk logs how long each caller waited before a person picked up, to the nearest minute. Here are thirteen calls from one morning, in the order they arrived.
- Sort the values and give the five-number summary, using the textbook rule for the quartiles.
- Apply the 1.5 × IQR rule. Where do the fences fall, and is the 47-minute call an outlier?
- The same thirteen numbers in R return Q1 = 9 and Q3 = 22. Redo part 2 with those and say what changes.
- The desk manager wants one number for a typical wait. Mean or median, and why?
Worked solution
- Sort first; nothing else works until you have 6, 7, 8, 9, 10, 11, 12, 14, 18, 22, 26, 31, 47 n = 13 is odd, so the median is the 7th value. Median = 12 min
- Quartiles: median of each half, the middle value in neither Lower half (6 values): 6, 7, 8, 9, 10, 11 → Q1 = (8 + 9)/2 = 8.5 Upper half (6 values): 14, 18, 22, 26, 31, 47 → Q3 = (22 + 26)/2 = 24 IQR = 24 − 8.5 = 15.5 min Five-number summary: 6 · 8.5 · 12 · 24 · 47
- Fences under the textbook quartiles 1.5 × IQR = 1.5 × 15.5 = 23.25 Lower: 8.5 − 23.25 = −14.75 Upper: 24 + 23.25 = 47.25 47 is inside the upper fence by a quarter of a minute, so this rule flags nothing. By this convention, the longest wait of the morning is not an outlier.
- The same rule on R's quartiles IQR = 22 − 9 = 13, so 1.5 × IQR = 19.5 Fences: 9 − 19.5 = −10.5 and 22 + 19.5 = 41.5 Now 47 is outside, and the boxplot draws it as a separate point. Two defensible conventions give opposite verdicts on the one call the manager cares about. This happens when a value is close to a fence. SPSS returns 8.5 and 24 here and agrees with the textbook rule, so the disagreement is not simply hand against software.
- One number for a typical wait Mean = 221 / 13 = 17.0 min · Median = 12 min The two are five minutes apart. The 47 and the 31 pull the mean up, and no caller that morning waited 17 minutes, while the median of 12 is a wait a caller actually had. Report the median for a typical wait, with the maximum beside it, because the manager needs to hear about a 47-minute hold and the median ignores it.
Five-number summary 6, 8.5, 12, 24, 47. Textbook fences −14.75 and 47.25 flag nothing; R's quartiles put the fences at −10.5 and 41.5 and flag the 47. Mean 17.0 against a median of 12: report the median, with the longest wait beside it.
Rounding: none. Every quartile is halfway between two whole values, and 221/13 is exactly 17.
From §1.3 Describing Data and §1.4 Visualizing Data · load it into the Descriptives calculator, prefilled and flip the Quartiles switch to watch the flag appear.
28Bags that say 500 grams
Exam-levelA machine fills bags of coffee labeled 500 g. The weight it actually delivers is normally distributed with a mean of 502 g and a standard deviation of 4 g. One shift produces 240 bags. Work every part from the printed Table A, and give the answer the table gives.
- What proportion of bags weigh less than the labeled 500 g?
- What proportion weigh more than 508 g?
- What proportion fall between 499 g and 506 g?
- About how many bags on this shift are under the label?
- Below what weight are the lightest 1% of bags?
Worked solution
- Under the label z = (500 − 502) / 4 = −0.50 Table A at z = −0.50 gives .3085 Table A always reports the area to the LEFT, and this question asks for that area, so the entry is the answer. About 30.85% of bags are under the label.
- Above 508 g z = (508 − 502) / 4 = 1.50 Table A at 1.50 gives .9332, the area BELOW P(X > 508) = 1 − .9332 = .0668
- Between 499 g and 506 g z₁ = (499 − 502)/4 = −0.75 → .2266 z₂ = (506 − 502)/4 = 1.00 → .8413 P(499 < X < 506) = .8413 − .2266 = .6147 A "between" question is two lookups and one subtraction, larger area first. Subtracting the z-scores instead of the areas is the standard way to lose this mark.
- How many of the 240 240 × .3085 = 74.04, so about 74 bags A proportion becomes a count by multiplying, and the answer is rounded to a whole bag because bags are whole.
- The lightest 1%: read the table backwards Look in the body of Table A for the area nearest .0100. It shows .0099 at z = −2.33 and .0102 at z = −2.32, so −2.33 is the nearer entry. x = μ + zσ = 502 + (−2.33)(4) = 502 − 9.32 = 492.68 g The lightest 1% of bags weigh under about 492.7 g, roughly 7 g short of the label. Software solving for the exact quantile returns z = −2.3263 and x = 492.69 g; on paper the table's entry is the answer, and the gap between the two is a hundredth of a gram.
.3085 under the label, .0668 above 508 g, .6147 between 499 g and 506 g, about 74 of the 240 bags under the label, and the lightest 1% below 492.68 g.
Rounding: Table A carries four decimal places, so the three proportions are exact as read. The 1% cutoff uses the table's two-decimal z and comes out 0.01 g from the exact value.
From §1.5 Z-Scores & The Normal Distribution · every area here is on the printed Table A, and the look-it-up drill below it sets the same three moves at random.
29What de Méré got wrong
Exam-levelTwo fair six-sided dice are rolled and both faces are recorded, so there are 36 equally likely outcomes. The second half of this problem is the pair of bets a seventeenth-century gambler took to Pascal, having noticed that one of them made money and the other did not.
- Find P(A), P(B), P(A and B), and P(A or B).
- De Méré's first bet was at least one 6 in four rolls of a single die, which he priced at 4 × 1/6 = 2/3. Say why that reasoning cannot be right, then give the correct probability.
- His second bet was at least one double 6 in 24 rolls of two dice. Compute it.
- How many rolls of two dice would the second bet have needed to be worth taking?
Worked solution
- Count outcomes, then apply the general addition rule A: (1,6) (2,5) (3,4) (4,3) (5,2) (6,1) → P(A) = 6/36 B: six rolls with a 6 first, six with a 6 second, the double 6 counted twice → 11/36 A and B: (1,6) and (6,1) → 2/36 P(A or B) = 6/36 + 11/36 − 2/36 = 15/36 = 5/12 = .4167 The overlap has to be subtracted once, because its two outcomes were counted in both totals. B needed the same correction when it was counted.
- Why 4 × 1/6 is not a probability Multiplying a probability by the number of trials is not one of the rules. Applied to six rolls, it gives 6 × 1/6 = 1, certainty, though six rolls can plainly miss. Applied to seven, it gives more than 1. The reasoning is the addition rule applied to events that are not disjoint, since two of the four rolls can both show a 6. P(no 6 in four rolls) = (5/6)⁴ = 625/1296 = .4823 P(at least one 6) = 1 − 625/1296 = 671/1296 = .5177 "At least one" is the signal to work with the complement: one multiplication and one subtraction, instead of adding up four overlapping cases.
- The second bet P(no double 6 on one roll of two dice) = 35/36 P(no double 6 in 24 rolls) = (35/36)²⁴ = .5086 P(at least one double 6) = 1 − .5086 = .4914 Just under a half, where the first bet was just over. De Méré lost slowly on one and won slowly on the other, and the two probabilities differ by less than three points, so it took him many evenings of play to notice.
- How many rolls he needed Want (35/36)ⁿ < .5, so n > ln(.5) / ln(35/36) = 24.6 n = 25: 1 − (35/36)²⁵ = .5055 One more roll turns the bet from a slow loss into a slow win. His mistake was to scale proportionally: four rolls for six faces seemed to imply 24 rolls for 36 pairs, but the probability of "at least one" does not scale that way.
P(A) = 6/36, P(B) = 11/36, P(A and B) = 2/36, P(A or B) = 15/36 = .4167. The first bet wins with probability .5177, not 2/3. The second wins with probability .4914, and would have needed 25 rolls to clear a half.
Rounding: probabilities to 4 dp. The two exact fractions are 671/1296 and 1 − (35/36)²⁴.
From §1.7 Probability Basics · all 36 outcomes are laid out in the dice lab.
30Two batteries out of the drawer
Exam-levelA drawer holds 12 identical-looking AA batteries. Four of them are flat and eight still work. Two are taken out at random, one after the other, and the first is not put back.
- Draw the probability tree and give P(both flat), P(neither flat) and P(at least one flat).
- What is P(the second is flat, given the first was flat)? What is P(the second is flat) if you know nothing about the first?
- Are the two draws independent? Say how you can tell before doing any arithmetic.
- Redo part 1 with the first battery put back. Which answers move, and which way?
Worked solution
- The tree, with the second layer conditioned on the first Flat then flat: (4/12)(3/11) = 12/132 = 1/11 = .0909 Flat then good: (4/12)(8/11) = 32/132 Good then flat: (8/12)(4/11) = 32/132 Good then good: (8/12)(7/11) = 56/132 = 14/33 = .4242 Before going further, check that the four leaves add up: 12 + 32 + 32 + 56 = 132 out of 132. P(at least one flat) = 1 − 14/33 = 19/33 = .5758
- Two probabilities that look alike and are not P(2nd flat | 1st flat) = 3/11 = .2727 P(2nd flat) = 12/132 + 32/132 = 44/132 = 1/3 = .3333 The unconditional answer is 1/3, the same as for the first draw. Before you see the first battery, the second is just as likely to be flat as the first. Once you have seen the first come out flat, the drawer holds one fewer flat battery, and the probability falls to 3/11.
- Independence, by inspection Not independent. Taking a battery out changes what is left, so the second draw is from a different drawer depending on how the first went. You can say that without arithmetic: sampling without replacement from a finite pile is dependent by construction. The numbers confirm it, since .2727 is not .3333.
- With replacement P(both flat) = (1/3)² = 1/9 = .1111 P(neither flat) = (2/3)² = 4/9 = .4444 P(at least one flat) = 1 − 4/9 = 5/9 = .5556 Both matching outcomes become more likely and the mixed outcome less likely. Without replacement, drawing a flat battery leaves a higher share of good ones in the drawer, so the second draw tends toward the other kind. Replacing the first battery removes that effect: every second-layer branch becomes 4/12 or 8/12 again, so the draws are independent.
Without replacement: P(both flat) = 1/11 = .0909, P(neither) = 14/33 = .4242, P(at least one flat) = 19/33 = .5758. P(2nd flat | 1st flat) = 3/11 against an unconditional 1/3, so the draws are dependent. With replacement the three become 1/9, 4/9 and 5/9.
Rounding: probabilities to 4 dp; every value here is an exact fraction.
From §1.7 Probability Basics.
31Eight questions, four options, no revision
Exam-levelA short class test has 8 multiple-choice questions with 4 options each and exactly one right answer per question. A student who has done no revision at all answers every question by guessing. Let X be the number correct. The pass mark is 5.
- Check the binomial conditions and name the distribution of X.
- Work out C(8, 3) by hand and use it for P(X = 3).
- Compute P(X ≤ 1).
- Give the mean and standard deviation of X.
- What is the probability of passing by guessing?
Worked solution
- The four conditions A fixed number of trials, n = 8. Two outcomes per trial, right or wrong. The guesses are independent, since one answer tells the student nothing about the next. And the success probability is the same each time, p = 1/4, because every question has four options. All four hold. X ~ B(n = 8, p = 0.25)
- C(8, 3), then the probability C(8,3) = 8! / (3! 5!) = (8 × 7 × 6) / (3 × 2 × 1) = 336 / 6 = 56 P(X = 3) = 56 × (0.25)³ × (0.75)⁵ = 56 × 0.015625 × 0.2373047 = .2076 Cancel before multiplying: 8 × 7 × 6 over 3 × 2 × 1 is three factors on top and three underneath, never the full 40,320. The three pieces are the number of ways to choose which questions come out right, the probability of getting those three right, and the probability of getting the other five wrong.
- P(X ≤ 1) is two terms P(X = 0) = (0.75)⁸ = .1001 P(X = 1) = 8 × (0.25) × (0.75)⁷ = 8 × 0.25 × 0.1334839 = .2670 P(X ≤ 1) = .1001 + .2670 = .3671 C(8,0) = 1 and C(8,1) = 8, so neither term needs the formula written out.
- Center and spread μ = np = 8 × 0.25 = 2 σ = √(np(1 − p)) = √(8 × 0.25 × 0.75) = √1.5 = 1.2247
- Passing by guessing P(X ≥ 5) = .0230713 + .0038452 + .0003662 + .0000153 = .0273 About 1 in 37. The pass mark of 5 is (5 − 2)/1.2247 = 2.45 standard deviations above the average guessing score. Four options per question keep the guessing score this low: with two options the mean guess score would be 4, and more than a third of the room would pass on luck (P = .363).
X ~ B(8, 0.25). C(8,3) = 56 and P(X = 3) = .2076. P(X ≤ 1) = .3671. μ = 2 correct, σ = 1.2247. The chance of passing by guessing is .0273, about 1 in 37.
Rounding: probabilities to 4 dp. The exact values are 13608/65536 for P(X = 3) and 6561/65536 for P(X = 0), and σ = √1.5 exactly.
From §1.8 The Binomial Distribution · see the whole distribution at n = 8, p = .25, and its shape beside the others in the distribution playground.
32One cup, then nine, then thirty-six
Exam-levelA vending machine is set to pour 250 ml of coffee. The amount it actually pours varies normally, with a mean of 250 ml and a standard deviation of 15 ml. The campus office treats anything under 244 ml as a short pour.
- A student buys one cup. What is the probability it is short?
- An inspector buys 9 cups and averages them. What is the probability that average is under 244 ml?
- Repeat with 36 cups.
- Put the three probabilities side by side and say in one sentence why they fall the way they do.
- Which of the three answers needs the individual pours to be normally distributed, and which would survive a skewed machine?
Worked solution
- One cup: standardize the cup z = (244 − 250) / 15 = −0.40 P = .3446 The denominator is σ itself, because this is a single pour.
- Nine cups: standardize the mean SE = σ/√n = 15/√9 = 5 ml z = (244 − 250) / 5 = −1.20 P = .1151 Same 6 ml shortfall, divided by a smaller denominator, so it counts as a bigger departure. Using σ = 15 here instead of SE = 5 is the classic error, and it returns the answer to part 1.
- Thirty-six cups SE = 15/√36 = 2.5 ml z = −6 / 2.5 = −2.40 P = .0082
- Why .3446, .1151 and .0082 Averaging cancels out random variation. One short cup is unremarkable. A mean of nine cups that is 6 ml low needs most of the nine pours to run low together, and for thirty-six cups it would be close to evidence that the machine itself has drifted, not that the day was unlucky. Quadrupling n only halves the standard error: 27 extra cups take it from 5 to 2.5, while the first 8 extra cups took it from 15 to 5.
- Which answers need normality Part 1 is about a single observation, so it needs the pours themselves to be normal; with no averaging, the central limit theorem does not apply. Parts 2 and 3 are about a sample mean, where the central limit theorem applies, but at n = 9 the answer still depends on the pours being roughly normal. At n = 36 the sampling distribution of the mean would be near normal even from a moderately skewed machine.
.3446 for one cup, .1151 for the mean of 9, .0082 for the mean of 36. The shortfall is the same 6 ml every time; what shrinks is the standard error, from 15 to 5 to 2.5. Only the first answer depends on the individual pours being normal.
Rounding: areas to 4 dp as Table A carries them. All three z-scores are exact two-decimal table entries.
From §1.9 Sampling Distributions and §1.10 Central Limit Theorem · the three areas are on the printed Table A.
33The interval and the test, on one delivery
StretchA supplier certifies its resistors at a mean of 100 Ω, and the factory's long production records put the standard deviation at 6 Ω, treated as known. A buyer measures 36 resistors from one delivery and gets a mean of 102.2 Ω. The contract lets the buyer reject a delivery whose mean is off spec in either direction.
- Build the 95% confidence interval for this delivery's mean.
- Run the two-sided z-test of H₀: μ = 100 at α = .05, taking the tail area from Table A.
- The interval and the test have to agree. Show that they do, and say why they must.
- Redo both at the 1% level. Do they still agree?
- Name the error the buyer could be making after each of the two decisions, and what it would cost.
Worked solution
- The 95% interval SE = σ/√n = 6/√36 = 1.0 Ω z* = 1.96, from the ∞ row of Table D margin = 1.96 × 1.0 = 1.96 Ω 102.2 ± 1.96 → [100.24, 104.16] 100 is not in that interval, which already answers part 3.
- The test z = (x̄ − μ₀)/SE = (102.2 − 100)/1.0 = 2.20 Table A at 2.20 gives .9861 below, so the upper tail is .0139 Two-sided p = 2 × .0139 = .0278 .0278 < .05, so reject H₀ Two-sided, because the contract lets the buyer complain about resistors that are too high or too low, and that decision was made by the contract rather than by looking at the 102.2.
- Why they cannot disagree The 95% interval is precisely the set of claimed means that a two-sided test at α = .05 would not reject. Both ask whether μ₀ is more than 1.96 standard errors from x̄: the interval measures that distance from the sample mean, and the test measures it from the claim. Here 100 is 2.20 standard errors away, past 1.96, so 100 is outside the interval and the test rejects it.
- The same delivery at the 1% level z* = 2.576 → 102.2 ± 2.576 → [99.62, 104.78] 100 IS inside this interval p = .0278 > .01, so fail to reject H₀ They agree again, in the other direction. At 99% confidence the interval is wide enough to contain 100, and at a 1% significance level the same evidence no longer clears the bar.
- Which error is possible after each decision At α = .05 the buyer rejected, so the only possible error is Type I: sending back a delivery that was on spec all along, at the cost of a return and a delay. At α = .01 the buyer did not reject, so the possible error is Type II: accepting a delivery whose mean really is about 2 Ω high, and building it into a product. Tightening α from .05 to .01 lowers the risk of a Type I error and raises the risk of a Type II error, so the right α depends on which mistake costs more here.
SE = 1.0 Ω. The 95% interval is [100.24, 104.16] and excludes 100; z = 2.20 with a two-sided p of .0278 rejects at α = .05. At the 1% level the interval [99.62, 104.78] contains 100 and the test fails to reject, because .0278 > .01. Rejecting risks a Type I error, failing to reject risks a Type II.
Rounding: z* taken as 1.96 and 2.576, the values printed under Table D. The exact quantiles are 1.95996 and 2.57583, which shift each endpoint by under a hundredth of an ohm. The tail area .0139 is Table A's entry at z = 2.20.
From §1.11 Confidence Intervals and §1.12 Hypothesis Testing Logic · build the interval in the Interval Builder, prefilled, then run the same numbers through the test explorer, prefilled.
🔗 Stats 2 · Groups & relationships
Twenty-one problems on comparing groups and describing a relationship. They cover three or more groups, factorial and repeated-measures designs, the assumptions that decide which test you may run, and the two ways of describing a straight line. Four ANOVA tables are built by hand, one of them a mixed design worked out from its degrees of freedom. The set also covers the planned and corrected comparisons that follow an omnibus test, and three rank-based tests worked against their printed critical-value tables. The group tests are Stats 2; correlation and regression are taught in Stats 1.
34Proofreading in three kinds of noise
Exam-levelFifteen copy-editors are randomly assigned to proofread the same 2,000-word article in one of three sound conditions. The outcome is the number of planted errors they missed.
- Silence: 3, 5, 4, 2, 6
- Instrumental music: 4, 7, 6, 5, 8
- Café chatter: 9, 6, 8, 10, 7
- Build the full one-way ANOVA table.
- Decide at α = .05.
- Report η² and say what it means.
- Why not run three t-tests instead?
Worked solution
- Group means and the grand mean Silence: Σ = 20, M = 4 Music: Σ = 30, M = 6 Café: Σ = 40, M = 8 Grand: Σ = 90, N = 15, GM = 6
- Between-groups sum of squares SS_B = Σ n_j (M_j − GM)² = 5(4−6)² + 5(6−6)² + 5(8−6)² = 5(4) + 5(0) + 5(4) = 40
- Within-groups sum of squares Silence: (−1)²+(1)²+0²+(−2)²+(2)² = 10 Music: (−2)²+(1)²+0²+(−1)²+(2)² = 10 Café: (1)²+(−2)²+0²+(2)²+(−1)² = 10 SS_W = 10 + 10 + 10 = 30 The three groups happen to have identical spread, so the ANOVA's equal-variance assumption holds.
- The table
df_B = k − 1 = 2, df_W = N − k = 12, and SS_B + SS_W = SS_Total confirms the arithmetic.Source SS df MS F Between (condition) 40 2 20.00 8.00 Within (error) 30 12 2.50 Total 70 14 - Decision F(2, 12) = 8.00, F*(.05, 2, 12) = 3.89 8.00 > 3.89 → reject H₀, p = .006
- Effect size η² = SS_B / SS_Total = 40 / 70 = .571 57% of the variance in errors missed is associated with the sound condition. η² is biased upward in small samples; ω² (omega squared) = .483 is a less biased estimate.
- Why not three t-tests Three pairwise tests at α = .05 raise the chance of at least one false positive from 5% to about 14% (1 − .95³ = .143 if the three were independent; because they share data the true figure is a little lower, but nowhere near .05). The ANOVA asks one question at one α, and the follow-up comparisons then get their own correction (Problem 35).
Sound condition affected proofreading, F(2, 12) = 8.00, p = .006, η² = .57. The omnibus test says the three means are not all equal; it does not say which pairs differ.
From §2.2 One-Way ANOVA.
35Which pairs actually differ?
Exam-levelThe ANOVA in Problem 34 was significant. Now find out which groups differ, using the same data.
- Compute the standard error for a pairwise comparison, and the three t statistics.
- Apply a Bonferroni correction and decide each comparison.
- Compute Tukey's HSD critical difference and check it agrees.
- What did the correction cost?
Worked solution
- Pairwise standard error: use MS_W, not just the two groups SE = √(MS_W × (1/n₁ + 1/n₂)) = √(2.50 × (1/5 + 1/5)) = √(2.50 × 0.40) = √1.00 = 1.00 Pooling all three groups' error gives df = 12 rather than the 8 a standalone pair would have.
- The three comparisons
Each t = difference / 1.00, evaluated on df = 12Comparison Difference t p Silence vs music 2 2.00 .069 Silence vs café 4 4.00 .002 Music vs café 2 2.00 .069 - Bonferroni α_adjusted = .05 / 3 = .0167 Silence vs café: .002 < .0167 → significant The other two: .069 > .0167 → not significant
- Tukey's HSD as a cross-check HSD = q*(.05, k = 3, df = 12) × √(MS_W / n) = 3.77 × √(2.50 / 5) = 3.77 × 0.707 = 2.67 Any difference above 2.67 is significant. The 4-point silence-café gap clears it; the two 2-point gaps do not. Both methods reach the same verdict. Tukey is slightly less conservative, because it is designed for comparing all pairs.
- What the correction cost Uncorrected, silence vs music at p = .069 would still not have reached .05, so nothing was lost here. In general Bonferroni gives up power to control false positives, and with many comparisons it gives up a lot. Tukey and Holm both hold the family-wise error rate at .05 with less loss of power.
Only silence against café chatter survives correction (difference = 4 errors, t(12) = 4.00, p = .002). Music is between the two and not distinguishable from either at α = .05.
From §2.3 Post-Hoc Tests.
36Caffeine, sleep, and the interaction
Exam-levelForty volunteers are crossed on two factors: 200 mg caffeine or none, and a normal night's sleep or four hours. Each of the four cells holds ten people. The outcome is mean reaction time in milliseconds on a vigilance task.
| Rested | Deprived | Row mean | |
|---|---|---|---|
| No caffeine | 420 | 520 | 470 |
| Caffeine | 410 | 450 | 430 |
| Column mean | 415 | 485 | 450 |
- Complete the ANOVA table: df, MS and F for all three effects.
- Decide each effect at α = .05.
- Compute the simple effect of caffeine in each sleep condition and interpret the interaction.
- Report partial η² for each effect.
Worked solution
- Degrees of freedom df_caffeine = 2 − 1 = 1 df_sleep = 2 − 1 = 1 df_interaction = 1 × 1 = 1 df_error = N − (number of cells) = 40 − 4 = 36
- Error mean square MS_error = 36,000 / 36 = 1,000
- The table
partial η² = SS_effect / (SS_effect + SS_error)Source SS df MS F p partial η² Caffeine 16,000 1 16,000 16.00 <.001 .308 Sleep 49,000 1 49,000 49.00 <.001 .576 Caffeine × Sleep 9,000 1 9,000 9.00 .005 .200 Error 36,000 36 1,000 - Decisions F*(.05, 1, 36) = 4.11 All three Fs exceed 4.11, so both main effects and the interaction are significant.
- Simple effects of caffeine Rested: 420 − 410 = 10 ms Deprived: 520 − 450 = 70 ms
- Interpret the interaction The effect of caffeine depends on sleep. It speeds a rested person by 10 ms, close to nothing, and a sleep-deprived person by 70 ms. Reporting the caffeine main effect on its own ("caffeine improved reaction time by 40 ms") would describe an average that fits neither group. With a significant interaction, lead with the simple effects and treat the main effects as background.
Both main effects and the interaction are significant. Sleep deprivation is the larger influence (partial η² = .58), and caffeine helps mainly when you are short of sleep: 70 ms recovered when deprived against 10 ms when rested.
37When Mauchly complains
StretchTwelve typists each try three keyboard layouts in a counterbalanced order. The outcome is words per minute. The software prints a repeated-measures ANOVA and a sphericity test alongside it.
- SS_conditions = 84.5, SS_error = 159.2
- n = 12 participants, k = 3 conditions
- Mauchly's W = .62, p = .03
- Greenhouse–Geisser ε = .71
- Compute the uncorrected F and its degrees of freedom.
- What does Mauchly's test say, and why does it matter?
- Apply the Greenhouse–Geisser correction and re-decide.
- Report partial η².
Worked solution
- Degrees of freedom df_conditions = k − 1 = 2 df_error = (n − 1)(k − 1) = 11 × 2 = 22 The error term is smaller than a between-subjects design's would be, because each typist serves as their own control.
- Mean squares and F MS_conditions = 84.5 / 2 = 42.25 MS_error = 159.2 / 22 = 7.236 F = 42.25 / 7.236 = 5.84 F*(.05, 2, 22) = 3.44 → significant, p = .009
- What Mauchly's test found Sphericity means the variances of the differences between every pair of conditions are equal. Mauchly's p = .03 rejects that assumption. When sphericity fails, the F ratio is positively biased: the real Type I error rate runs above the nominal 5%, so the uncorrected p of .009 is too small.
- Greenhouse–Geisser correction Multiply both df by ε = .71 df_conditions = 2 × .71 = 1.42 df_error = 22 × .71 = 15.62 F itself is unchanged at 5.84. Only the reference distribution changes, and with fewer degrees of freedom it gives a larger p.
- Re-decide F(1.42, 15.62) = 5.84, p = .020 Still below .05, so the conclusion stands, though the p-value roughly doubled. With an uncorrected p near .04, the correction would have changed the decision.
- Effect size partial η² = 84.5 / (84.5 + 159.2) = 84.5 / 243.7 = .347
Layout affected typing speed, F(1.42, 15.62) = 5.84, p = .020, partial η² = .35, with Greenhouse–Geisser applied because Mauchly's test rejected sphericity. Report the corrected df with their decimals; fractional df are normal after a correction.
38Two clinics, two very different spreads
Exam-levelA service evaluation compares how many therapy sessions clients attend at two clinics. Clinic A is small and runs a fixed 12-session program. Clinic B is large and open-ended, and its distribution is heavily right-skewed with a handful of clients attending forty or more sessions. Levene's test returns p = .004.
- Clinic A: n = 15, M = 8.2, s = 3.1
- Clinic B: n = 45, M = 6.4, s = 6.9
- Levene's test: p = .004
- Which assumption has failed, and what does Levene's p = .004 mean?
- The t-test assumes normality. Of what, exactly?
- Run Welch's t-test, including its degrees of freedom.
- A colleague suggests Mann–Whitney instead. Argue both sides.
Worked solution
- The failed assumption s²_B / s²_A = 47.61 / 9.61 = 4.95 Clinic B's variance is roughly five times Clinic A's. Levene's p = .004 says a variance gap this large would be rare if the population variances were equal, so homogeneity of variance is rejected. Note that Levene's test is itself sensitive to sample size; with unequal n and a visible five-fold gap, the plot and the ratio agree with it here.
- Normality of what Of the sampling distribution of each group mean, not of the raw session counts. With n = 45 the central limit theorem largely covers Clinic B despite the skew. Clinic A's mean rests on only 15 clients, but its distribution is the tidier one.
- Welch's t — no pooling SE = √(s₁²/n₁ + s₂²/n₂) s₁²/n₁ = 9.61 / 15 = 0.6407 s₂²/n₂ = 47.61 / 45 = 1.0580 SE = √1.6987 = 1.3033 t = (8.2 − 6.4) / 1.3033 = 1.8 / 1.3033 = 1.381
- Welch–Satterthwaite degrees of freedom df = (s₁²/n₁ + s₂²/n₂)² / [ (s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1) ] = (1.6987)² / [ 0.6407²/14 + 1.0580²/44 ] = 2.8855 / [ 0.029318 + 0.025442 ] = 2.8855 / 0.054760 df = 52.69 t*(.025, 52.69) = 2.006 → 1.381 < 2.006, p = .173
- What pooling would have done The pooled SD is 6.20, dominated by the larger, wider Clinic B. Student's t would give 0.97 on df = 58, p = .334. Both tests fail to reject, but they disagree substantially about how far apart the clinics are. So choose the test before you see which answer each one gives.
- Welch or Mann–Whitney For Mann–Whitney: session counts are bounded below at zero and badly skewed, and the median is arguably the more meaningful summary for a service report. Against: Mann–Whitney tests stochastic dominance rather than means, and with unequal spreads its interpretation is no cleaner than Welch's. Welch handles unequal variances directly and keeps the outcome on its natural scale. Running one, reporting it, and saying why is better practice than running both and reporting the smaller p.
Homogeneity of variance fails. Welch's t(52.69) = 1.38, p = .173: the clinics do not differ detectably in sessions attended, and Welch is the defensible default whenever the variances are unequal.
From §2.6 ANOVA & t-Test Assumptions · the assumption-checks poster lists the fix for each violation.
39Five dogs each, no normality in sight
Exam-levelTwo rescue shelters record days-to-adoption for five dogs each. The samples are far too small to judge normality, and one shelter has a dog that waited a month.
- Shelter A: 12, 15, 18, 22, 31
- Shelter B: 9, 11, 14, 17, 20
- Rank all ten values and compute the rank sums.
- Compute U for each group and check them against each other.
- Decide at α = .05, two-tailed, given U* = 2.
- What is the smallest p-value this design could ever produce?
Worked solution
- Pool and rank, smallest first
No ties, so no shared ranks to average.Value 9 11 12 14 15 17 18 20 22 31 Shelter B B A B A B A B A A Rank 1 2 3 4 5 6 7 8 9 10 - Rank sums R_A = 3 + 5 + 7 + 9 + 10 = 34 R_B = 1 + 2 + 4 + 6 + 8 = 21 Check: 34 + 21 = 55 = N(N+1)/2 = 10(11)/2 ✓
- Convert rank sums to U U = R − n(n+1)/2 U_A = 34 − 5(6)/2 = 34 − 15 = 19 U_B = 21 − 15 = 6 Check: U_A + U_B = 25 = n_A × n_B ✓
- Decision U = min(19, 6) = 6 U*(.05, n₁ = n₂ = 5, two-tailed) = 2 6 > 2 → fail to reject H₀ Mann–Whitney is one of the few tests where you reject when the statistic is small. The exact two-tailed p here is .222.
- The floor on p Five against five gives C(10,5) = 252 possible arrangements. Exactly one of them puts every Shelter B dog ahead of every Shelter A dog, and one puts the reverse, so the smallest attainable two-tailed p is 2/252 = .0079. The rejection region at α = .05 is U ≤ 2, which is four arrangements in each tail out of 126, so a design this small can only detect something close to complete separation.
U = 6, p = .222: no detectable difference in days to adoption. Shelter B looks faster in every summary you could compute, and with five dogs each the test cannot tell that apart from chance.
40How first-years and finalists revise
Exam-levelA department asks 180 students how they prefer to revise. It wants to know whether preference depends on year group.
| Alone | In pairs | In groups | Total | |
|---|---|---|---|---|
| First year | 30 | 45 | 45 | 120 |
| Final year | 30 | 15 | 15 | 60 |
| Total | 60 | 60 | 60 | 180 |
- Compute the expected counts and check the assumption about them.
- Compute χ² and its degrees of freedom.
- Decide at α = .05.
- Report Cramér's V and describe where the association comes from.
Worked solution
- Expected counts E = (row total × column total) / N First year: 120 × 60 / 180 = 40 (all three columns) Final year: 60 × 60 / 180 = 20 (all three columns) All expected counts are 20 or above, comfortably clear of the "at least 5" rule, so no correction or exact test is needed.
- Cell contributions χ² = Σ (O − E)² / E (30−40)²/40 = 100/40 = 2.500 (45−40)²/40 = 25/40 = 0.625 (twice) (30−20)²/20 = 100/20 = 5.000 (15−20)²/20 = 25/20 = 1.250 (twice)
- Total and df χ² = 2.500 + 0.625 + 0.625 + 5.000 + 1.250 + 1.250 = 11.25 df = (rows − 1)(columns − 1) = (2 − 1)(3 − 1) = 2
- Decision χ²*(.05, 2) = 5.99 11.25 > 5.99 → reject H₀, p = .004
- Effect size Cramér's V = √( χ² / (N × min(r−1, c−1)) ) = √( 11.25 / (180 × 1) ) = √0.0625 = .25 A small-to-moderate association.
- Where the association comes from The single largest contribution is the final-year "alone" cell at 5.00, where 30 students chose solitary revision against 20 expected. Only a quarter of first-years revise alone, and three-quarters work with someone; among finalists it is half and half. Read the biggest cell contributions to turn a significant χ² into a sentence about people.
Revision preference depends on year group, χ²(2, N = 180) = 11.25, p = .004, Cramér's V = .25. Final-years revise alone far more than first-years do.
From §1.16 Chi-Square Tests · check the critical value in Statistical Tables.
41Sleep and next-day mood
Exam-levelSix volunteers keep a one-week diary. For each person the researcher records average nightly sleep in hours and average next-day mood on a 1–10 scale.
| Sleep (x) | 4 | 5 | 6 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|
| Mood (y) | 3 | 5 | 4 | 5 | 7 | 6 |
- Compute Pearson's r.
- Test it at α = .05, two-tailed.
- Interpret r².
- A magazine reports "sleep improves mood". Give two explanations of this correlation that do not involve sleep causing mood.
Worked solution
- Means x̄ = 42 / 6 = 7.0 ȳ = 30 / 6 = 5.0
- Deviations and cross-products
x y x−x̄ y−ȳ (x−x̄)² (y−ȳ)² product 4 3 −3 −2 9 4 6 5 5 −2 0 4 0 0 6 4 −1 −1 1 1 1 8 5 1 0 1 0 0 9 7 2 2 4 4 4 10 6 3 1 9 1 3 Sums 28 10 14 - Pearson's r r = Σ(x−x̄)(y−ȳ) / √( Σ(x−x̄)² × Σ(y−ȳ)² ) = 14 / √(28 × 10) = 14 / √280 = 14 / 16.733 r = .837
- Significance test t = r√(n−2) / √(1 − r²), df = n − 2 = 4 = .837 × √4 / √(1 − .70) = 1.673 / √0.30 = 1.673 / 0.548 = 3.055 t*(.025, 4) = 2.776 → 3.055 > 2.776, reject H₀, p = .038 Significant, but only just, and on six people: with n = 6, even a correlation this large barely clears the bar.
- r² r² = .837² = .70 70% of the variance in mood is shared with sleep in this sample. "Shared", not "caused by", and in a sample this small the estimate is very unstable.
- Two non-causal readings Reverse direction: low mood disrupts sleep, which is well documented, so mood could be driving sleep rather than the other way round. Third variable: workload, pain, a new baby, or alcohol would each push sleep down and mood down at the same time, producing the correlation without either measured variable affecting the other. Only random assignment to a sleep condition would separate these.
r(4) = .84, p = .038, r² = .70. Strong and significant in this sample, and entirely consistent with mood driving sleep or with something else driving both.
From §1.17 Correlation · try the correlation calculator.
42The same six people, as a line
Exam-levelTake the sleep-and-mood data from Problem 41 and fit a regression line predicting mood from sleep.
- Find the slope and intercept, and write the regression equation.
- Interpret the slope in the units of the study.
- Predict mood for someone sleeping 6 hours, and compute that person's residual.
- The researcher predicts mood at 2 hours of sleep. Why should they not?
Worked solution
- Slope b = Σ(x−x̄)(y−ȳ) / Σ(x−x̄)² = 14 / 28 = 0.50
- Intercept: the line goes through (x̄, ȳ) a = ȳ − b·x̄ = 5.0 − 0.50(7.0) = 5.0 − 3.5 = 1.50 ŷ = 1.50 + 0.50x
- Interpret the slope Each extra hour of sleep is associated with half a point more mood on the 1–10 scale. The intercept of 1.50 is the predicted mood at zero hours of sleep, which is outside the data and not meaningful on its own.
- Prediction and residual at x = 6 ŷ = 1.50 + 0.50(6) = 4.50 observed y = 4 residual = y − ŷ = 4 − 4.50 = −0.50 This person's mood was half a point below what their sleep predicted.
- All six residuals, as a check −0.5, +1.0, −0.5, −0.5, +1.0, −0.5 Σ residuals = 0 ✓ (always true for a least-squares fit with an intercept) SS_residual = 0.25 + 1 + 0.25 + 0.25 + 1 + 0.25 = 3.00
- Tie it back to r² SS_total = 10, SS_residual = 3.00, SS_regression = 7.00 r² = 7.00 / 10 = .70 ✓ matches Problem 41 s_e = √(SS_residual / (n − 2)) = √(3/4) = 0.87
- Why not predict at 2 hours The data run from 4 to 10 hours. Predicting at 2 assumes the straight line continues where no one was measured, and these six people give no evidence that it does. Mood is bounded at 1, and the true relationship almost certainly bends at the extremes.
ŷ = 1.50 + 0.50x. At 6 hours the model predicts 4.50, the person scored 4, so the residual is −0.50. The fit explains 70% of the variance in mood over the observed range of 4 to 10 hours, and says nothing about 2.
From §1.18 Simple Linear Regression · fit it in the correlation & regression calculator.
43Reading the diagnostics before the coefficients
StretchAn estate agency fits a regression predicting house price from floor area and number of bedrooms, on 40 properties. Before interpreting anything, the analyst prints the diagnostics.
- n = 40, two predictors
- Residuals against fitted values: a clear fan, narrow at low predicted prices and wide at high ones
- Case 31: leverage h = 0.31, Cook's D = 0.68
- Correlation between floor area and bedrooms: r = .92
- Name the problem the fan-shaped residual plot shows, and say what it damages.
- Case 31: is its leverage unusual? Is its Cook's D?
- Compute the VIF for the two predictors and interpret it.
- What should the analyst do before reporting coefficients?
Worked solution
- The fan Heteroscedasticity: residual variance grows with the fitted value, which is typical for prices. The coefficients stay unbiased, so the slope estimates are still right on average. The standard errors are wrong, and so are the t-tests, p-values and confidence intervals built on them, which are usually too narrow at the top end.
- Leverage Cutoff = 2(k + 1)/n = 2(2 + 1)/40 = 6/40 = 0.15 h = 0.31, about twice the cutoff Case 31 is far out on the predictors: a very large house, or an unusual combination of area and bedrooms. High leverage alone is not a problem. It means only that the case could pull the line.
- Cook's D Common cutoffs: D > 1, or the stricter 4/n = 4/40 = 0.10 D = 0.68 → below 1, but nearly seven times 4/n High leverage plus a large Cook's D means this case is moving the fitted coefficients. Refit without it and see how much the slopes shift.
- Multicollinearity VIF = 1 / (1 − r²) = 1 / (1 − .92²) = 1 / (1 − .8464) = 1 / .1536 = 6.51 Above the usual warning level of 5. Floor area and bedroom count carry nearly the same information, so the model cannot tell their contributions apart. The symptom to expect is a significant overall F with two unstable, possibly non-significant individual coefficients, one of which may even have the wrong sign.
- What to do, in order Investigate case 31 as a data point before deleting anything, since a real mansion is information, not error, and report the fit with and without it if it matters. For the fan, model log(price) instead of price, or keep the model and use heteroscedasticity-robust standard errors. For the VIF, drop one predictor or combine the two into a single size measure, and be explicit that the model now answers a narrower question. Report the diagnostics you ran, including the ones that came back clean.
Three problems, three different fixes: heteroscedasticity invalidates the standard errors, case 31 has both the leverage and the influence to move the line, and a VIF of 6.51 means the two predictors are nearly the same variable. None of them is a reason to abandon the model, and all three change what the coefficients mean.
From §2.8 Regression Diagnostics and §2.13 Assumptions of Regression.
44A table from three lines of output
Exam-levelA sports scientist compares three warm-up routines on how far athletes can reach in a sit-and-reach test, eight athletes per routine. The paper reports only the descriptive statistics, so the ANOVA table has to be rebuilt from them.
- Static: n = 8, M = 12.0, SD = 3.2
- Dynamic: n = 8, M = 15.0, SD = 2.9
- Ballistic: n = 8, M = 18.0, SD = 3.5
- Find the grand mean, then SSG, SSE and SST.
- Fill in the three degrees of freedom and both mean squares.
- Compute F and decide at α = .05 against the critical value 3.47.
- Report η² and the pooled standard deviation.
Worked solution
- Grand mean Equal group sizes, so it is the mean of the three means x̄ = (12.0 + 15.0 + 18.0) / 3 = 15.0 cm With unequal group sizes this shortcut fails and the grand mean has to be the weighted average Σnᵢx̄ᵢ / N.
- Between groups SSG = Σ nᵢ(x̄ᵢ − x̄)² = 8(12 − 15)² + 8(15 − 15)² + 8(18 − 15)² = 8(9) + 8(0) + 8(9) = 144.00
- Within groups, from the SDs SSE = Σ (nᵢ − 1)sᵢ² = 7(3.2² + 2.9² + 3.5²) = 7(10.24 + 8.41 + 12.25) = 7(30.90) = 216.30 Use this form whenever a question gives you standard deviations instead of raw scores. It works because each sᵢ² is the group's sum of squares divided by nᵢ − 1, so multiplying by nᵢ − 1 undoes the division.
- Total, and the check SST = 144.00 + 216.30 = 360.30 Without the raw scores, SST can only come from this sum. When you do have the raw scores, compute all three separately and check that they add up; it is the quickest error check there is.
- Degrees of freedom and mean squares dfG = I − 1 = 2 dfE = N − I = 24 − 3 = 21 dfT = 23 MSG = 144.00 / 2 = 72.00 MSE = 216.30 / 21 = 10.30
- The F ratio F = 72.00 / 10.30 = 6.99 on (2, 21) 6.99 > 3.47, so reject H₀ at α = .05 (exact p = .005)
- Effect size and pooled SD η² = 144.00 / 360.30 = .40 sp = √10.30 = 3.21 cm These two numbers do different jobs. η² says the routine accounts for about 40% of the variation in reach. sp is the error term any follow-up comparison between two routines will use. It is close to the individual group SDs, as it should be, since the ANOVA assumes all three estimate the same population SD.
SSG = 144.00 on 2 df, SSE = 216.30 on 21, SST = 360.30 on 23. MSG = 72.00, MSE = 10.30, F(2, 21) = 6.99, p = .005. Warm-up routine affected reach, η² = .40, sp = 3.21 cm.
From §2.2 One-Way ANOVA. Check it in Build the ANOVA Table or in the APA formatter.
45The table with four cells missing
Warm-upA printout has been photocopied badly and four cells of the ANOVA table are unreadable. Forty participants were assigned to four versions of an instruction leaflet, and the outcome is a comprehension score.
- Between groups: SS = ?, df = 3, MS = ?
- Within groups: SS = 216.00, df = ?, MS = ?
- Total: SS = 396.00, df = 39
- Recover the four missing cells and the F ratio.
- Decide at α = .05 against the critical value F*(3, 36) = 2.87.
- Report η² and the pooled standard deviation.
Worked solution
- The two sums of squares SST = SSG + SSE, so SSG = 396.00 − 216.00 = 180.00 This is the partition identity: any two of the three sums of squares determine the third.
- The missing df dfT = dfG + dfE, so dfE = 39 − 3 = 36 Read the design back out of the df while you are here: dfG = I − 1 = 3 means four groups, and dfT = N − 1 = 39 means forty participants. Both match the scenario, so the table is consistent with the design.
- Mean squares MSG = 180.00 / 3 = 60.00 MSE = 216.00 / 36 = 6.00
- The F ratio and the decision F = 60.00 / 6.00 = 10.00 on (3, 36) 10.00 > 2.87, so reject H₀ (exact p = .00006) A common slip is to divide the sums of squares instead: 180.00 / 216.00 = 0.83, which would have said the opposite. F is a ratio of mean squares, so each sum of squares must first be divided by its own df.
- Effect size and pooled SD η² = 180.00 / 396.00 = .45 sp = √6.00 = 2.45 The leaflet version accounts for about 45% of the variation in comprehension. The table cannot say which versions differ. The follow-up comparisons that answer that question will use the pooled SD.
SSG = 180.00, dfE = 36, MSG = 60.00, MSE = 6.00, F(3, 36) = 10.00, p < .001. Reject H₀: the four leaflets are not equally well understood, η² = .45, sp = 2.45.
From §2.2 One-Way ANOVA. The exam mode of Build the ANOVA Table generates more of these.
46One question, asked before the data
Exam-levelAn occupational health team tests whether any kind of scheduled break improves afternoon proofreading accuracy. Forty office workers are assigned to four conditions, ten each: no break at all, three two-minute micro-breaks, one fifteen-minute break, and one fifteen-minute break spent walking outdoors. The team wrote one question into its protocol before collecting anything: does taking a break of any kind beat taking none? The outcome is the percentage of planted errors caught.
- No break: M = 52.0, SD = 6.0
- Micro-breaks: M = 58.0, SD = 5.0
- Long break: M = 61.0, SD = 7.0
- Walk outdoors: M = 65.0, SD = 6.0
Critical values: F*(3, 36) = 2.87, t*(36) = 2.028.
- Build SSE, dfE and MSE from the standard deviations, then run the omnibus F.
- Write the coefficients for the team's planned question and check that they qualify as a contrast.
- Compute the estimate, its standard error and the t, and decide at α = .05.
- Give the 95% confidence interval and say what it means in percentage points.
- Redo the contrast with whole-number coefficients and say what changes.
Worked solution
- The error term, from the SDs SSE = Σ (nᵢ − 1)sᵢ² = 9(6.0² + 5.0² + 7.0² + 6.0²) = 9(36 + 25 + 49 + 36) = 9(146) = 1314.00 dfE = N − I = 40 − 4 = 36, MSE = 1314.00 / 36 = 36.50 Everything after this uses MSE. The contrast needs this number from the ANOVA table, so build the table even when the question is not about all four groups.
- The omnibus F, for the record x̄ = (52 + 58 + 61 + 65) / 4 = 59.00 SSG = 10[(−7)² + (−1)² + 2² + 6²] = 10(49 + 1 + 4 + 36) = 900.00 MSG = 900.00 / 3 = 300.00, F = 300.00 / 36.50 = 8.22 on (3, 36) 8.22 > 2.87, so reject H₀ (exact p = .00027), η² = 900 / 2214 = .41 Because the groups are equal in size, the grand mean is the plain average of the four means. A planned contrast does not need this test to be significant, since it was not chosen by looking at the means. Reporting the omnibus still takes only one line, and it tells the reader the conditions differed overall.
- The coefficients a = [1, −⅓, −⅓, −⅓] Σaᵢ = 1 − ⅓ − ⅓ − ⅓ = 0 ✓ One group on one side, the other three averaged on the other. Coefficients of [1, −1, −1, −1] would sum to −2 and would not be a contrast at all: the three treatment weights have to share the −1 between them, not each take it.
- Estimate and standard error ψ̂ = 52.00 − (58.00 + 61.00 + 65.00)/3 = 52.00 − 61.33 = −9.33 Σ aᵢ²/nᵢ = (1 + ⅑ + ⅑ + ⅑) / 10 = (4/3) / 10 = .1333 SE = √(36.50 × .1333) = √4.8667 = 2.21
- The test t = −9.33 / 2.21 = −4.23 on df = N − I = 36 |−4.23| > 2.028, so reject H₀ (exact two-tailed p = .00015) The direction was in the protocol, so a one-tailed test at .05 would have been legitimate here and would halve that p to .000077. It changes nothing about this decision, and the write-up has to say the direction was planned.
- The interval −9.33 ± 2.028 × 2.21 = −9.33 ± 4.47 95% CI [−13.81, −4.86] percentage points In words: workers given no break caught somewhere between about 5 and 14 percentage points fewer of the planted errors than the average of the three break conditions. The t says only that the difference is not zero; the interval says how big it is.
- The same contrast, in whole numbers a = [3, −1, −1, −1]: ψ̂ = 156.00 − 184.00 = −28.00 Σ aᵢ²/nᵢ = (9 + 1 + 1 + 1)/10 = 1.20, SE = √(36.50 × 1.20) = 6.62 t = −28.00 / 6.62 = −4.23, unchanged. CI [−41.42, −14.58] Everything scaled by three: the estimate, the standard error and both interval limits. The t is a ratio of two of them, so it does not change. Type the whole numbers into SPSS and report the fractional version, or divide the output by three yourself.
MSE = 36.50 on 36 df; F(3, 36) = 8.22, p < .001, η² = .41. The planned contrast of no break against the average of the three break conditions gives ψ̂ = −9.33, SE = 2.21, t(36) = −4.23, p < .001, 95% CI [−13.81, −4.86]. Any break beats none, by roughly 5 to 14 percentage points.
From §2.3 Post-Hoc Tests. Type the coefficients into Contrast Builder to check every line of it.
47Three formats and three comparisons
Exam-levelSeventy-five students are randomly assigned to one of three revision formats for the same material, twenty-five per format, and sit a common exam. No comparisons were specified in advance, so all three pairs are compared afterwards. The ANOVA has already been run.
- Format A (rereading): M = 64.0; Format B (summarizing): M = 70.0; Format C (self-testing): M = 72.0
- Between groups: SS = 866.67, df = 2, MS = 433.33
- Within groups: SS = 7200.00, df = 72, MS = 100.00
- Critical values: F*(2, 72) = 3.12, t*(72) = 1.993, t**(72) at .05/3 two-sided = 2.451
- Confirm the omnibus decision, and give sp and the standard error every pair will share.
- Compute all three pairwise t statistics on the pooled error term.
- Decide each one twice, uncorrected and Bonferroni-corrected, and say which comparison loses significance under the correction.
- Write the results sentence in APA style, naming the correction.
Worked solution
- The omnibus, and the shared standard error F = 433.33 / 100.00 = 4.33 on (2, 72); 4.33 > 3.12, so reject H₀ (exact p = .017) sp = √MSE = √100.00 = 10.00 SE = 10.00 × √(1/25 + 1/25) = 10.00 × √.08 = 2.83 Equal group sizes mean one standard error covers all three pairs. With unequal n each pair would get its own, and only sp would be shared. η² = 866.67 / 8066.67 = .11, a modest effect; report it in the write-up.
- Three t statistics A vs. B: t = (64.0 − 70.0) / 2.83 = −2.12 A vs. C: t = (64.0 − 72.0) / 2.83 = −2.83 B vs. C: t = (70.0 − 72.0) / 2.83 = −0.71 All three on df = N − I = 75 − 3 = 72 Every one of these uses 72 degrees of freedom, because the error term is pooled from all three groups. Two groups of 25 on their own would give 48.
- Two verdicts each Uncorrected, against t* = 1.993: A vs. B reject, A vs. C reject, B vs. C keep Bonferroni, against t** = 2.451: A vs. B keep, A vs. C reject, B vs. C keep Exact p-values: .037, .006 and .482 The correction loses the A-versus-B comparison, whose t of 2.12 is between the two critical values. The other convention gives the same decisions: multiply each p by 3 to get .112, .018 and 1.000 (a product above 1 is capped at 1), then compare them with .05. SPSS uses this second convention.
- The write-up Revision format affected exam scores, F(2, 72) = 4.33, p = .017, η² = .11. With Bonferroni-corrected pairwise comparisons on the pooled error term, self-testing outperformed rereading, Mdiff = 8.00, t(72) = 2.83, p = .018 corrected. Neither the rereading-versus-summarizing difference of 6.00 points, t(72) = 2.12, p = .112 corrected, nor the summarizing-versus-self-testing difference of 2.00 points, t(72) = 0.71, p = 1.000 corrected, reached significance. Two details reviewers look for. The sentence names Bonferroni, because a p-value from a family of comparisons cannot be interpreted without knowing the correction. And the corrected p-values are labeled as corrected, so the reader does not have to guess whether .018 was already multiplied by three.
sp = 10.00, shared SE = 2.83 on 72 df. t = −2.12, −2.83 and −0.71 for A vs. B, A vs. C and B vs. C. Uncorrected, the first two are significant; under Bonferroni only A vs. C survives, since 2.12 falls between t* = 1.993 and t** = 2.451. Corrected p-values .112, .018 and 1.000.
From §2.3 Post-Hoc Tests. The All pairs panel of Contrast Builder lays out both verdicts side by side, and the APA formatter handles the omnibus sentence.
48Two reading apps, fifteen children
Exam-levelFifteen children are randomly assigned to learn spelling either from a paper workbook or from a tablet app, and are scored a fortnight later on words recalled. The scores are bounded below, badly skewed, and there are seven children in one group and eight in the other, so the class is told to run a Mann–Whitney U test by hand against the printed table.
- Workbook (n1 = 7): 12, 15, 17, 20, 23, 26, 31
- App (n2 = 8): 18, 22, 25, 28, 30, 33, 36, 40
- Critical values: U*(7, 8) = 10 two-tailed at .05, 6 two-tailed at .01, 13 one-tailed at .05
- Rank the fifteen scores as one pooled set and give both rank sums, with the check that they are right.
- Compute U1 and U2, and say which of them is the test statistic.
- Decide the test at two-tailed α = .05.
- The researcher now says the app was predicted to win from the start. Does the decision change, and is she entitled to make it?
Worked solution
- Pool, rank, and total Sorted: 12, 15, 17, 18, 20, 22, 23, 25, 26, 28, 30, 31, 33, 36, 40 Workbook ranks: 1, 2, 3, 5, 7, 9, 12 → R1 = 39 App ranks: 4, 6, 8, 10, 11, 13, 14, 15 → R2 = 81 Check: 39 + 81 = 120 = N(N + 1)/2 = 15 × 16 / 2 Rank the pooled set, not each group separately. There are no ties here, so every rank is a whole number; tied values would each get the average of the ranks they occupy. The check on the two sums takes thirty seconds, and a misranked value is the most common way this question goes wrong.
- Both U values U1 = n1n2 + n1(n1 + 1)/2 − R1 = 56 + 28 − 39 = 45 U2 = n1n2 + n2(n2 + 1)/2 − R2 = 56 + 36 − 81 = 11 Check: 45 + 11 = 56 = n1n2 The statistic is U = 11, the smaller of the two Working out the second from its own rank sum, not by subtracting from 56, takes one more line and checks the ranking again. The smaller U belongs to the app, the group higher in the pooled order.
- The table, which runs the other way U = 11 against U*(7, 8) = 10 at two-tailed .05 11 > 10, so keep H₀ A U table prints a maximum. U counts how much the two groups overlap, so it shrinks as they separate, and only a value at or below the table entry is significant. Eleven misses by one. The exact two-tailed p is .054, which agrees and shows how close this was.
- One tail, and who is allowed to use it One-tailed at .05: U*(7, 8) = 13, and 11 ≤ 13, so reject H₀ Exact one-tailed p = .027 The arithmetic is not in question; the timing is. If the direction was stated before the data arrived, this is a legitimate one-tailed test and the result rejects. If it was chosen after seeing that the app came out ahead, the result is still the two-tailed .054 under a new label, and a marker will treat it that way. If your table prints only two-tailed columns, double the α before you look: a one-tailed test at .05 uses the .10 column, because a two-tailed α is split equally between the two tails.
R1 = 39 and R2 = 81, summing to 120. U1 = 45, U2 = 11, so U = 11. Against U* = 10 at two-tailed .05 the null survives, exact p = .054. A one-tailed test predicted in advance would reject against U* = 13, exact p = .027, but only if the direction was stated first.
From §2.1 Non-Parametric Alternatives. The Mann–Whitney tab of the rank ledger prints the same arithmetic for its own data, and Table U is the table this problem reads.
49Nine sleepers, one of whom did not budge
Exam-levelNine adults rate their sleep quality on a 50-point clinical scale before and after four weeks with a wind-down routine. Higher is better. The ratings are ordinal and the sample is small, so the analysis is a Wilcoxon signed-ranks test done by hand.
- Before: 24, 31, 19, 27, 22, 35, 28, 30, 21
- After: 29, 39, 19, 38, 25, 34, 35, 44, 23
- Critical values: W*(8) = 3 two-tailed at .05 and 0 two-tailed at .01; W*(9) = 5 two-tailed at .05
- Form the nine differences and say how many pairs actually enter the test.
- Rank the surviving differences by absolute size and give T+ and T−, with the check.
- Decide the test at two-tailed α = .05 and again at .01.
- A classmate keeps the unchanged participant, arguing that discarding data is never right. What does that do to the test?
Worked solution
- Differences, and one that is not a difference after − before: +5, +8, 0, +11, +3, −1, +7, +14, +2 The third participant scored 19 both times, so that pair is dropped n = 8 A pair with a difference of exactly zero has no direction, and the test works by attaching a sign to each rank. With no sign to give it, the pair is dropped, and n becomes the number of pairs left. This is the step most often skipped, and it changes both the ranking and the row of the table you read.
- Rank the sizes, then sort by sign |d| sorted: 1, 2, 3, 5, 7, 8, 11, 14 → ranks 1 to 8 +5 → 4, +8 → 6, +11 → 7, +3 → 3, −1 → 1, +7 → 5, +14 → 8, +2 → 2 T+ = 4 + 6 + 7 + 3 + 5 + 8 + 2 = 35 T− = 1 Check: 35 + 1 = 36 = n(n + 1)/2 = 8 × 9 / 2 Rank the absolute sizes, ignoring sign, and only then look back at which sign each rank came from. The one person who got worse moved least, so the negative side gets a single rank of 1. Had two differences tied in size they would share the average of their two ranks, and the sums would still have to reach 36.
- Both decisions W = min(35, 1) = 1 At .05: 1 ≤ 3, so reject H₀ At .01: 1 > 0, so keep H₀ Exact two-tailed p = .016 Like U, W is compared with a maximum, for the same reason: it adds up the ranks on the smaller side, so it shrinks as the pairs agree in direction. The .01 cell of 0 means that with only eight pairs, every person must move the same way before the test can reject at that level. The exact p of .016 is between .01 and .05, which matches the two decisions.
- Keeping the zero Two things go wrong. The unchanged participant has to be given a signed rank, and there is no sign to give, so whichever side gets it is made up. And n becomes 9, which sends you to a different row of the table, where the cell is 5, not 3. Here the verdict happens to survive both errors, but the procedure was still wrong. Dropping the pair loses nothing, because this participant tells you nothing about direction, and the smaller n reflects that.
One zero difference is dropped, so n = 8. T+ = 35 and T− = 1, summing to 36. W = 1, which rejects at two-tailed .05 against W* = 3 but not at .01 against W* = 0. Exact two-tailed p = .016.
From §2.1 Non-Parametric Alternatives. The Wilcoxon tab of the rank ledger shows the same ledger for its own seven pairs, and Table W holds both cells.
50Exercise and wellbeing, right on the critical value
Exam-levelEight adults report their typical daily exercise in minutes and complete a wellbeing questionnaire. Exercise minutes are heavily skewed by two people who train far more than the rest, so the relationship is described with Spearman's ρs rather than Pearson's r.
- Exercise (min/day): 10, 15, 20, 25, 30, 40, 50, 65
- Wellbeing: 52, 41, 44, 47, 63, 55, 70, 58
- Critical values: ρs*(8) = .738 two-tailed at .05, .881 two-tailed at .01, .643 one-tailed at .05
- Rank both columns, build the d and d² columns, and give Σd².
- Compute ρs from the shortcut.
- Decide at two-tailed α = .05 and at .01, and say carefully why the first decision goes the way it does.
- Two of the wellbeing scores turn out to have been transcribed wrongly and are in fact equal. What has to change?
Worked solution
- Two columns of ranks Exercise is already in order, so rank x = 1, 2, 3, 4, 5, 6, 7, 8 Wellbeing sorted: 41, 44, 47, 52, 55, 58, 63, 70 rank y in the original order = 4, 1, 2, 3, 7, 5, 8, 6 d = −3, 1, 1, 1, −2, 1, −1, 2 d² = 9, 1, 1, 1, 4, 1, 1, 4 → Σd² = 22 Rank the two columns separately, then subtract row by row. The signs of d do not matter once you square, but write them down anyway: they must sum to zero, so a misranked row shows up before it reaches the formula.
- The shortcut ρs = 1 − 6Σd² / (n(n² − 1)) = 1 − 6(22) / (8 × 63) = 1 − 132 / 504 = 1 − .2619 = .738 Pearson's r on the raw numbers would give .656. The two heavy exercisers stretch the x axis and flatten the linear fit, while the ranks treat them simply as the sixth, seventh and eighth largest. That gap is the reason for choosing ρs here; mention it in the write-up.
- Two decisions, and one boundary At two-tailed .05: .738 against a cell of .738 The rule is reject when |ρs| REACHES the critical value, so reject H₀ At two-tailed .01: .738 < .881, so keep H₀ Exact two-tailed p = .046 A discrete statistic can equal a table entry exactly, and here it does. Σd² = 22 is the value that defines the .05 cell for n = 8, and the exact two-tailed probability of a result this extreme is .046, under .05. A strict inequality would wrongly call this result non-significant. Unlike U and W, ρs is compared with a minimum, because it is a correlation and grows with the strength of the relationship.
- What a tie changes The two tied scores each get the average of the two ranks they occupy, so the y column is no longer the whole numbers 1 to 8. The shortcut assumes both columns are exactly those whole numbers, so it is no longer exact. Instead, run Pearson's formula on the two rank columns. That is the definition of Spearman's ρs, and it is what SPSS and JASP compute whether or not there are ties. With one tied pair in eight the error is small, but "small" is not a number you can quote.
Σd² = 22, so ρs = 1 − 132/504 = .738. That reaches the two-tailed .05 cell of .738 exactly, so the null is rejected (exact p = .046), but it falls short of the .01 cell of .881. Ties would break the shortcut and force Pearson's formula on the ranks.
From §2.1 Non-Parametric Alternatives and §1.17 Correlation. The Spearman tab of the rank ledger builds the same d² column live, and Table ρ holds both cells.
51Four cells, and everything that falls out of them
Exam-levelForty students are each given the same two-hour assignment and randomly assigned to one of four conditions: they work either in a quiet reading room or in a busy café, and their phone is either left in another room or sitting on the desk. The outcome is the number of minutes of focused work recorded by a timer that stops when they switch away from the document. Ten students are in each cell.
- Quiet room, phone in another room: 84 · quiet room, phone on the desk: 64
- Busy café, phone in another room: 62 · busy café, phone on the desk: 58
- Call the place factor A (A₁ quiet, A₂ café) and the phone factor B (B₁ away, B₂ on the desk)
- Lay the four means out as a 2 × 2 and fill in both row margins, both column margins and the grand mean.
- Give the main effect of each factor, and check each one against its own two simple main effects.
- Give all four simple main effects and the difference of differences. Is the interaction spreading or crossover?
- Describe the interaction plot with A on the horizontal axis and one line per level of B.
- A colleague summarizes the study as "leaving your phone in another room buys you twelve minutes". Say what is right and what is misleading about that.
Worked solution
- The square, with its margins Row A₁: 84 and 64 → margin (84 + 64)/2 = 74 Row A₂: 62 and 58 → margin (62 + 58)/2 = 60 Column B₁: 84 and 62 → margin (84 + 62)/2 = 73 Column B₂: 64 and 58 → margin (64 + 58)/2 = 61 Grand mean = (84 + 64 + 62 + 58)/4 = 268/4 = 67 Two arithmetic checks come free. The two row margins average to the grand mean, (74 + 60)/2 = 67, and so do the two column margins, (73 + 61)/2 = 67. Both hold only because every cell has ten students; with unequal cells a margin is a weighted average and these identities no longer hold.
- Two main effects Main effect of A = 60 − 74 = −14 minutes (the café costs 14) Main effect of B = 73 − 61 = +12 minutes (the phone away buys 12) Each is a statement about an average over the other factor. The café figure averages over the two phone conditions; the phone figure averages over the two places.
- Four simple main effects, and their difference A at B₁: 62 − 84 = −22 A at B₂: 58 − 64 = −6 Mean of the two: (−22 + −6)/2 = −14, which is the main effect of A B at A₁: 84 − 64 = +20 B at A₂: 62 − 58 = +4 Mean of the two: (20 + 4)/2 = +12, which is the main effect of B Difference of differences = −6 − (−22) = +16 Difference the other factor first and you get 4 − 20 = −16, the same size with the other sign. There is only one interaction here, and its sign depends on which factor you subtract first. Both simple main effects of A point the same way and both simple main effects of B point the same way, so this is a spreading interaction rather than a crossover: the phone matters in both places, five times as much in the quiet room.
- The picture Two points on the left at A₁, 84 for B₁ and 64 for B₂; two on the right at A₂, 62 and 58. The B₁ line falls steeply from 84 to 62; the B₂ line drops gently from 64 to 58. The B₁ line stays above the B₂ line across the whole plot, so the lines do not cross inside the range, and their different slopes are the interaction. A 20-minute gap on the left has narrowed to a 4-minute gap on the right.
- What the summary gets wrong Twelve minutes is the correct main effect of B, so the number is right. The misleading part is the implied "wherever you work". Moving the phone away added 20 minutes in the quiet room and 4 in the café, and 12 is the average of those two numbers, neither of which is 12. With an interaction this large, report the interaction first and then the two simple main effects: leaving the phone in another room helped in both settings, a lot in the quiet room and barely in the café.
Margins 74 and 60 down the rows, 73 and 61 across the columns, grand mean 67. Main effects −14 for place and +12 for the phone. Simple main effects −22 and −6 for place, +20 and +4 for the phone, each pair averaging to its own main effect; the difference of differences is 16, a spreading interaction. The twelve-minute claim is the correct average but hides the interaction.
From §2.4 Factorial ANOVA. Type the four cell means into the Interaction Plot Explorer and every number above is printed for you.
52The two-way table with four cells missing
Exam-levelStudents take notes on the same lecture either on a laptop or in longhand, and are quizzed either the same day, one week later or three weeks later. Every one of the six conditions holds the same number of students. The output below arrived with four cells missing.
- Medium (A): SS = 96.00, df = 1, MS = 96.00, F = ?
- Delay (B): SS = 150.00, df = 2, MS = ?, F = ?
- A × B: SS = 88.00, df = 2, MS = 44.00, F = ?
- Error: SS = ?, df = ?, MS = ?
- Total: SS = 838.00, df = 47
- Critical values: F*(1, 42) = 4.07 and F*(2, 42) = 3.22, both at α = .05
- How many levels does each factor have, how many students were there in total, and how many were in each cell? Answer from the degrees of freedom alone.
- Complete the error row and the three F ratios.
- Decide each of the three tests at α = .05, and give partial η² for the interaction.
- Which line do you report first, and what does that decision do to the two sentences about the main effects?
Worked solution
- Reading the design off the df column dfA = I − 1 = 1 → I = 2 levels of medium dfB = J − 1 = 2 → J = 3 delays, and (I − 1)(J − 1) = 2 checks out dfT = N − 1 = 47 → N = 48 students IJ = 6 cells, so n = 48/6 = 8 per cell The df column of a two-way table records the design, so an exam can give you only the table and still ask for the sample size. It works the other way too: report F(2, 42) in a paper and a reader can work out three levels and 48 people.
- The error row, then the ratios SSE = SST − SSA − SSB − SSAB = 838 − 96 − 150 − 88 = 504.00 dfE = N − IJ = 48 − 6 = 42, and 1 + 2 + 2 + 42 = 47 as it must MSE = 504/42 = 12.00 MSB = 150/2 = 75.00 FA = 96/12 = 8.00 FB = 75/12 = 6.25 FAB = 44/12 = 3.67 All three F ratios divide by the same MSE, so the error row has to be recovered first. Its square root, sp = √12 = 3.46 points, is the residual spread; quote it beside the means.
- Three decisions and an effect size Medium: 8.00 > 4.07, so reject (exact p = .007) Delay: 6.25 > 3.22, so reject (exact p = .004) A × B: 3.67 > 3.22, so reject (exact p = .034) ηp² for the interaction = 88 / (88 + 504) = 88/592 = .149 Partial η² divides each effect by itself plus the error, not by the total, so the three values here (.160, .229 and .149) are not shares of one total and do not add up to anything meaningful. The interaction is the smallest of the three and still clears its critical value, because 42 error degrees of freedom give a precise estimate of the error.
- The reading order Report the interaction line first, because it is significant and it limits what the two lines above it can say. The medium effect (F = 8.00) and the delay effect (F = 6.25) are both significant, but each is an average over the other factor, and a significant A × B says the medium's advantage is not the same at every delay. Lead the write-up with the interaction, report each main effect as qualified by it, and then test the simple main effects: the medium's effect at each of the three delays, or the delay's effect within each medium. Reporting the main effects first and the interaction as an afterthought gets the order backwards.
Two levels of medium, three delays, 48 students, 8 per cell. SSE = 504.00 on 42 df, MSE = 12.00; MSB = 75.00; F(1, 42) = 8.00, F(2, 42) = 6.25 and F(2, 42) = 3.67, all three significant at .05, with ηp² = .149 for the interaction. Report the interaction first and treat both main effects as qualified by it.
From §2.4 Factorial ANOVA and §2.2 One-Way ANOVA. The printed F tables hold both criticals, and Where the Variance Goes shows what the error row would have swallowed had the delay factor been left out.
53Ten raters, four layouts, one missing row
Exam-levelTen people each rate the same four website layouts for ease of use, so every person contributes four scores. The analysis was run and then most of the table was lost. What survived is below.
- n = 10 participants, k = 4 layouts
- SSconditions = 240.00
- SSsubjects = 900.00
- SStotal = 1500.00
- Critical value: F*(3, 27) = 2.96 at α = .05
- Write down every row's degrees of freedom from n and k alone, and check that they add up.
- Complete the table: the error sum of squares, the mean squares and the F ratio.
- Decide the test at α = .05 and report partial η².
- The same forty scores analyzed as a one-way between-subjects ANOVA give F(3, 36) = 2.29 against a critical value of 2.87. Using your table, say exactly where that difference came from.
Worked solution
- The degrees of freedom, before any arithmetic dfsubjects = n − 1 = 9 dfconditions = k − 1 = 3 dferror = (n − 1)(k − 1) = 9 × 3 = 27 dftotal = nk − 1 = 40 − 1 = 39, and 9 + 3 + 27 = 39 ✓ The error df is a product, not a subtraction, and this is where a repeated-measures table differs from the other ANOVA tables you fill in. It is a product because the error is the person-by-condition interaction, and an interaction's df is always the product of its two factors' df.
- The missing sum of squares, then the rest SSerror = SStotal − SSconditions − SSsubjects = 1500 − 240 − 900 = 360.00 MSsubjects = 900/9 = 100.00 MSconditions = 240/3 = 80.00 MSerror = 360/27 = 13.33 F = MSconditions/MSerror = 80/13.33 = 6.00 Write out the within-subjects block as a check: SS = 240 + 360 = 600 on n(k − 1) = 30 df, and 900 + 600 = 1500 on 9 + 30 = 39. The subjects row gets a mean square but no F. Its F would test whether people differ from each other, which is not the question.
- The decision and the effect size 6.00 > 2.96, so reject H0 (exact p = .003) ηp² = SSconditions / (SSconditions + SSerror) = 240 / (240 + 360) = 240/600 = .40 Partial η² leaves the subjects row out of its denominator, so it can look large in a within-subjects study. It is 40% of the variation left after individual differences are removed, not 40% of the total variation, which would be 240/1500 = .16. Report which one you computed, because here the two differ by a factor of two and a half.
- Where the between-subjects analysis lost it Between-subjects error = 900 + 360 = 1260 on 36 df MS = 1260/36 = 35.00, and F = 80/35 = 2.29 The difference comes entirely from the 900. A between-subjects analysis does not know that the same ten people produced all forty ratings, so the variation between those people goes into the error term. There it raises the error sum of squares from 360 to 1260 and the mean square from 13.33 to 35.00. The repeated-measures analysis separates out the 900 and tests the same 240 against what is left. Both analyses use the same data, but only one matches the design that produced it. Analyzing a within-subjects study as if it were between-subjects is a common way to lose a real effect.
df 9, 3, 27 and 39. SSerror = 360.00, MS = 100.00, 80.00 and 13.33, and F(3, 27) = 6.00, which beats 2.96, so the layouts differ (p = .003, ηp² = .40). The between-subjects version fails because it leaves the 900 points of between-person variation in its error term.
From §2.5 Repeated Measures ANOVA. The printed F tables hold both criticals, and the widget in §2.5 draws the same two analyses as stacked bars.
54One output, two tables, and how many people
Exam-levelA sleep-hygiene course is compared against a waiting list. Everyone is assessed on a daytime-alertness scale at baseline, at four weeks and at twelve weeks. The output arrives as two tables and no method section.
- Group, in Tests of Between-Subjects Effects: F(1, 38) = 4.21, p = .047
- Time, in Tests of Within-Subjects Effects: F(2, 76) = 18.60, p < .001
- Group × Time, in the same table: F(2, 76) = 7.45, p = .001
- Mauchly's test was significant, with Greenhouse-Geisser ε = .82
- How many participants took part, how many were in each group, and how many times was each one measured? Work from the degrees of freedom alone.
- Why are the group effect and the time effect tested against different error terms, and which table holds which?
- Which line do you report first, and what does the main effect of time mean once you have?
- Apply the sphericity correction: which rows change, what do their degrees of freedom become, and does the interaction survive? Give partial η² for it.
Worked solution
- Reading the design out of the df Group df = g − 1 = 1 → g = 2 groups Between-subjects error df = N − g = 38 → N = 40 participants Within-subjects error df = (N − g)(k − 1) = 38(k − 1) = 76 → k = 3 occasions So 20 per group, 3 measurements each, 120 observations, and dftotal = 120 − 1 = 119 The trap is reading N = 40 as forty per group. In the between-subjects half of a mixed design, N counts participants and not observations, so its error df of 38 covers everyone in the study. Check the five source df add to 119: 1 + 38 + 2 + 2 + 76 = 119 ✓.
- Two questions, two kinds of noise A group difference is a difference between people, so it has to be compared with how much people differ from each other. That is the between-subjects error, on 38 df, and the group row is in the same table. A change over time happens within a person, so it is compared with how much the change across the three occasions varies from person to person: the person-by-time residual, on 76 df, in the within-subjects table. The interaction is also a within-person comparison (did the two groups change differently?), so it is tested against the same smaller error. One pooled error for all three would test the time effect against between-person variation that has nothing to do with it. A between-subjects analysis of a within-subjects study makes the same mistake.
- The reading order Group × Time first, at F(2, 76) = 7.45, p = .001. It is significant, and it answers the question the study was designed for: the two groups did not follow the same trajectory. That limits what the row above it can say. The main effect of time, F(2, 76) = 18.60, now means only that alertness changed when the two groups are averaged together, which may describe neither group: the course group could have improved a great deal and the waiting list not at all. The group main effect is the least informative line in any case, because it averages over all three occasions, including baseline, where random assignment means the groups should not differ. Follow the interaction with simple effects, the change over time within each group separately, and report those.
- The sphericity correction Only the within-subjects rows are corrected: Time and Group × Time df become (k − 1)ε = 2 × .82 = 1.64 and 76 × .82 = 62.32 Group × Time: F(1.64, 62.32) = 7.45, p = .002, still significant ηp² = F · df1 / (F · df1 + df2) = 14.90 / 90.90 = .16 The F ratio does not change, because the data have not changed. Both degrees of freedom are multiplied by ε, and the same ratio is compared with an F distribution on fewer degrees of freedom, so the p rose from .001 to .002. The between-subjects table is untouched, since sphericity concerns differences between conditions and that table has no conditions in it. Name the correction and print ε: fractional df tell a reader that something was corrected, but not by how much.
40 participants, 20 per group, measured 3 times, for 120 observations and 119 total df. Group is tested against the between-subjects error on 38 df and both within rows against the person-by-time error on 76 df. Report Group × Time first, F(1.64, 62.32) = 7.45, p = .002, ηp² = .16 after the Greenhouse-Geisser correction, and treat the time main effect as qualified by it.
From §2.5 Repeated Measures ANOVA and §1.5 Between vs Within Designs. The reading order is the one §2.4 sets out, and the APA formatter will typeset the corrected df for you.
📝 Exam-style · A midterm on §2.1–§2.5
Eight problems written the way an ANOVA exam asks them: a table to complete, a table to read backwards, a planned contrast, a corrected set of pairwise comparisons, a 2 × 2 design split into its margins and its interaction, a repeated-measures table whose design you recover from its degrees of freedom, and the two rank tests worked by hand against the printed tables. They span the first five sections of Stats 2, the usual coverage of a midterm taken with a calculator and a formula sheet. The set above teaches one idea per problem; this one chains them.
55The table with its SS column lost
Exam-levelA university language center trials five vocabulary apps on the same fifty-word recall test, with the same number of students on each app. The report it published prints the ANOVA table with the sums-of-squares column dropped in typesetting, and the method section never says how many students took part.
| Source | SS | df | MS | F |
|---|---|---|---|---|
| Between groups (app) | ? | 4 | 45.50 | 7.00 |
| Within groups (error) | ? | ? | 6.50 | |
| Total | 442.00 | 44 |
- How many apps were compared, how many students took part, and how many were on each app?
- Recover the three missing cells, and check them against the partition identity.
- Decide at α = .05 against the critical value F*(4, 40) = 2.61.
- Report η² and the pooled standard deviation.
Worked solution
- The design, read out of the df dfG = I − 1 = 4, so I = 5 apps dfT = N − 1 = 44, so N = 45 students 45 / 5 = 9 students per app The df column is enough to recover the design. With equal groups, dfG and dfT give the number of apps, the number of students and the group size. So an exam can give you a table with no method section and still expect a full answer.
- The missing df dfE = dfT − dfG = 44 − 4 = 40 The same answer comes from N − I = 45 − 5 = 40, so the two routes check each other.
- The SS column, from MS × df MS = SS / df, so SS = MS × df SSG = 45.50 × 4 = 182.00 SSE = 6.50 × 40 = 260.00 Most worked examples run the other way, so this step can feel unfamiliar. A mean square is a sum of squares divided by its df, so multiplying by the df gives the sum of squares back.
- Checking the partition SSG + SSE = 182.00 + 260.00 = 442.00 = SST ✓ The total was given and was not used to get either number, so this is an independent check. If the two recovered figures had not added to 442.00, one of the mean squares would have been misread.
- The F ratio and the decision F = MSG / MSE = 45.50 / 6.50 = 7.00 on (4, 40) 7.00 > 2.61, so reject H₀ at α = .05 (exact p = .0002) The F was printed, so recomputing it from the two mean squares is only a check.
- Effect size and pooled SD η² = SSG / SST = 182.00 / 442.00 = .41 sp = √MSE = √6.50 = 2.55 words Which app a student used accounts for about 41% of the variation in recall. Every follow-up comparison between two apps divides by the pooled SD. It is the square root of the error mean square, not of the error sum of squares.
Five apps, 45 students, 9 per app. dfE = 40, SSG = 182.00, SSE = 260.00, and the two add to the printed total of 442.00. F(4, 40) = 7.00, p < .001, so the apps are not equally effective, η² = .41, sp = 2.55 words.
Rounding: every cell here is exact. η² = 182/442 = .411765 rounds to .41, and sp = 2.5495 rounds to 2.55.
From §2.2 One-Way ANOVA. Build the forward version of this table in Build the ANOVA Table. The printed sheets carry z, t and χ² but no F, so get F*(4, 40) from the α-to-critical-value mode of the table calculator.
56Three stretches, then only two
Warm-upA physiotherapy clinic compares three stretching protocols on how much shoulder range of motion a patient gains over six weeks, ten patients on each protocol. Only the descriptive statistics were kept, so the table has to be rebuilt from them.
- Static holds: n = 10, M = 20.0, SD = 4.0
- Contract and relax: n = 10, M = 23.0, SD = 5.0
- Assisted range: n = 10, M = 26.0, SD = 5.0
- Build the full ANOVA table and test at α = .05 against F*(2, 27) = 3.35.
- Report η² and the pooled standard deviation.
- A reviewer asks what would have happened with only the first and third protocols. Run that comparison as an independent-samples t test.
- Run the same two groups through a one-way ANOVA and show that F = t². Check the two critical values obey the same rule.
Worked solution
- Grand mean and between-groups SS x̄ = (20 + 23 + 26) / 3 = 23.0 degrees SSG = Σ nᵢ(x̄ᵢ − x̄)² = 10(−3)² + 10(0)² + 10(3)² = 180.00 Equal group sizes make the grand mean the plain average of the three means. With unequal sizes it has to be the weighted average Σnᵢx̄ᵢ / N.
- Within-groups SS from the SDs SSE = Σ (nᵢ − 1)sᵢ² = 9(4.0² + 5.0² + 5.0²) = 9(16 + 25 + 25) = 9(66) = 594.00 SST = 180.00 + 594.00 = 774.00
- The table
4.09 > 3.35, so reject H₀ at α = .05 (exact p = .028)Source SS df MS F Between groups 180.00 2 90.00 4.09 Within groups 594.00 27 22.00 Total 774.00 29 - Effect size and pooled SD η² = 180.00 / 774.00 = .23 sp = √22.00 = 4.69 degrees
- The two-group t test sp² = [9(4.0²) + 9(5.0²)] / 18 = (144 + 225) / 18 = 20.50 SE = √20.50 × √(1/10 + 1/10) = 4.5277 × 0.4472 = 2.0248 t = (26.0 − 20.0) / 2.0248 = 2.963 on 18 df 2.963 > t*(18) = 2.101, so reject (two-tailed p = .008) The pooled variance here is 20.50, against 22.00 in the three-group table, because the middle protocol no longer contributes its own scatter to the error term.
- The same two groups as an ANOVA grand mean of the two = 23.0, so SSG = 10(−3)² + 10(3)² = 180.00 on 1 df SSE = 9(16 + 25) = 369.00 on 18 df, so MSE = 20.50 F = 180.00 / 20.50 = 8.780 on (1, 18) t² = 2.963² = 8.780 ✓ The error term of the two-group ANOVA is the pooled variance of the t test, so the identity is exact. It holds only with two groups: the three-group F of 4.09 is not the square of any t.
- The critical values obey it too t*(18) at two-tailed .05 = 2.1009 2.1009² = 4.4139 = F*(1, 18) at .05 ✓ Squaring folds the two tails of the t into the one upper tail of the F, so a two-tailed t at .05 and a one-tailed F at .05 are the same test. This is also why an F test has no direction to report.
F(2, 27) = 4.09, p = .028, η² = .23, sp = 4.69 degrees: the three protocols do not produce equal gains. On the first and third alone, t(18) = 2.96, p = .008, and the matching one-way analysis gives F(1, 18) = 8.78 = 2.96², with F*(1, 18) = 4.41 = 2.101² as the critical-value version of the same identity.
Rounding: MSE = 594/27 = 22.00 exactly, so F = 90/22 = 4.0909 and rounds to 4.09. Working to two decimals throughout leaves t² and F agreeing at 8.78.
From §2.2 One-Way ANOVA and §1.14 Independent Samples t Test. §2.2 works the identity through on a smaller pair of groups you can load straight into the widget: ?g=15,14,12,11;25,24,22,21.
57The control against the other three
Exam-levelA workplace trials a mindfulness program at three lengths against a waiting-list control, six employees in each of the four conditions. The outcome is a recovery score, where higher is better. Before any data were collected the team wrote down one comparison: control against the average of the three program lengths, predicted in that direction.
- Control: n = 6, M = 50.0
- Two weeks: n = 6, M = 56.0
- Four weeks: n = 6, M = 59.0
- Eight weeks: n = 6, M = 63.0
- The one-way ANOVA gave MSE = 24.00 on 20 df, F(3, 20) = 7.50, p = .001
- Write the contrast coefficients twice, once in whole numbers and once scaled to give an answer in recovery points, and check each row sums to zero.
- Compute ψ̂ and its standard error under both scalings.
- Compute t under both, and say why the two agree.
- Give the one-tailed p and a 95% confidence interval in recovery points.
Worked solution
- Two ways to write one contrast whole numbers: a = (−3, 1, 1, 1), sum = −3 + 3 = 0 ✓ scaled: a = (−1, ⅓, ⅓, ⅓), sum = −1 + 1 = 0 ✓ Both rows compare the control with the average of the other three. The whole-number row is the one to type into SPSS's Contrasts box; the scaled row gives an estimate in the units of the outcome.
- The estimate, whole-number row ψ̂ = Σ aᵢx̄ᵢ = −3(50) + 1(56) + 1(59) + 1(63) = −150 + 178 = 28.0 Σaᵢ² = 9 + 1 + 1 + 1 = 12 SE = sp√(Σaᵢ²/n) = √24.00 × √(12/6) = 4.899 × 1.414 = 6.928
- The estimate, scaled row ψ̂ = (56 + 59 + 63)/3 − 50 = 59.333 − 50 = 9.333 points Σaᵢ² = 1 + 3(1/9) = 1.3333 SE = 4.899 × √(1.3333/6) = 4.899 × 0.4714 = 2.309 points Report this number: on average, the program groups score 9.3 recovery points above the control. The whole-number version, 28.0, is three times as large and has no natural unit.
- The test, computed twice whole numbers: t = 28.0 / 6.928 = 4.041 on 20 df scaled: t = 9.333 / 2.309 = 4.041 on 20 df Multiplying every coefficient by 3 multiplies ψ̂ by 3 and Σaᵢ² by 9, so the standard error, which takes a square root, is also multiplied by 3. The ratio stays the same. Scaling a contrast changes the units of the estimate but never the test.
- One-tailed p t = 4.041 on 20 df, upper tail: p = .0003 One tail is allowed here only because the direction was written down before the data were collected. On paper, Table D on 20 df puts 4.041 past the .0005 column, so p < .0005. The exact value is .00032.
- The interval, in recovery points t*(20) at two-tailed .05 = 2.086 9.333 ± 2.086 × 2.309 = 9.333 ± 4.817 95% CI [4.52, 14.15] points Build the interval on the scaled row, so that it is in recovery points. It excludes zero, in agreement with the t test, and it also gives a range for the size of the advantage: as small as four and a half points or as large as fourteen.
ψ̂ = 9.33 recovery points, SE = 2.31, t(20) = 4.04, one-tailed p = .0003, 95% CI [4.52, 14.15]. On the whole-number coefficients ψ̂ = 28.0 with SE = 6.93 and the same t = 4.04. The program groups recover better than the control.
Rounding: sp = √24 = 4.8990, and carrying only 4.90 gives t = 4.040 rather than 4.041. Round at the end, not at the standard error.
From §2.3 Post-Hoc Tests. The Contrast Builder opens with the mirror image of this row, so ?c=-3,1,1,1 reverses its signs and leaves |t| unchanged. Read t*(20) off Table D in the printed tables.
58Three fonts, three comparisons
Exam-levelA publisher tests three typefaces on reading speed, eight readers per typeface, and measures words per minute on a matched passage. The omnibus test has already been run and rejected. No pairs were specified in advance, so all three are compared.
- Serif: n = 8, M = 45.0 wpm
- Sans serif: n = 8, M = 52.0 wpm
- Slab: n = 8, M = 58.0 wpm
- F(2, 21) = 12.10, p < .001, MSE = 28.00
- Find sp and the standard error of any pairwise difference.
- Compute all three pairwise t values on the pooled error term.
- Give the uncorrected critical value and the Bonferroni critical value, and say which comparisons survive each.
- Report the adjusted p-values, a simultaneous interval for the largest difference, and the APA sentence.
Worked solution
- The pooled standard deviation sp = √MSE = √28.00 = 5.292 wpm SE = sp√(1/nᵢ + 1/nⱼ) = 5.292 × √(1/8 + 1/8) = 5.292 × 0.5 = 2.646 With equal group sizes, one standard error serves all three pairs. The pooled error term also gives 21 df, against 14 for a separate t test on each pair, because every group contributes to the estimate of the common scatter.
- The three t values serif vs sans: t = (52 − 45) / 2.646 = 7 / 2.646 = 2.646 serif vs slab: t = (58 − 45) / 2.646 = 13 / 2.646 = 4.914 sans vs slab: t = (58 − 52) / 2.646 = 6 / 2.646 = 2.268 All three share a denominator, so the t values are in the same order as the differences.
- Two critical values uncorrected: t*(21) at two-tailed .05 = 2.080 Bonferroni with m = 3: α/m = .05/3 = .0167 t**(21) at two-tailed .0167 = 2.601 The correction is applied to α, not to the t values, and the divisor is the number of comparisons, not the number of groups. Three groups give three pairs, but four groups would give six.
- Which comparisons survive each
One comparison changes its verdict: sans against slab, the weakest of the three. Serif against sans survives narrowly, 2.646 against 2.601. A correction does not remove borderline results. It raises the threshold, and some comparisons can still be just above or just below the new one.Comparison Difference t(21) vs 2.080 vs 2.601 Serif vs sans 7.0 2.646 significant significant Serif vs slab 13.0 4.914 significant significant Sans vs slab 6.0 2.268 significant not significant - Adjusted p-values serif vs sans: p = .0151, × 3 = .045 serif vs slab: p = .00007, × 3 = .0002 sans vs slab: p = .0340, × 3 = .102 Multiplying the p by m and comparing with .05 gives the same three verdicts as comparing the t with t**. SPSS prints the adjusted column, so a Sig. of .045 under Bonferroni has already been multiplied and is read against .05, not against .0167. Reading it against α/m is the commonest way to get this table wrong.
- A simultaneous interval for the biggest gap 13.0 ± 2.601 × 2.646 = 13.0 ± 6.88 95% simultaneous CI [6.12, 19.88] wpm The plain interval would be 13.0 ± 2.080 × 2.646 = [7.50, 18.50]. The simultaneous one is wider because its 95% confidence covers all three intervals at once.
- The write-up Typeface affected reading speed, F(2, 21) = 12.10, p < .001. Bonferroni-corrected pairwise comparisons on the pooled error term showed that slab was read faster than serif (13.0 wpm, 95% simultaneous CI [6.12, 19.88], t(21) = 4.91, adjusted p < .001) and that sans serif was also read faster than serif (7.0 wpm, t(21) = 2.65, adjusted p = .045). Slab and sans serif did not differ reliably (6.0 wpm, t(21) = 2.27, adjusted p = .10).
sp = 5.29 wpm and every pair has SE = 2.65. t(21) = 2.65, 4.91 and 2.27. Against the uncorrected t*(21) = 2.080 all three are significant; against the Bonferroni t**(21) = 2.601 the sans-versus-slab comparison is not, adjusted p = .10. The largest difference is 13.0 wpm, 95% simultaneous CI [6.12, 19.88].
Rounding: t**(21) = 2.6013, and Table D has no column for a two-tailed α of .0167, which is .0083 in the upper tail. Table D brackets it between the .01 column (2.518) and the .005 column (2.831). That settles the two clear comparisons but leaves serif against sans, at 2.646, needing the exact value.
From §2.3 Post-Hoc Tests. The Contrast Builder runs a pairwise comparison as a contrast with coefficients (1, −1, 0), and the APA formatter will typeset the omnibus line.
59Caffeine on a short night
Exam-levelTwenty volunteers are assigned to one of four conditions in a balanced 2 × 2 design: caffeine or none, crossed with a normal night's sleep or four hours. Five people are in each cell. The outcome is a sustained-attention score out of 100, where higher is better. The error sum of squares from the analysis is 320.00.
| Rested | Deprived | |
|---|---|---|
| No caffeine | 80 | 60 |
| 200 mg caffeine | 84 | 76 |
- Compute both marginal means for each factor, the grand mean, and the size of each main effect.
- Compute the two simple main effects of caffeine and show they average to the main effect.
- Give the difference of differences, say what it means in words, and compute SSAB from it.
- Complete the two-way ANOVA table and test all three effects against F*(1, 16) = 4.49.
Worked solution
- Margins and main effects no caffeine: (80 + 60)/2 = 70.0 caffeine: (84 + 76)/2 = 80.0 rested: (80 + 84)/2 = 82.0 deprived: (60 + 76)/2 = 68.0 grand mean = (80 + 60 + 84 + 76)/4 = 75.0 main effect of caffeine = 80 − 70 = 10.0 points main effect of sleep = 82 − 68 = 14.0 points A marginal mean averages cells, not people. The two are the same here only because every cell has five volunteers. In an unbalanced design they differ, and you have to tell the software which one you want.
- Simple main effects of caffeine among the rested: 84 − 80 = 4.0 points among the deprived: 76 − 60 = 16.0 points mean of the two: (4 + 16)/2 = 10.0 = the main effect ✓ In a balanced design, a main effect is always the average of its simple main effects. Here the average of 4 and 16 describes neither group well, so read the interaction before you quote either main effect.
- The difference of differences 16.0 − 4.0 = 12.0 points SSAB = n(difference of differences)² / 4 = 5(144)/4 = 180.00 In words: caffeine adds twelve more points of attention when you are short of sleep than when you are not. Both simple effects point the same way, so the lines on an interaction plot converge but do not cross. That pattern is called a spreading interaction. The shortcut formula works only for a 2 × 2; with more levels the interaction has to be built from the cell residuals.
- The sums of squares SSA = n·J·Σ(Āᵢ − Ḡ)² = 5 × 2 × [(70 − 75)² + (80 − 75)²] = 10(50) = 500.00 SSB = n·I·Σ(B̄ⱼ − Ḡ)² = 5 × 2 × [(82 − 75)² + (68 − 75)²] = 10(98) = 980.00 cell residuals: 80 − 70 − 82 + 75 = +3, and −3, −3, +3 round the table SSAB = 5(3² + 3² + 3² + 3²) = 5(36) = 180.00 ✓ matches the shortcut SST = 500 + 980 + 180 + 320 = 1980.00
- The table
dfE = N − IJ = 20 − 4 = 16, so MSE = 320.00 / 16 = 20.00 all three F values exceed 4.49, so all three effects are significant The error df is N minus the number of cells, not N minus 2. Dividing 320 by 20 instead would print MSE = 16.00 and inflate every F by a quarter.Source SS df MS F ηp² Caffeine (A) 500.00 1 500.00 25.00 .61 Sleep (B) 980.00 1 980.00 49.00 .75 A × B 180.00 1 180.00 9.00 .36 Error 320.00 16 20.00 Total 1980.00 19 - What to say first The interaction, F(1, 16) = 9.00, p = .008, ηp² = .36. Caffeine helped everyone, but it helped the sleep-deprived four times as much. Quoting the main effect of caffeine on its own, ten points, describes neither group: the rested gained four and the deprived gained sixteen.
Margins 70 and 80 for caffeine, 82 and 68 for sleep, grand mean 75. Simple main effects of caffeine are 4.0 rested and 16.0 deprived, averaging to the 10.0 main effect; the difference of differences is 12.0. F(1, 16) = 25.00 for caffeine, 49.00 for sleep and 9.00 for the interaction, all significant at α = .05, with ηp² of .61, .75 and .36. Report the interaction first.
Rounding: none needed. Every cell in the table is exact.
From §2.4 Factorial ANOVA. Load these four cell means into the Interaction Plot Explorer to see the spreading pattern, and §2.4's reading order is the one used in the last step.
60The study that lost its method section
StretchA driving-simulator study had every participant try every one of several in-car display designs, in a counterbalanced order, and recorded reaction time to a hazard. The only surviving version of the paper prints the repeated-measures table with two of its degrees of freedom and three of its sums of squares. It says nothing else about how many people or how many displays were involved.
- Between conditions: SS = 162.00, df = 3
- Between subjects: SS = 253.00, df = ?
- Error (subject × condition): SS = ?, df = 33
- Total: SS = 613.00, df = ?
- Recover the number of displays, the number of participants, and the number of observations.
- Complete the table and test at α = .05 against F*(3, 33) = 2.89.
- Report partial η² and plain η², and say why they differ so much here.
- The same 48 observations could have come from 48 different people, one per display. Redo the test that way and compare.
Worked solution
- The design, from two df dfconditions = k − 1 = 3, so k = 4 displays dferror = (n − 1)(k − 1) = 33, so (n − 1)(3) = 33 and n − 1 = 11 n = 12 participants, N = nk = 48 observations dfsubjects = n − 1 = 11 dfT = N − 1 = 47 In a repeated-measures analysis the error df is a product, (n − 1)(k − 1), and it is the df that gives you the sample size. Check the df before going on: 3 + 11 + 33 = 47 ✓.
- The missing sum of squares SST = SSC + SSS + SSE SSE = 613.00 − 162.00 − 253.00 = 198.00 A one-way analysis splits the total in two; a repeated-measures analysis splits it in three. The subjects row removes the variation that comes from some drivers being quicker than others on every display, before the conditions are compared.
- The table
9.00 > 2.89, so reject H₀ at α = .05 (exact p = .0002) The subjects row gets a mean square but no F. It is a nuisance term that has been removed. An F beside it would test whether people differ from each other, which they always do.Source SS df MS F Between conditions 162.00 3 54.00 9.00 Between subjects 253.00 11 23.00 Error 198.00 33 6.00 Total 613.00 47 - Two effect sizes ηp² = SSC / (SSC + SSE) = 162 / 360 = .45 η² = SSC / SST = 162 / 613 = .26 Partial η² compares the display effect with only the variation the design leaves unexplained. Plain η² compares it with everything, including the 253.00 of stable differences between drivers that the design removed. Neither is wrong. The gap between them is large when individual differences are large, and those are the studies where a within-subjects design helps most.
- The same data as a between-subjects study error = SSS + SSE = 253.00 + 198.00 = 451.00 on 11 + 33 = 44 df MSE = 451.00 / 44 = 10.25 F = 54.00 / 10.25 = 5.27 on (3, 44) 5.27 > F*(3, 44) = 2.82, so still significant (p = .003) SSC and the numerator are unchanged, and the F is not much over half the size. The between-subjects analysis has to leave the 253.00 in the error term, because with one observation per person there is no way to separate a driver from a display. It gains eleven error degrees of freedom but adds 253.00 to the error sum of squares, and when people differ a lot from each other, that makes the error mean square larger.
- A note on sphericity With four conditions there are six pairwise differences and no reason to assume they vary equally, so the output would include a Greenhouse-Geisser row. At ε = .72 the df become 2.16 and 23.76, the F stays 9.00 because no data changed, and p moves from .0002 to .001. The correction lowers the df and leaves the statistic alone, so the same F gets a larger p.
Four displays, 12 participants, 48 observations, df 3, 11, 33 and 47. SSE = 198.00, MSC = 54.00, MSE = 6.00, F(3, 33) = 9.00, p < .001, ηp² = .45 against a plain η² of .26. Run between subjects the same numbers give F(3, 44) = 5.27, p = .003, because the 253.00 of subject variation goes back into the error.
Rounding: every cell is exact. MSE = 198/33 = 6.00 and MSC = 162/3 = 54.00 both divide evenly, so F = 9.00 exactly.
From §2.5 Repeated Measures ANOVA. The partition readout in Where the Variance Goes runs the last step as a slider, and §1.5 Between vs Within Designs covers the same tradeoff in prose.
61Twelve seeds, two treatments
Warm-upA horticulture student records how many days each seedling takes to produce its first flower. Six seeds were soaked before planting and six were not. Six per group is far too few to judge normality, and days-to-event data are skewed by nature, so the comparison is made on ranks.
- Soaked (n₁ = 6): 8, 11, 13, 15, 18, 24
- Not soaked (n₂ = 6): 16, 19, 21, 23, 27, 31
- Critical value from the table: U* = 5 at two-tailed α = .05
- Rank all twelve values together and find each group's rank sum, then check the two sums.
- Compute both U values and check them against each other.
- State the decision rule and decide at α = .05.
- The exact two-tailed p is .041. Explain why a statistic that only just reaches the table cutoff has a p noticeably under .05.
Worked solution
- One ranking over both groups
R₁ (soaked) = 1 + 2 + 3 + 4 + 6 + 10 = 26 R₂ (not soaked) = 5 + 7 + 8 + 9 + 11 + 12 = 52 check: 26 + 52 = 78 = 12(13)/2 ✓ Rank the pooled sample first, and only then sort the ranks back into groups. Ranking each group on its own is a common mistake. There are no ties here, so no rank has to be shared.Value 8 11 13 15 16 18 19 21 23 24 27 31 Group S S S S N S N N N S N N Rank 1 2 3 4 5 6 7 8 9 10 11 12 - The two U statistics U₁ = R₁ − n₁(n₁ + 1)/2 = 26 − 21 = 5 U₂ = R₂ − n₂(n₂ + 1)/2 = 52 − 21 = 31 check: U₁ + U₂ = 36 = n₁n₂ ✓ U counts how many times a value from one group exceeds a value from the other, out of the 36 possible pairs. Five means the soaked seeds flowered later than the unsoaked ones in only five of the thirty-six pairs.
- The decision test statistic = the smaller U = 5 reject when U ≤ U*, and 5 ≤ 5, so reject H₀ at α = .05 The rank tests reverse the usual direction: a small statistic is the significant one, because a small U means the two groups barely overlap. If you read U the way you read an F, you get the answer backwards.
- Why the exact p is .041 rather than .050 P(smaller U ≤ 5) = 38 / 924 = .0411 P(smaller U ≤ 6) = 60 / 924 = .0649 With six and six there are only 924 ways to split twelve ranks into two groups, so the null distribution moves in jumps and no cutoff gives exactly .050. A table prints the most generous value whose true error rate is still at or under α. Here that is 5, at .0411, because a cutoff of 6 would give .0649. Every printed rank table follows this convention, so these tests are slightly conservative.
R₁ = 26 and R₂ = 52, summing to 78 as they must. U₁ = 5, U₂ = 31, summing to 36. The smaller U is 5, which is at the critical value of 5, so reject H₀ at two-tailed α = .05: soaking shifted the time to first flower. The exact two-tailed p is .041.
Rounding: nothing to round. Every quantity in this problem is an integer until the p-value, which comes from counting 38 of the 924 possible rank splits.
From §2.1 Non-Parametric Alternatives. Load the twelve seedlings into the rank ledger with ?tab=mw&g=…, which gets the same U = 5 and the same exact p by subtracting each rank sum from n₁n₂ + nᵢ(nᵢ + 1)/2 instead. That is the other published convention. It gives the same two numbers with U₁ and U₂ swapped, and since the test uses the smaller one, the decision is the same. Find U* in Table U on tables.html, where selecting the n₁ = 6, n₂ = 6 cell states the decision rule in a sentence.
62Volunteering and a wellbeing score
Exam-levelEight people report how many hours they volunteer in a typical month and complete a wellbeing questionnaire. The hours are badly skewed, with one person at sixteen and most under ten, and the wellbeing score is an ordinal sum of Likert items, so the relationship is measured on ranks.
| Person | A | B | C | D | E | F | G | H |
|---|---|---|---|---|---|---|---|---|
| Hours per month | 1 | 2 | 4 | 5 | 7 | 9 | 12 | 16 |
| Wellbeing score | 50 | 44 | 41 | 52 | 47 | 58 | 63 | 55 |
- Rank each variable separately, compute the differences and check that they sum to zero.
- Compute Σd² and then ρs.
- The table gives ρs* = .738 at two-tailed α = .05 for n = 8. Decide, and write the conclusion.
- A classmate computes t = ρs√((n − 2)/(1 − ρs²)) = 2.50 on 6 df, compares it with 2.447, and reports a significant result. Who is right?
Worked solution
- Two separate rankings
Σd = −3 + 0 + 2 − 1 + 2 − 1 − 1 + 2 = 0 ✓ Each variable is ranked separately, unlike the Mann-Whitney test, which ranks a pooled sample. The differences always sum to zero, because both columns are the same eight ranks in some order. A nonzero sum means an arithmetic slip.Person Hours Rank x Wellbeing Rank y d d² A 1 1 50 4 −3 9 B 2 2 44 2 0 0 C 4 3 41 1 +2 4 D 5 4 52 5 −1 1 E 7 5 47 3 +2 4 F 9 6 58 7 −1 1 G 12 7 63 8 −1 1 H 16 8 55 6 +2 4 - The coefficient Σd² = 9 + 0 + 4 + 1 + 4 + 1 + 1 + 4 = 24 ρs = 1 − 6Σd² / [n(n² − 1)] = 1 − 6(24) / [8(63)] = 1 − 144 / 504 = 1 − 0.2857 = .714 Perfect agreement, Σd² = 0, gives ρs = 1, and the largest Σd² possible at n = 8, which is 168, gives −1. Nine of the 24 here come from person A alone, who volunteers least of anyone but reports a middling score.
- The decision ρs = .714 against ρs* = .738 .714 < .738, so do not reject H₀ at two-tailed α = .05 With eight people, a coefficient of .71 is not enough, although it would be convincing in a larger sample. Write that the monotonic association was positive but not statistically significant, ρs = .71, p = .058, and that eight people cannot settle the question either way.
- Who is right exact two-tailed p from the 40,320 possible rankings: .058 the t approximation gives p = .047 The table is right and the classmate is wrong. The t formula treats ρs as though it came from a continuous distribution. At n = 8, though, the null distribution of Σd² comes from 40,320 equally likely rankings and has visible gaps between its possible values. Here the approximation gives a p that is too small, .047 against the exact .058, and that is enough to flip the decision. Use the exact table whenever the sample is small enough to have one, which for Spearman means up to about thirty pairs.
Σd² = 24 and ρs = 1 − 144/504 = .714. Against ρs*(8) = .738 at two-tailed α = .05, do not reject: the association is positive but not significant, exact p = .058. The classmate's t approximation is too generous at this sample size and reverses the verdict, so trust the exact table.
Rounding: ρs = .714286, which rounds to .71 for reporting and to .714 for comparison with a table printed to three decimals. Pearson's r on the raw numbers is .681, lower than ρs because the sixteen-hour volunteer is far from the other hours, and ranking removes that gap.
From §2.1 Non-Parametric Alternatives and §1.17 Correlation. The ρs table is printed on tables.html, and the Spearman tab takes these eight pairs directly: ?tab=sp&data=….
📐 Regression · Models with several predictors
Eleven problems on models with several predictors, most of them taught in Stats 2. The arithmetic here is lighter than in Stats 1, and the judgment is heavier: reading a coefficient correctly, deciding what a model can claim, and spotting the warning signs in the output.
63Two predictors, two scales
Exam-levelA study of 120 first-year students regresses final exam score on weekly study hours and average nightly sleep. A journalist reads the output and writes that sleep matters two and a half times more than studying, because its coefficient is bigger.
- Model: exam = 29.57 + 1.30(study hours) + 3.20(sleep hours)
- SE = 0.24 for study, 0.80 for sleep; both p < .001, df = 117
- R² = .34, F(2, 117) = 30.14, p < .001
- Exam score: M = 64.0, SD = 12.4
- Study hours: M = 9.5, SD = 4.0
- Sleep hours: M = 6.9, SD = 1.2
- Put the study-hours coefficient into a sentence a non-statistician would understand.
- Compute the standardized coefficients. Is the journalist right?
- Predict the exam score for a student who studies 10 hours a week and sleeps 7 hours a night.
- Compute adjusted R², and say why the intercept should not be interpreted.
Worked solution
- Reading a raw coefficient Among students who sleep the same amount, each extra hour of weekly study is associated with 1.30 more exam points. The key phrase is "who sleep the same amount": every coefficient in a multiple regression is the effect of its predictor with the others held fixed. Nothing here justifies the word causes, because the students chose their own study hours.
- Standardizing β = b × (SD of the predictor) / (SD of the outcome) βstudy = 1.30 × 4.0 / 12.4 = 5.20 / 12.4 = .419 βsleep = 3.20 × 1.2 / 12.4 = 3.84 / 12.4 = .310 The journalist has it backwards. Study hours vary far more between students (SD = 4.0 hours) than sleep does (SD = 1.2 hours). So one extra hour is a quarter of an SD of study time but more than four fifths of an SD of sleep. Once both are expressed in standard deviations, studying is the stronger predictor. Raw coefficients are only comparable when the predictors share a scale, and hours-per-week and hours-per-night do not.
- A prediction ŷ = 29.57 + 1.30(10) + 3.20(7) = 29.57 + 13.00 + 22.40 = 64.97 ≈ 65.0 points Both values are near the middle of their observed ranges. Predictions are safe only inside the range of the data.
- Adjusted R² and the intercept adj R² = 1 − (1 − R²)(n − 1)/(n − p − 1) = 1 − (.66)(119/117) = 1 − .671 = .329 ≈ .33 Adjusted R² is barely below R², because the penalty for two predictors is small when n = 120. The intercept of 29.57 is the predicted score for a student who studies zero hours a week and sleeps zero hours a night. No such student exists in the data, so the model has no information there, and the intercept only marks where the fitted plane crosses the axis.
βstudy = .42 against βsleep = .31, so studying is the stronger predictor and the headline is wrong. Predicted score at 10 study hours and 7 sleep hours is 65.0, adjusted R² = .33.
From §2.9 Multiple Regression · the same distinction shows up in the effect-size converter.
64The reading program that started ahead
Exam-levelA school offers an after-school reading program. Thirty children enroll and thirty comparable children do not, and everyone takes the same reading test before and after the term. The program leader reports a 6.4-point advantage.
- Pretest: program M = 52.0 (SD = 10.5), comparison M = 45.0 (SD = 10.5)
- Posttest: program M = 61.4 (SD = 9.0), comparison M = 55.0 (SD = 9.0)
- Pooled within-group slope of posttest on pretest: b = 0.62
- Independent t-test on posttest alone: t(58) = 2.75, p = .008
- ANCOVA with pretest as covariate: F(1, 57) = 1.48, p = .229
- Compute each group's adjusted posttest mean.
- How large is the adjusted effect, and why does it differ from 6.4?
- The program's newsletter says the course "raises reading scores by 6.4 points." Rewrite that sentence so that it is accurate.
- Which ANCOVA assumption would you check first here, and what would you do if it failed?
Worked solution
- The covariate's grand mean X̄ = (52.0 + 45.0) / 2 = 48.5 Equal group sizes, so the simple average is the grand mean. ANCOVA compares the groups at this pretest value.
- Adjusted means adjusted Ȳj = Ȳj − b(X̄j − X̄) program: 61.4 − 0.62(52.0 − 48.5) = 61.4 − 2.17 = 59.23 comparison: 55.0 − 0.62(45.0 − 48.5) = 55.0 + 2.17 = 57.17 The program group's mean is adjusted down because it started 3.5 points above the grand mean, and the comparison group's is adjusted up because it started 3.5 points below.
- The adjusted effect 59.23 − 57.17 = 2.06 points shortcut: adjusted = raw − b × (covariate gap) = 6.4 − 0.62(7.0) = 6.4 − 4.34 = 2.06 Of the 6.4-point advantage, 4.34 points are accounted for by the pretest gap. As far as this analysis can tell, the term added 2.06 points, and F(1, 57) = 1.48, p = .229 means even that is within what chance produces at this sample size.
- Rewriting the claim "Children in the program finished 6.4 points ahead, but they also began the year 7.0 points ahead. Adjusting for the starting gap leaves a 2.06-point difference that is not statistically distinguishable from zero, F(1, 57) = 1.48, p = .229." Note also that families chose the program, so even the adjusted figure is an observational comparison. Pretest score is the one baseline difference that was measured; motivation, home support and reading habits were not.
- Homogeneity of regression slopes ANCOVA fits one slope to both groups and reports a single adjusted gap. A single gap makes sense only if the pretest has the same slope in each group. Test it by adding the group × pretest interaction: if the interaction is significant, the lines are not parallel and there is no single number to report. You would then fit the interaction model and describe how the program's effect changes across the pretest range. That is often the more interesting finding.
Adjusted means 59.23 and 57.17, an adjusted difference of 2.06 points against a raw difference of 6.4. Two thirds of the headline gap was baseline imbalance, and what remains is not significant.
From §2.15 ANCOVA · the parallel-lines assumption belongs to §2.11 Interactions.
65Three scales, one model
Exam-levelA driving school fits a logistic regression predicting whether a learner passes the practical test on the first attempt, from the number of paid lessons taken beforehand.
- Lessons in the sample ranged from 2 to 30
- Useful values: e0.45 = 1.568, e2.25 = 9.488, e0.10 = 1.105, e−0.80 = 0.449
- Give the odds ratio for one extra lesson, and for five extra lessons.
- Compute the predicted pass probability at 6 lessons and at 8 lessons.
- Now do the same at 14 and 16 lessons. Compare the two increases.
- How many lessons put a learner at a coin-flip?
Worked solution
- Odds ratios OR (1 lesson) = eb₁ = e0.45 = 1.57 OR (5 lessons) = e5b₁ = e2.25 = 9.49 Each lesson multiplies the odds of passing by about 1.57. Five lessons multiply them by 1.575, which is 9.49, not by 5 × 1.57. Odds ratios compound.
- Probabilities at 6 and 8 lessons P = 1 / (1 + e−(b₀ + b₁x)) x = 6: η = −2.80 + 2.70 = −0.10 → P = 1/(1 + 1.105) = .475 x = 8: η = −2.80 + 3.60 = 0.80 → P = 1/(1 + 0.449) = .690 increase = .690 − .475 = .215
- Probabilities at 14 and 16 lessons x = 14: η = −2.80 + 6.30 = 3.50 → P = .971 x = 16: η = −2.80 + 7.20 = 4.40 → P = .988 increase = .988 − .971 = .017 The same two-lesson step has the same odds ratio in both places, e0.90 = 2.46, yet the probability rises 21.5 points in the middle of the curve and 1.7 points near the top. So a logistic model has no single "effect on probability": the odds ratio is constant, but the change in probability depends on where you start.
- The 50% point P = .50 when the log-odds = 0, so b₀ + b₁x = 0 x = −b₀ / b₁ = 2.80 / 0.45 = 6.22 lessons After just over six lessons, a learner is as likely to pass as to fail. The intercept answers a related question: at zero lessons the log-odds are −2.80, so P = .057, a 6% chance of passing with no lessons.
OR = 1.57 per lesson and 9.49 per five lessons. The same two extra lessons raise the pass probability by .215 around the middle of the curve and by .017 near the top, and the coin-flip point is 6.22 lessons.
From §2.16 Logistic Regression · the same curve reappears as a psychometric function in §3.19.
66The main effect that isn't the story
Exam-levelSixty participants solve logic puzzles under one of four conditions in a 2 × 2 design: feedback arrives either immediately or after a delay, and the puzzles are either easy or hard. The abstract reports that immediate feedback improved accuracy by 10 percentage points.
| Easy | Hard | |
|---|---|---|
| Immediate feedback | 82 | 68 |
| Delayed feedback | 78 | 52 |
- Compute the marginal means and both main effects.
- Compute the simple effect of feedback at each difficulty level.
- Build the three F-ratios, given that SSA = 1500, SSB = 6000 and SSA×B = 540.
- Is the abstract's sentence defensible? Write a better one.
Worked solution
- Marginal means immediate = (82 + 68)/2 = 75 delayed = (78 + 52)/2 = 65 easy = (82 + 78)/2 = 80 hard = (68 + 52)/2 = 60 grand mean = (82 + 68 + 78 + 52)/4 = 70 Main effect of feedback = 75 − 65 = 10 points. Main effect of difficulty = 80 − 60 = 20 points.
- Simple effects feedback effect on easy puzzles: 82 − 78 = 4 points feedback effect on hard puzzles: 68 − 52 = 16 points interaction contrast = 4 − 16 = −12 points The 10-point main effect is the average of a 4 and a 16. It describes neither condition.
- The F-ratios F = MSeffect / MSerror, and each effect here has df = 1 feedback: F(1, 56) = 1500 / 90 = 16.67, p < .001 difficulty: F(1, 56) = 6000 / 90 = 66.67, p < .001 interaction: F(1, 56) = 540 / 90 = 6.00, p = .017 partial η² = SSeffect / (SSeffect + SSerror), with SSerror = 90 × 56 = 5040 = .23 (feedback), .54 (difficulty), .10 (interaction)
- Fixing the abstract The sentence is arithmetically true but misleading. A significant interaction means the feedback effect is not one number, so quoting the average as though it applied everywhere hides the finding. A version closer to the data: "Feedback timing interacted with difficulty, F(1, 56) = 6.00, p = .017, partial η² = .10. Immediate feedback helped very little on easy puzzles (4 points) and substantially on hard ones (16 points)." When an interaction is significant, describe the simple effects first and leave the main effects in the table.
Both main effects and the interaction are significant, Fs(1, 56) = 16.67, 66.67 and 6.00. Because the feedback benefit is 4 points on easy puzzles and 16 on hard ones, the abstract's single 10-point claim describes no condition in the study.
From §2.4 Factorial ANOVA and §2.11 Interactions in Regression.
67Between, within, or neither
Warm-upA researcher wants to compare three interface designs on task completion time. She has budget for about 90 testing sessions and asks you whether to run 90 people through one design each, or 30 people through all three.
- Task completion time in seconds, three designs
- Individual differences in typing speed are large
- Each session takes about 20 minutes per design
- The task is the same puzzle type in all three designs
- Her pilot analysis reported ε = 0.72 from a Greenhouse–Geisser correction
- Which design would you recommend, and which test does it call for?
- What are the advantages and the costs of the within-subjects version?
- How many possible presentation orders are there, and how would you handle them?
- Her pilot mentioned sphericity. What is it, and what do you do with ε = 0.72?
- When would you drop repeated-measures ANOVA for a mixed model?
Worked solution
- The recommendation Within-subjects, analyzed with a one-way repeated-measures ANOVA. Typing speed varies a lot between people and has nothing to do with the interfaces. In a between-subjects design that variation goes into the error term and can hide the effect. When each person serves as their own control, it is removed from the error term.
- Gains and costs You gain power: the same 90 sessions now compare designs within each person, not across people, and the variation due to individual differences leaves the error term. The cost is order effects: someone on their third interface is faster because they have already solved two puzzles, and possibly more bored. Practice, fatigue and carryover are all real, and none of them exist in a between-subjects design.
- Counting the orders 3! = 3 × 2 × 1 = 6 possible orders With 30 participants you can use complete counterbalancing, five people per order, which balances practice effects across designs exactly. When there are too many conditions for that, a Latin square is the cheaper alternative. With three conditions it uses three sequences and puts each design in each position once, but it does not balance which design comes before which. Also vary the specific puzzles across designs so that no one sees the same problem twice.
- Sphericity and ε Sphericity requires the variances of the differences between every pair of conditions to be equal. When it fails, the F-test's degrees of freedom are too generous and the p-value comes out too small. Greenhouse–Geisser multiplies both df by ε to compensate. uncorrected: F(2, 58) corrected: F(2 × 0.72, 58 × 0.72) = F(1.44, 41.76) Report the fractional degrees of freedom and name the correction. An ε of 0.72 is a meaningful departure, so with three conditions this is not optional.
- When to use a mixed model Repeated-measures ANOVA needs a complete row for every participant, so one missing session removes that person entirely. A mixed model keeps partial data, handles unequal numbers of trials per person, allows the covariance structure to be modeled rather than assumed, and extends to designs where the repeated factor is continuous. If sessions get canceled or the design gains a second random factor such as stimulus items, switch to a mixed model.
Run it within-subjects with a repeated-measures ANOVA, counterbalance across all 6 orders with 5 participants each, and report the Greenhouse–Geisser corrected test as F(1.44, 41.76).
From §1.5 Between vs Within Designs, §2.5 Repeated Measures ANOVA and §3.10 Mixed Models.
68Getting the inputs right
Exam-levelA master's student is planning a study comparing three teaching methods on an end-of-term test. Her draft methods section says: "Based on previous work we expect a medium effect. We will recruit 20 participants per group, which is standard in this literature."
- Three independent groups, one test score per participant
- Target power .80, α = .05, two-tailed
- "Medium" effect, source unspecified
- Planned n = 20 per group, 60 in total
- Which effect-size measure does this design need, and what is Cohen's medium value for it?
- Roughly what power does her planned sample actually have?
- What total sample would reach .80, and how would you check it?
- She adds that if the result is null she will "report observed power". Talk her out of it.
Worked solution
- The right effect size Three groups compared with a one-way ANOVA means Cohen's f, not d. Cohen's benchmarks for f are .10 small, .25 medium, .40 large. Writing "medium effect" without naming the metric is the first thing to fix, because d = 0.5 and f = 0.25 are different quantities that happen to share the label.
- Power at the planned n noncentrality λ = f²N = 0.25² × 60 = 3.75 df₁ = k − 1 = 2, df₂ = N − k = 57 power ≈ .37 If the effect she expects is real, this design detects it about 37% of the time. She is more likely to end the year with an ambiguous null than with an answer, and a null result from a study this size says almost nothing about whether the effect exists.
- The sample that works λ = 0.25² × 159 = 9.94, df₁ = 2, df₂ = 156 → power = .805 159 in total, so 53 per group. Set the power calculator to one-way ANOVA, f = 0.25, k = 3, α = .05, power = .80 and it gives the same figure. Two things to say in the write-up: "medium" is the weakest possible justification for an effect size, and the smallest effect that would change teaching practice is a better basis. If prior studies are the source, discount them, because published effects tend to be inflated.
- Observed power Observed power is computed from the effect size she happens to obtain, so it is a rearrangement of her own p-value and adds no new information. A p just above .05 always gives observed power just under 50%, whatever the design. After a null result, ask a different question: what is the smallest effect this study could have detected with 80% power? Answer that from the design, before the data.
- One more thing to warn her about If a follow-up adds a second factor, remember that interactions typically need considerably more data than main effects of the same nominal size. The interaction contrast is a difference of differences, so its standard error is larger. Power the study for the effect she most wants to detect, and if that is the interaction, plan the sample around it.
She needs Cohen's f = 0.25, not d. At 20 per group her power is about .37; reaching .80 takes 159 participants, 53 per group. Observed power after the fact adds nothing.
From §3.2 Power Analysis · run the numbers in Power & Sample Size or sketch the whole design in Plan My Analysis.
69Significant model, significant nothing
Exam-levelAn occupational psychologist regresses supervisor-rated job performance on three predictors in a sample of 150 employees. The overall model is significant. None of the predictors is, and one of them has the wrong sign.
- Overall model: R² = .31, F(3, 146) = 21.87, p < .001
- Age: b = 0.09, p = .38
- Years of experience: b = −0.18, p = .21
- Years since qualifying: b = 0.24, p = .09
- Compute the tolerance and VIF for each predictor.
- Which cross the usual alarm thresholds?
- Explain the significant F with no significant coefficients, and the negative sign on experience.
- Give three possible fixes and say what each one costs.
- Does any of this damage the model's predictions?
Worked solution
- Tolerance and VIF
tolerance = 1 − R²ⱼ VIF = 1 / tolerance
Predictor R²ⱼ Tolerance VIF Age .923 .077 12.99 Years of experience .887 .113 8.85 Years since qualifying .861 .139 7.19 - Reading the thresholds The common alarm level is VIF > 5, with VIF > 10 as the lenient version. All three predictors exceed the strict threshold and age exceeds the lenient one. A tolerance of .077 means that only 7.7% of the variance in age is unique to age; the other 92.3% is explained by the other two predictors.
- Why the F and the t-tests disagree The two tests answer different questions. The F-test asks whether the three predictors together explain performance, and they clearly do: R² = .31. Each t-test asks whether one predictor adds anything once the other two are in the model, and since the three are nearly the same variable, none of them adds much to the others. This pattern is the classic sign of multicollinearity. The negative coefficient on experience has the same cause. With predictors this strongly correlated, the coefficient estimates are unstable, their standard errors inflate, and the same fitted values can come from combinations of coefficients that make no substantive sense. Do not interpret that minus sign as evidence that experience harms performance.
- Three fixes and their costs The first fix is to drop two predictors and keep one. It is the simplest, but it changes the question: the remaining coefficient is now the effect of that variable plus everything it stands in for, so name it accordingly (say "career stage", not "age"). The second is to combine them into a composite or a principal component. That keeps all the information but makes the result harder to interpret, since no one can change a component score directly. The third is ridge regression, which stabilizes the estimates by accepting a little bias. It is the right choice when prediction matters more than individual coefficients. A fourth option is to collect data where the predictors diverge, for instance by including career changers whose age and experience differ.
- Predictions are fine Multicollinearity inflates the variance of the coefficient estimates, not the fitted values. Within the range of predictor combinations actually observed, this model predicts as well as its R² suggests. It cannot tell you which of the three variables is responsible, and that is usually the question that prompted the study.
VIFs of 12.99, 8.85 and 7.19, all above the usual alarm level of 5. The predictors are nearly the same variable, so the model as a whole is significant while no individual coefficient can be trusted, including its sign. The model still predicts well, but its coefficients cannot be interpreted.
From §2.12 Multicollinearity · compare with the diagnostics in §2.8 and Problem 43 above.
70The twenty-four who did not come back
StretchA twelve-week weight-management trial randomized 180 adults to an intervention or a control arm. Twenty-four never returned for the week-12 weigh-in. The analyst dropped them and reported the result.
- 18 were in the intervention arm, 6 in the control arm (90 per arm at randomization)
- Baseline weight: dropouts M = 104.2 kg, completers M = 96.1 kg
- Dropouts reported more side effects at the week-4 check-in
- All 24 have baseline and week-4 weights recorded; only week 12 is missing
- Complete-case result: intervention −5.8 kg, control −2.1 kg, p = .003
- Compute the dropout rate in each arm. Is the difference itself worth reporting?
- Classify the missingness mechanism, and say what you cannot rule out.
- In which direction is the complete-case estimate likely to be wrong?
- Evaluate three quick fixes: mean imputation, last observation carried forward, and multiple imputation.
- What should the paper report?
Worked solution
- Dropout by arm intervention: 18 / 90 = 20.0% control: 6 / 90 = 6.7% overall: 24 / 180 = 13.3% Report the difference in dropout as a finding. Three times as many people left the intervention arm, and the week-4 side-effect reports suggest why. If a treatment makes people leave a trial, that is important information about the treatment.
- Naming the mechanism Not MCAR: missingness is clearly related to arm, to baseline weight and to week-4 side effects, all of which are observed. That is the MAR pattern, and it can be handled, because the observed variables contain the information needed to correct for it. What you cannot rule out is MNAR. If people quit because the scale was not moving, missingness depends on the unobserved week-12 weight itself, and no analysis of the observed data can settle that. The data cannot tell MAR from MNAR, so the mechanism is an assumption you argue for and then probe with a sensitivity analysis.
- Direction of the bias Complete-case analysis keeps the people who stayed, and in the intervention arm those are disproportionately the ones for whom it was working and tolerable. The 20% who left were heavier at baseline and struggling with side effects. So the −5.8 kg estimates what the treatment does for people who can stick with it, which overstates what it does for everyone offered it. The control arm lost far fewer people, so the comparison is also unbalanced.
- Three fixes, graded Mean imputation is the worst of the three. It inserts values with zero variability, shrinks the standard deviation, weakens every correlation, and makes the analysis treat the data as 180 complete cases, so the standard errors and p-values are overconfident. Last observation carried forward is better than it looks in this trial. Weight is falling, so carrying a week-4 weight forward understates the intervention's benefit, and the bias is conservative. But it still treats an assumption as data, it does not propagate any uncertainty, and regulators have moved away from it. Multiple imputation is the right tool: build the imputation model from baseline weight, arm, week-4 weight and side-effect reports, generate several completed datasets, analyze each, and pool the results. The extra uncertainty from the missing values then shows up in the standard errors. A mixed model fitted to all timepoints is also valid under MAR and needs no imputation step.
- What the paper should say How much was missing and from which arm; a comparison of dropouts and completers on every baseline variable available; the mechanism assumed and the reasoning behind it; the primary analysis under MAR, by multiple imputation or a mixed model; and a sensitivity analysis that asks what happens if the dropouts did badly, for instance assuming they returned to baseline weight. If the conclusion holds up, say so. If it does not, report that.
20% dropout in the intervention arm against 6.7% in the control arm, related to observed variables, so MAR at best and possibly MNAR. Complete-case analysis keeps the people it worked for and overstates the benefit. Use multiple imputation or a mixed model, and report a sensitivity analysis alongside it.
From §3.17 Missing Data · the reporting standard belongs to §3.4 From Output to Results.
71One slope, four columns
Warm-upForty-two first-year students record how many hours they slept the night before an exam, and their exam score out of 100 is regressed on that. Here is the whole printout. Most of its numbers follow from a few others.
- n = 42 students; mean sleep x̄ = 6.9 hours, mean score ȳ = 64.2
- Coefficient on sleep: B = 1.86, Std. Error = 0.74
- Std. Error of the Estimate (that is, s) = 6.40
- Σ(x − x̄)² = 74.8
- Critical values: t*(40) = 2.021 at 95%, t*(40) = 1.684 one-tailed at .05
- Confirm the printed standard error from s and Σ(x − x̄)², and give the degrees of freedom.
- Test H₀: β₁ = 0 and build the 95% confidence interval for the slope.
- What F will the ANOVA table above these coefficients print, and what is its p?
- Work out the intercept and its standard error, then say why that row is rarely reported.
Worked solution
- Where the standard error comes from SE(b₁) = s / √Σ(x − x̄)² = 6.40 / √74.8 = 6.40 / 8.649 = 0.740 That matches the printed value, so the standard error depends on only two things: the scatter around the line, and how spread out the sleep hours are. Degrees of freedom are n − 2 = 40, because the line uses one for the slope and one for the intercept.
- The test and the interval t = b₁ / SE(b₁) = 1.86 / 0.74 = 2.51 2.51 > t*(40) = 2.021, so reject at α = .05; p = .016 CI: 1.86 ± 2.021(0.74) = 1.86 ± 1.50 = [0.36, 3.36] An extra hour of sleep goes with somewhere between 0.4 and 3.4 more exam points. The interval excludes zero, in agreement with the test, and that always happens: a 95% interval excludes zero exactly when the two-sided test rejects at .05. The interval is also the more useful result, because it shows that the data are compatible both with an effect too small to matter and with one large enough to change your habits.
- The ANOVA table above it F = t² = 2.5135² = 6.32 on (1, 40) p = .016, the same p With one predictor the F test and the t test are the same test, so the table adds nothing to the coefficient row. It becomes useful once the model has several predictors and the question is whether any of them matter.
- The intercept row b₀ = ȳ − b₁x̄ = 64.2 − 1.86(6.9) = 51.37 SE(b₀) = 6.40√(1/42 + 6.9²/74.8) = 6.40√0.6603 = 5.20 t(40) = 51.37 / 5.20 = 9.88, p < .001 The test is highly significant and of no use. The hypothesis it rejects is that a student who slept zero hours would score zero, and no student in the data slept anywhere near zero hours. SE(b₀) is far larger than SE(b₁) because the x̄²/Σ(x − x̄)² term dominates: reaching x = 0 means extending the line almost seven hours beyond the middle of the data. Center sleep hours first and that term vanishes. The intercept is then the predicted score at average sleep, and you can report that.
SE(b₁) = 0.740 on 40 df; t = 2.51, p = .016, 95% CI [0.36, 3.36]; F(1, 40) = 6.32 with the identical p; intercept 51.37 with SE 5.20, a large t for a hypothesis of no interest.
From §2.7 Inference for Regression · look the criticals up on the printed tables, and write the result with the APA formatter.
72Three more predictors, and adjusted R² falls
Exam-levelAn analyst fits job satisfaction on five predictors across 84 employees and gets R² = .31. A reviewer asks for three more controls. The bigger model returns R² = .33, and the analyst reports it as the better one.
- Model 1: n = 84, p = 5 predictors, R² = .31
- Model 2: n = 84, p = 8 predictors, R² = .33
- Critical values: F*(5, 78) = 2.33 and F*(8, 75) = 2.06 at α = .05
- Give the degrees of freedom for Model 1 and report its multiple correlation R.
- Compute the overall F for each model and decide both.
- Compute adjusted R² for each model. Which one does the evidence favor?
- The overall F for Model 2 is significant, yet none of its eight coefficients reaches .05. Explain how both can be true.
Worked solution
- Degrees of freedom and R df for every t and for s: n − p − 1 = 84 − 5 − 1 = 78 R = √R² = √.31 = .56 Five predictors plus an intercept make six estimated parameters, so the residual df is 84 − 6 = 78. R is the ordinary correlation between the observed satisfaction scores and the model's fitted values, so it cannot be negative, even when some of the five coefficients are.
- The overall F Model 1: F = (.31/5) / (.69/78) = .0620 / .008846 = 7.01 on (5, 78) 7.01 > 2.33, reject; p < .001 Model 2: F = (.33/8) / (.67/75) = .04125 / .008933 = 4.62 on (8, 75) 4.62 > 2.06, reject; p < .001 Both models are significantly better than an intercept-only model. The bigger one explains more variance but has the smaller F, because the F divides the explained share by p. The three extra predictors added only .02 to R² but raised the numerator df from 5 to 8.
- Adjusted R² adj R² = 1 − (1 − R²)(n − 1)/(n − p − 1) Model 1: 1 − (.69)(83/78) = 1 − .734 = .266 Model 2: 1 − (.67)(83/75) = 1 − .741 = .259 R² went up and adjusted R² went down. Plain R² cannot fall when a predictor is added, so it cannot tell you whether the bigger model is better. Adjusted R² subtracts a penalty for each predictor, and the three controls did not raise R² enough to offset their penalty, so report Model 1.
- A significant F with no significant coefficients Both can be true, because the two tests ask different questions. The F asks whether the eight predictors together explain more than chance, and they do. Each t asks whether its own predictor adds something the other seven do not already explain, and if the predictors overlap heavily, the answer for every one of them can be no. That is the classic sign of multicollinearity, so look next at the VIF column.
Model 1: df 78, R = .56, F(5, 78) = 7.01, adjusted R² = .266. Model 2: F(8, 75) = 4.62, adjusted R² = .259. R² rose and adjusted R² fell, so the three extra controls did not improve the model.
From §2.9 Multiple Regression · the criticals are on the printed tables, and the formulas on the formula sheet.
73Which way are you wrong?
Exam-levelThree studies each published a coefficient from a model that leaves out a variable everyone agrees belongs in it. None of the three teams can measure the missing variable, but each can still work out which way its coefficient is biased.
- A. Officers per thousand residents predicts recorded crime across 60 districts, coefficient positive. Missing: how much crime each district had before its policing level was set.
- B. Class size predicts test scores across 120 schools, coefficient small and negative. Missing: per-pupil funding.
- C. Treatment intensity predicts survival across 400 patients, coefficient −0.4. Missing: illness severity at admission.
- For study C only, a later audit measures severity: β₂ = −1.8 survival points per severity point, and δ = +0.6 severity points per unit of treatment intensity.
- For each study, give the sign of β₂ and the sign of δ, then the sign of the bias.
- Say whether each published coefficient is too high or too low, and write an accurate one-sentence conclusion for study A.
- Study C's audit gives you both numbers. Compute the bias and recover the controlled coefficient.
- One cell of the sign table is unused here. Invent a study that belongs in it.
Worked solution
- Two signs each E[b₁] = β₁ + β₂δ, where δ is the slope of the missing variable on the one you kept A. Prior crime raises recorded crime, so β₂ is positive. Districts with more prior crime were given more officers, so δ is positive. Bias is positive. B. Funding raises test scores, so β₂ is positive. Better-funded schools run smaller classes, so funding falls as class size rises and δ is negative. Bias is negative. C. Severity lowers survival, so β₂ is negative. Sicker patients receive more intensive treatment, so δ is positive. Bias is negative.
- Too high or too low A positive bias means the published number is too far in the positive direction, so study A's coefficient is too high. Studies B and C both have a negative bias, so both are too low, which for a negative coefficient means it overstates the harm. A sentence for study A: adding officers is associated with at most the reported rise in crime, and possibly with none of it, because districts were given officers in response to the crime they already had.
- Study C, with the audit in hand bias = β₂δ = (−1.8)(+0.6) = −1.08 controlled = naive − bias = −0.4 − (−1.08) = +0.68 Intensive treatment looked mildly harmful and is in fact mildly helpful. The sign reversed only because the sickest patients received the most treatment. This is called confounding by indication, and it is why an observational treatment effect needs a causal argument before it needs a p-value.
- The fourth cell The unused cell has both signs negative, which multiply to a positive bias. One example is commuting distance predicting job satisfaction, with hours worked left out. Long hours lower satisfaction, so β₂ is negative, and people who commute furthest tend to work shorter days, so δ is negative too. Negative times negative is positive, so the published commuting coefficient is too high, and a long commute lowers satisfaction more than reported. Any story where both links are negative will do. Each sign in the table is a claim about how the world works, and inventing an example makes you argue for both.
A: (+)(+), positive bias, too high. B: (+)(−), negative bias, too low. C: (−)(+), negative bias, too low; the audit gives a bias of −1.08, so the controlled coefficient is +0.68 and the sign reverses.
From §2.9 Multiple Regression · whether a variable belongs in the model at all is §3.12 Causal DAGs & Confounding.
🎲 Advanced · Modern methods
Thirteen problems from the Stats 3 syllabus. They cover updating a belief with Bayes' rule, separating sensitivity from bias, reading a survival curve that never reaches zero, and choosing between models that all fit. Four are on latent variables, from a one-factor measurement model worked by hand to a rotated two-factor solution with a cross-loading to diagnose. The last two run one binomial count through a grid of hypotheses and then through its conjugate shortcut.
74A very good test for a very rare disease
Exam-levelA screening program offers a blood test for a condition that affects 8 people in every 1,000. A patient tests positive and is told the test is "95% accurate". She would like to know what that means for her.
- Prevalence: 0.8% of the screened population
- Sensitivity: 95% of people with the condition test positive
- Specificity: 92% of people without it test negative
- Build the natural-frequency table for 100,000 screened people.
- What is the probability she has the condition, given the positive result?
- She takes a second, independent test and it is also positive. Now what?
- What is the probability that someone who tests negative is clear?
- Why does a 95% sensitivity feel so much more reassuring than the answer to question 2?
Worked solution
- Natural frequencies, 100,000 people
800 × .95 = 760 true positives 99,200 × .08 = 7,936 false positives Counting people instead of manipulating probabilities is the most reliable way to get this right, and it makes the answer easy to see.Test positive Test negative Total Has the condition 760 40 800 Does not have it 7,936 91,264 99,200 Total 8,696 91,304 100,000 - The answer she wants P(condition | positive) = 760 / 8,696 = .0874 About 9%. Of every 100 positive results, roughly 91 are false alarms. The test is performing as its specificity says it should. The problem is that 8% of a very large healthy group outnumbers 95% of a very small sick one.
- A second positive posterior odds = prior odds × likelihood ratio LR⁺ = sensitivity / (1 − specificity) = .95 / .08 = 11.875 prior odds = .008 / .992 = .00806 after one positive: .00806 × 11.875 = .0958 → P = .0958/1.0958 = .0874 ✓ after two positives: .0958 × 11.875 = 1.1372 → P = 1.1372/2.1372 = .532 The first test moved her from 0.8% to 8.7%, and the second from 8.7% to 53%. The posterior after the first test is the prior for the second, and in odds form each update is a single multiplication. The calculation depends on the word "independent": if both tests share a systematic quirk, for instance both cross-reacting with the same protein, the second result adds far less than this calculation assumes.
- A negative result P(clear | negative) = 91,264 / 91,304 = .9996 99.96%. When the condition is rare, a negative result is extremely informative and a positive one barely is. Screening tests are usually built this way on purpose, because the positives get followed up and the negatives get sent home.
- Why the intuition fails Sensitivity answers "if you are sick, will the test say so?" She is asking the reverse: "the test said so, am I sick?" The two conditional probabilities are equal only when the share of people who test positive equals the share who have the condition. Here 8.7% test positive and 0.8% have the condition. Confusing the two is base-rate neglect, and experts make the mistake too. In studies of medical decision-making, many doctors given questions like this one get them wrong until the numbers are presented as counts of people.
A single positive leaves her at about 9%, two independent positives at 53%, and a negative result clears her with 99.96% probability. Nothing is wrong with the test; the low base rate explains the result.
From §3.7 Bayesian Thinking · the same 2 × 2 is the confusion matrix in §5.4 of the ML course.
75Updating what last quarter told you
Exam-levelA team redesigns the onboarding flow in an app. Last quarter's version had a completion rate they summarize as a Beta(8, 12) prior. The new flow goes out to 60 users and 33 of them finish onboarding.
- Prior: θ ~ Beta(8, 12)
- Data: 33 completions out of 60 users
- For a Beta(a, b): mean = a/(a+b), mode = (a−1)/(a+b−2), SD = √[ab / ((a+b)²(a+b+1))]
- Software reports a 95% central credible interval of [.404, .621]
- Write down the posterior distribution.
- Compute its mean, mode and standard deviation.
- The observed completion rate is .55, but the posterior mean is lower. Why?
- Approximate P(θ > .50 | data), and write the credible interval as a sentence.
Worked solution
- The update Beta(a, b) prior + k successes in n trials → Beta(a + k, b + n − k) = Beta(8 + 33, 12 + 27) = Beta(41, 39) The Beta is conjugate to the binomial, so the update is addition, not integration. A Beta(a, b) prior counts as a + b − 2 pretend observations, so this one has the weight of 18 previous users.
- Summarizing the posterior mean = 41 / 80 = .5125 mode = 40 / 78 = .5128 SD = √[(41 × 39) / (80² × 81)] = √(1599 / 518400) = √.003085 = .0555 Mean and mode agree to three decimals because the posterior is nearly symmetric at these values. They differ more when a or b is small.
- Why .5125 and not .55 The prior mean was 8/20 = .40, and the prior added 18 pseudo-observations to a dataset of 60. The posterior mean falls between the two, pulled toward the prior in proportion to how much evidence each side contributes. With a flat Beta(1, 1) prior instead, the posterior would be Beta(34, 28) with mean .548, essentially the raw .55. The arithmetic cannot tell you which answer is right. If last quarter's users are informative about this quarter's, the shrinkage toward .40 is justified; if they are not, that prior should not have been used.
- P(θ > .50) and the interval z = (.50 − .5125) / .0555 = −.225 P(θ > .50) ≈ 1 − Φ(−.225) = .589 The exact posterior probability is .5889, so the normal approximation works here. There is about a 59% chance that the new flow's completion rate is above .50, a much more accurate summary than "33 out of 60 is over half". The interval in words: given the prior and these 60 users, there is a 95% probability that the true completion rate lies between .404 and .621. That sentence is correct for a credible interval but not for a confidence interval, and that difference is much of the reason people use Bayesian methods.
- What to tell the team The interval spans .404 to .621, so the data do not yet distinguish a mild improvement from a mild regression. 60 users is not enough. Rerun the numbers after a few hundred users and the interval will be much narrower.
Posterior Beta(41, 39): mean .5125, mode .5128, SD .0555. The prior's 18 pseudo-observations pull the estimate below the observed .55, and P(θ > .50) is about .59.
From §3.8 Bayesian Estimation, building on §3.7.
76Who is the better witness?
Exam-levelIn a recognition-memory experiment each participant studies 40 words, then sees those 40 mixed with 40 new ones and says "old" or "new" to each. Three participants produce very different response patterns.
| Participant | Hits | False alarms |
|---|---|---|
| A | 34 | 12 |
| B | 40 | 8 |
| C | 38 | 20 |
- Compute d′ and c for participant A. Is A liberal or conservative?
- Compute β and the area under A's ROC curve.
- Do the same for participant C, then compare both participants' percent correct.
- Participant B recognized every old word. Why does the formula break, and what is the standard fix?
Worked solution
- Participant A H = 34/40 = .85 FA = 12/40 = .30 d′ = z(H) − z(FA) = 1.036 − (−0.524) = 1.56 c = −[z(H) + z(FA)] / 2 = −[1.036 − 0.524] / 2 = −0.26 A negative c is a liberal criterion: A says "old" more readily than a neutral observer would, so A gets more hits but also more false alarms.
- Bias as a likelihood ratio, and the ROC area β = ec·d′ = e(−0.256)(1.561) = e−0.400 = 0.67 AUC = Φ(d′/√2) = Φ(1.561 / 1.414) = Φ(1.104) = .865 β below 1 means the same as a negative c: at A's criterion the evidence is still less likely under "old" than under "new", yet A responds "old". The AUC of .865 summarizes sensitivity free of bias: an observer with A's sensitivity would have the same AUC at any criterion.
- Participant C, and the percent-correct trap H = 38/40 = .95 FA = 20/40 = .50 d′ = 1.645 − 0.000 = 1.64 c = −[1.645 + 0]/2 = −0.82 A's percent correct = (34 + 28)/80 = .775 C's percent correct = (38 + 20)/80 = .725 C scores five points worse on percent correct but has slightly higher sensitivity, 1.64 against 1.56. The difference comes from strategy: C is far more liberal (c = −0.82) and gets a near-perfect hit rate at the cost of 20 false alarms. Percent correct combines skill and strategy into one number, so you cannot tell which one changed. Report d′ and c separately for that reason. Likewise, a claim that a memory drug "improves recognition" tells you nothing until you also know how often it produced false alarms.
- Participant B and the ceiling H = 40/40 = 1.00, and z(1) is infinite, so d′ cannot be computed. The standard fix is the log-linear correction: add 0.5 to every cell count and 1 to every trial total, for every participant, not only the one at the ceiling. H = (40 + 0.5)/(40 + 1) = 40.5/41 = .988 FA = (8 + 0.5)/41 = 8.5/41 = .207 d′ = 2.251 − (−0.816) = 3.07 c = −[2.251 − 0.816]/2 = −0.72 Applying the correction to everyone keeps the estimates comparable; correcting only the extreme participant would bias that person's estimate relative to the rest. Name the rule you used in the methods section, and treat a d′ above 3 with some caution, because rates this close to the ceiling make the estimate unstable.
A: d′ = 1.56, c = −0.26, β = 0.67, AUC = .865. C: d′ = 1.64 with a much more liberal c = −0.82, so C has the higher sensitivity but, because of that bias, the lower percent correct. B needs the log-linear correction, giving d′ = 3.07.
From §3.20 Signal Detection Theory · the ROC half of it is §5.5 in ML & AI.
77Reading a psychometric function
StretchIn a temporal bisection task, listeners learn a short anchor of 200 ms and a long anchor of 800 ms, then judge probe tones as "short" or "long". A logistic regression of the "long" response on probe duration is fitted separately for quiet and loud probes.
| Condition | b₀ | b₁ (per ms) |
|---|---|---|
| Quiet probe (baseline) | −3.60 | 0.0090 |
| Loud probe | −2.94 | 0.0084 |
- Compute the PSE and JND in each condition.
- Compute the Weber fraction for each.
- Confirm the baseline JND by locating the 25% and 75% points directly.
- Is this a shift, a slope change, or both? What does it mean psychologically?
- The baseline PSE is not 500 ms. Should it be?
Worked solution
- PSE and JND quiet: PSE = 3.60 / 0.0090 = 400.0 ms quiet: JND = 1.0986 / 0.0090 = 122.1 ms loud: PSE = 2.94 / 0.0084 = 350.0 ms loud: JND = 1.0986 / 0.0084 = 130.8 ms The PSE is where the fitted curve crosses 50%, so it is the duration that feels exactly midway between the anchors. The JND is half the distance between the 25% and 75% points. It measures the curve's steepness in milliseconds: the smaller the JND, the steeper the curve.
- Weber fractions quiet: 122.1 / 400.0 = .305 loud: 130.8 / 350.0 = .374 Dividing the JND by the PSE makes the two conditions comparable, even though their PSEs are at different points on the duration axis.
- Checking the JND from the curve 75% point: b₀ + b₁x = ln 3 → x = (1.0986 + 3.60)/0.0090 = 522.1 ms 25% point: b₀ + b₁x = −ln 3 → x = (−1.0986 + 3.60)/0.0090 = 277.9 ms half the span = (522.1 − 277.9)/2 = 122.1 ms ✓ The ln 3 shortcut comes straight from the logistic: at 75% the odds are 3 to 1, so the linear predictor equals ln 3.
- Shift or slope Mostly a shift. The PSE drops by 50 ms while the JND rises by only 8.7 ms, so the curve moved left without flattening much. Louder probes are judged longer, which is a bias in perceived duration, not a loss of timing precision. If the JND had doubled with the PSE unchanged, the finding would have been the opposite kind: the same subjective midpoint, judged less precisely. In a regression the two are separate terms. The condition main effect tests the shift, and the condition × duration interaction tests the slope change.
- 400 rather than 500 500 ms is the arithmetic midpoint of 200 and 800. 400 ms is their geometric mean, √(200 × 800), and bisection points near the geometric mean are a standard finding in timing research. It suggests the internal scale for duration is compressive, so the subjective middle is below the arithmetic one, and a PSE of 400 is the expected result.
Quiet: PSE 400.0 ms, JND 122.1 ms, Weber .305. Loud: PSE 350.0 ms, JND 130.8 ms, Weber .374. A 50 ms leftward shift with almost no change in slope, so louder tones feel longer without being harder to time.
From §3.19 Psychometric Functions · the fitting machinery is §2.16 Logistic Regression.
78Pick the family before you fit
Warm-upA hospital analytics team has five questions and one statistician. Each outcome needs a GLM family and a link before the data are analyzed.
- a. Number of migraine attacks per patient per month, with many zeros
- b. Whether a patient was readmitted within 30 days
- c. Total cost of an admission in euros, strictly positive and heavily right-skewed
- d. Number of items recalled out of a fixed list of 20 on a cognitive screen
- e. Systolic blood pressure in mmHg, roughly symmetric
- Give the family and link for each of the five outcomes.
- For each, say what exponentiating a coefficient gives you.
- Interpret b₁ from the migraine model, and give both group rates.
- Check that model for overdispersion, and say what to do about it.
Worked solution
- Families and links
Two need a closer look. Outcome (d) looks like a count but has a known ceiling of 20, so it is a binomial proportion, not a Poisson count. Ordinary regression on the raw proportion could predict recall of 23 items. Outcome (c) is the classic case for Gamma: costs cannot be negative, and their variance grows with their mean. The Gamma family assumes that relationship between mean and variance.Outcome Family · link eb means a. Attacks per month Poisson · log (negative binomial if overdispersed) Rate ratio b. Readmitted yes/no Binomial · logit Odds ratio c. Cost in euros Gamma · log Multiplicative change in mean cost d. Recalled out of 20 Binomial · logit, as successes out of 20 Odds ratio per item e. Blood pressure Gaussian · identity (ordinary regression) Nothing; read b directly - Interpreting the drug coefficient rate ratio = eb₁ = e−0.51 = 0.60 placebo rate = eb₀ = e0.92 = 2.51 attacks per month drug rate = eb₀ + b₁ = e0.41 = 1.51 attacks per month check: 2.51 × 0.60 = 1.51 ✓ The drug multiplies the attack rate by 0.60, a reduction of about 40%. Coefficients add on the log scale and multiply on the count scale, as odds ratios do in logistic regression.
- Overdispersion deviance / df = 412.6 / 178 = 2.32 A Poisson model assumes the variance equals the mean, which puts this ratio near 1. At 2.32 the counts vary more than twice as much as Poisson allows, so the standard errors and the p-values are too small. Migraine counts cluster within people, so this is expected. Refit as a negative binomial, which adds a dispersion parameter, or use quasi-Poisson to rescale the standard errors. The rate ratio will barely change, and its confidence interval will widen, as it should.
Poisson-log, binomial-logit, Gamma-log, binomial-logit again, and plain Gaussian. The drug cuts the attack rate from 2.51 to 1.51 per month, a rate ratio of 0.60. But a deviance-to-df ratio of 2.32 means the Poisson standard errors are not trustworthy until the model is refitted as negative binomial.
From §3.9 Generalized Linear Models · the logit branch is §2.16.
79The curve that never reaches zero
Exam-levelTen patients enter a two-year follow-up study after treatment. The outcome is time to relapse in months. A plus sign marks a patient who was still relapse-free when the study or their participation ended.
- Build the Kaplan–Meier table: event times, number at risk, events, and S(t).
- Estimate S(12) and S(15).
- What is the median survival time?
- Two colleagues suggest averaging the times instead. Compute both of their averages and say what is wrong with each.
- Why does the curve stop at a positive value?
Worked solution
- The Kaplan–Meier table
S(t) = Π (1 − dⱼ / nⱼ) over all event times up to t
Censored patients count in the at-risk column until the moment they leave, and then drop out of it. So the at-risk number falls with both events and censorings: only 4 people are at risk at month 14, although 6 have no recorded relapse by then.t At risk Events 1 − d/n S(t) 3 10 1 .900 .9000 5+ 9 0 censored .9000 7 8 1 .875 .7875 9 7 2 .714 .5625 12+ 5 0 censored .5625 14 4 1 .750 .4219 18+ 3 0 censored .4219 20 2 1 .500 .2109 24+ 1 0 censored .2109 - Two readings off the curve S(12) = .5625 S(15) = .4219 Only a censoring happens at month 12, so the curve is flat there and S(12) is still the value from month 9. The curve steps down only at event times.
- Median survival The median is the first time at which S(t) drops to .50 or below. At month 9 the curve is at .5625, still above half. At month 14 it reaches .4219. Median survival = 14 months. Read it off the vertical axis at 0.5 and drop to the horizontal one; do not average the observed times.
- The two bad averages all ten times: (3+5+7+9+9+12+14+18+20+24)/10 = 121/10 = 12.1 months events only: (3+7+9+9+14+20)/6 = 62/6 = 10.3 months The first treats every censored time as though the patient relapsed at that moment, which understates survival, since we know only that they lasted at least that long. The second is worse: dropping the censored cases removes the people who were doing well, so the average falls from 12.1 to 10.3, further from the truth. The Kaplan–Meier median of 14 months is above both, because it is the only one of the three that uses the censored patients' partial information.
- Why it stops at .2109 The longest observation, at 24 months, is censored. The curve has no information about what happens after that point, so it stops there and does not assume that everyone eventually relapses. Estimates from the tail of a survival curve rest on very few people, so when a curve ends with 1 or 2 patients at risk, read its confidence band as well as the line.
S steps to .9000, .7875, .5625, .4219 and .2109, giving a median survival of 14 months and S(12) = .5625, S(15) = .4219. Both naive averages (12.1 and 10.3 months) understate survival, and the curve ends at .2109 because the last patient was censored.
From §3.16 Survival Analysis.
80Four models, one dataset
StretchWorking with the same 120 students from Problem 63, an analyst fits four nested models of exam performance and asks which one to report. The most complex model has the best log-likelihood, but she suspects that does not make it the best choice.
| Model | Predictors | k | ln L |
|---|---|---|---|
| M1 | study | 3 | −455.2 |
| M2 | study + sleep | 4 | −449.8 |
| M3 | study + sleep + motivation | 5 | −449.1 |
| M4 | M3 plus all two-way interactions | 8 | −447.3 |
- Compute AIC for all four models and rank them.
- Compute ΔAIC and interpret the spread with the usual rules of thumb.
- Compute the Akaike weights for M2 and M3, and the evidence ratio between them.
- M3 adds one parameter to M2. Run the likelihood-ratio test.
- M4 fits best. Why does it lose? And would BIC agree with AIC here?
Worked solution
- AIC for each model M1: −2(−455.2) + 2(3) = 910.4 + 6 = 916.4 M2: −2(−449.8) + 2(4) = 899.6 + 8 = 907.6 M3: −2(−449.1) + 2(5) = 898.2 + 10 = 908.2 M4: −2(−447.3) + 2(8) = 894.6 + 16 = 910.6 Ranking, best first: M2, M3, M4, M1. Lower is better, and the numbers themselves mean nothing in isolation. Only differences between models fitted to the same data are interpretable.
- ΔAIC ΔM2 = 0.0 ΔM3 = 0.6 ΔM4 = 3.0 ΔM1 = 8.8 The common reading: Δ (delta, the gap from the best model) under about 2 means the models are effectively indistinguishable, 4 to 7 means considerably less support, and above 10 means essentially none. So M2 and M3 are tied, M4 is behind but not ruled out, and M1 is clearly worse. This dataset cannot separate M2 from M3.
- Akaike weights and the evidence ratio relative likelihood = e−Δ/2 M1: e−4.4 = 0.012 M2: e0 = 1.000 M3: e−0.3 = 0.741 M4: e−1.5 = 0.223 sum = 1.976 w(M2) = 1.000/1.976 = .506 w(M3) = 0.741/1.976 = .375 evidence ratio = .506/.375 = 1.35 = e0.3 M2 is 1.35 times better supported than M3, barely more than even. By comparison, M2 is e4.4 = 81 times better supported than M1.
- The nested test χ² = 2(ln L₃ − ln L₂) = 2(−449.1 + 449.8) = 2(0.7) = 1.4 df = 5 − 4 = 1, p = .24 Adding motivation does not improve the fit significantly. The likelihood-ratio test and AIC agree here. With one extra parameter they disagree only when χ² falls between 2, AIC's penalty, and 3.84, the χ² critical value at df = 1. As models grow, they can disagree in either direction.
- Why the best fit loses, and what BIC says BIC: M1 924.8 M2 918.7 M3 922.1 M4 932.9 M4's log-likelihood is the highest because adding parameters can never make in-sample fit worse: setting a new coefficient to zero is always possible, so the fit can only improve or stay the same. AIC adds a penalty of 2 per parameter for this reason, and M4's four extra parameters raised the log-likelihood by only 2.5, not enough to cover it. BIC also picks M2, by a wider margin, because its penalty of ln 120 = 4.79 per parameter is more than twice AIC's. When the two criteria disagree, it usually means a moderately sized effect is borderline: AIC keeps it and BIC drops it. To settle M2 against M3 you need new data, or cross-validation on the data at hand.
AIC = 916.4, 907.6, 908.2 and 910.6, so M2 is best, with M3 only ΔAIC = 0.6 behind: an evidence ratio of 1.35, which does not separate them. The likelihood-ratio test agrees that adding motivation does not improve the fit (χ²(1) = 1.4, p = .24), and BIC picks M2 more decisively.
From §2.14 Model Comparison · the held-out version is §3.11 Cross-Validation.
81Three items, one factor, and what is left over
Exam-levelA short wellbeing scale has three items. A one-factor solution reports loadings of .80, .60 and .50, and the paper prints the observed correlations beside them. Decide whether one factor accounts for the observed correlations.
r12 = .45 · r13 = .38 · r23 = .34
Formulas σij = βiβj · σii = βi² + ψii, with every item standardized so σii = 1
- Give the correlation the model implies for each of the three pairs.
- Give each item's communality and uniqueness, and check them against the split.
- Form the residuals and name the largest one.
- Suppose β1 were wrong. What value would reproduce r12 exactly, and what does it do to the other two residuals?
- What share of the three items' variance does the single factor account for?
Worked solution
- The implied correlations σ12 = .80 × .60 = .48 σ13 = .80 × .50 = .40 σ23 = .60 × .50 = .30 Multiply the two loadings. Nothing else in the model connects one item to another, so the three loadings alone determine all three correlations.
- Communality and uniqueness h² = .80² = .64, .60² = .36, .50² = .25 ψ = 1 − h² = .36, .64, .75 Each pair adds to 1, because every standardized item has a variance of 1. Items 2 and 3 are the ones to notice: the factor explains about a third of item 2's variance and a quarter of item 3's, so most of what each one measures is its own.
- The residuals pair 1,2: .45 − .48 = −.03 pair 1,3: .38 − .40 = −.02 pair 2,3: .34 − .30 = +.04 The largest is +.04 between items 2 and 3: they correlate a little more than a single shared factor can account for. Every residual is under the .05 that usually prompts a second look, so one factor reproduces this matrix well.
- Refitting one loading β1 = r12 ÷ β2 = .45 ÷ .60 = .75 then σ13 = .75 × .50 = .375, residual +.005 σ23 = .30 still, residual +.04 still Two of the three residuals improve, because β1 appears in two of the three products. The third does not change, since item 1's loading is not in it. In general, only a loading that appears in a residual's product can reduce it. So a residual that stays large between two particular items tells you about those two items, not about the solution as a whole. Item 1's communality would fall to .5625 and its uniqueness rise to .4375.
- Variance accounted for Σh² = .64 + .36 + .25 = 1.25 1.25 ÷ 3 = .417 The factor accounts for 41.7% of the three items' standardized variance. The numerator, 1.25, is the sum of squared loadings on the factor, and that sum is the factor's eigenvalue. So an eigenvalue tells you how many items' worth of variance the factor accounts for, and the usual threshold of 1 is the variance of a single standardized item.
Implied .48, .40 and .30; communalities .64, .36 and .25 against uniquenesses .36, .64 and .75; residuals −.03, −.02 and +.04, the largest between items 2 and 3. A β1 of .75 would reproduce r12 exactly and leave the 2,3 residual untouched. The factor accounts for Σh² ÷ 3 = 41.7% of the three items' variance.
From §3.5 Factor Analysis / PCA · the lesson's Loadings In, Correlations Out widget does the same arithmetic on four items, with the residual grid drawn for you.
82The scale that got more reliable by getting longer
Warm-upA six-item scale is piloted. Every item turns out to have a variance of 1.20, and every pair of items covaries 0.42. A colleague proposes writing six more items of exactly the same quality and reporting the twelve-item scale instead.
- Work out the variance of the six-item total score.
- Compute α.
- Compute α for the twelve-item version, and check it against Spearman-Brown.
- What is the average correlation between these items, and what does it say about the two α values?
Worked solution
- The total-score variance σ²total = kσii + k(k − 1)σij = 6(1.20) + 6(5)(0.42) = 7.20 + 12.60 = 19.80 A total score's variance is the sum of every item variance and every covariance between items, and a six-item scale has 6 × 5 = 30 ordered pairs. The covariances contribute 12.60 of the 19.80, and that shared part is what α measures.
- Alpha on six items α = (6 ÷ 5)(1 − 7.20 ÷ 19.80) = 1.200 × (1 − .3636) = 1.200 × .6364 = .764 Just above the conventional .70 minimum, so acceptable but not high.
- Alpha on twelve items, two ways σ²total = 12(1.20) + 12(11)(0.42) = 14.40 + 55.44 = 69.84 α = (12 ÷ 11)(1 − 14.40 ÷ 69.84) = 1.0909 × .7938 = .866 Spearman-Brown: 2(.7636) ÷ (1 + .7636) = 1.5273 ÷ 1.7636 = .866 The two routes agree exactly, because Spearman-Brown assumes the added items are of the same quality as the originals, and here they are. Twenty-four items of the same quality would give .928 by either route.
- What the items are actually like average r = σij ÷ σii = 0.42 ÷ 1.20 = .35 The items correlate .35 with each other at every length. The measurement did not improve between .76 and .87: the colleague gained a tenth of a reliability coefficient by adding six more questions, which costs respondents time and nothing else. In a write-up, report α together with k, because α depends on the number of items as well as on the items themselves. The same .35 items would give .68 at four items and .93 at twenty-four.
σ²total = 19.80 and α = .76 on six items; 69.84 and α = .87 on twelve, as Spearman-Brown predicts for doubling. The average inter-item correlation is .35 in both cases, so the gain comes from scale length, not better items.
From §3.5 Factor Analysis / PCA · the reliability side is Methods §1.3 Reliability & Validity.
83Three factors came out, and one of them is noise
Exam-levelSix items from a workplace questionnaire are put through maximum likelihood extraction, and the software is asked for three factors. The unrotated loading matrix is below. The analyst now has to decide how many of the three to keep, and whether the solution fits.
i2 .74 .10 −.18
i3 .70 .22 .12
i4 .25 .76 .19
i5 .20 .72 −.15
i6 .18 .68 .10 Also given One factor: χ² = 21.80 · two factors: χ² = 3.42 · df = ((p − m)² − (p + m)) ÷ 2
- Compute each factor's eigenvalue, and say in words what the number means.
- Apply the Kaiser criterion. How much of the total variance do the factors you keep explain?
- Give the communality and uniqueness of i1 and of i4 over the retained factors.
- Work out the degrees of freedom for one, two and three factors, and use the two χ² values to decide how many factors the fit test supports. Why is the three-factor model untestable?
Worked solution
- Eigenvalues: sum the squared loadings down each column F1: .78² + .74² + .70² + .25² + .20² + .18² = .6084 + .5476 + .4900 + .0625 + .0400 + .0324 = 1.781 F2: .15² + .10² + .22² + .76² + .72² + .68² = 1.639 F3: .21² + .18² + .12² + .19² + .15² + .10² = 0.1595 Each squared loading is the share of that item's variance the factor explains, so the column total counts how many whole items' worth of variance the factor accounts for. That is about one and three quarters for F1, about one and two thirds for F2, and about a sixth of one item for F3.
- Kaiser: keep an eigenvalue above 1 1.781 > 1 and 1.639 > 1, but 0.1595 < 1 kept variance = 1.781 + 1.639 = 3.420 of 6 items = 57.0% Each standardized item has one unit of variance, so a factor below 1 explains less than a single item and is usually dropped. F3 is far below 1. Keeping it would add only 0.1595 (2.7 percentage points, taking the total to 59.7%) for a factor on which no item loads above .21.
- Communalities over the retained factors i1: h² = .78² + .15² = .6084 + .0225 = .631, so ψ = 1 − .631 = .369 i4: h² = .25² + .76² = .0625 + .5776 = .640, so ψ = .360 Read across the row, not down the column, and stop at the factors you kept. The two retained factors account for 63% of i1 and 64% of i4, which is adequate. The discarded third column would have added only .044 to i1 and .036 to i4.
- The fit test m = 1: ((6 − 1)² − 7) ÷ 2 = (25 − 7) ÷ 2 = 9 m = 2: ((6 − 2)² − 8) ÷ 2 = (16 − 8) ÷ 2 = 4 m = 3: ((6 − 3)² − 9) ÷ 2 = (9 − 9) ÷ 2 = 0 χ²(9) = 21.80, p = .010 → reject: one factor is not enough χ²(4) = 3.42, p = .490 → retain: two factors reproduce the correlations Here the null hypothesis says the model is adequate, so rejecting it is the bad outcome, and the two-factor result is the one you want. Three factors have zero degrees of freedom: the model would have exactly as many parameters as the correlation matrix has numbers, so it reproduces the matrix perfectly and there is nothing left to test. Kaiser and the fit test both point to two factors.
Eigenvalues 1.78, 1.64 and 0.16; Kaiser keeps the first two, explaining 57.0% of the total variance. i1 has h² = .63 and ψ = .37; i4 has h² = .64 and ψ = .36. The df run 9, 4 and 0, and the fit test rejects one factor (p = .010) but not two (p = .490), so keep two factors. Three cannot be tested because a zero-df model always fits.
From §3.5 Factor Analysis / PCA · check the p-values on the tables tool.
84The item that belongs to both factors
Exam-levelA seven-item scale is extracted as two factors and rotated with direct oblimin. The factors correlate .48. The pattern matrix is below; the structure matrix has been left for you to work out. Items i1 to i4 were written as autonomy items and i5 to i7 as competence items.
i2 .77 −.02
i3 .74 .09
i4 .69 .11
i5 .05 .79
i6 .11 .71
i7 .44 .41 Also given Φ12 = .48 · threshold .32 · structure = pattern combined with Φ, so si1 = pi1 + .48pi2 · h² = p₁² + p₂² + 2(.48)p₁p₂
- Using the pattern matrix and a .32 threshold, say which items define each factor.
- Work out the structure matrix for i1, i5 and i7, and count how many items look like cross-loadings there. Which table should be interpreted, and why?
- Apply the two-part cross-loading rule. Which item cross-loads, and which item only looks as though it might?
- Compute h² for i7 two ways: by squaring and adding its pattern coefficients, and properly. Then choose a remedy for the cross-loading and justify the order you reached it in.
Worked solution
- Reading the pattern matrix factor 1: i1 (.81), i2 (.77), i3 (.74), i4 (.69) factor 2: i5 (.79), i6 (.71) i7 loads .44 and .41, over the threshold on both Six of the seven items load on exactly one factor, which is close to the simple structure that rotation aims for. The item content gives the names: factor 1 is autonomy and factor 2 is competence.
- The structure matrix, and the trap in it i1: .81 + .48(.04) = .83 and .04 + .48(.81) = .43 i5: .05 + .48(.79) = .43 and .79 + .48(.05) = .81 i7: .44 + .48(.41) = .64 and .41 + .48(.44) = .62 All seven items exceed .32 on both structure columns, so the structure matrix makes every item look like a cross-loading. Nothing is wrong with the solution. A structure coefficient is a plain correlation between item and factor, and when the factors correlate .48, an autonomy item will also correlate moderately with competence. Interpret the pattern matrix, which gives each factor's own contribution with the other held constant. Reading the structure matrix instead is the classic error with an oblique solution.
- The cross-loading rule, both parts i7: .44 and .41, both ≥ .32, and |.44 − .41| = .03, well inside .20 → cross-loading i4: .69 and .11, only one past the threshold → not a cross-loading The second half of the rule is the one most often forgotten. An item reading .69 and .40 would be over the threshold twice and still be a factor-1 item with a secondary loading, because the two are .29 apart. i7 is a true cross-loading: its two loadings are only .03 apart, so it identifies neither construct.
- i7's communality, and what to do about it squaring and adding: .44² + .41² = .1936 + .1681 = .362 (wrong) properly: .1936 + .1681 + 2(.48)(.44)(.41) = .3617 + .1732 = .535 Squaring and adding works only when the factors are uncorrelated. Here it leaves out the overlap between the two factors and understates the communality by .17. So i7 is not a weak item. The factors explain it well, but it measures both constructs at once, which points to a wording problem, not to noise. Take the remedies in order. The first is to change the number of factors, but the two factors are clean and match the theory, so there is no candidate for a third. The second is a different rotation, and that has already been tried: this is the oblique solution, and forcing the factors to be orthogonal would only make i7's cross-loading worse. The third is to drop i7, which is right here, provided the write-up says so. Then check what is left: factor 2 falls to i5 and i6, two indicators, below the three each factor needs to be stable. So the report should drop i7 for this analysis and say that the competence subscale needs more items before it can be trusted.
Factor 1 is i1 to i4, factor 2 is i5 and i6, and i7 cross-loads (.44 and .41, both past .32 and .03 apart). All seven items exceed .32 on both structure columns, so interpret the pattern matrix. i7's communality is .535 rather than the .362 that squaring and adding gives. Drop i7, and report that factor 2 is then down to two indicators and needs more items.
From §3.5 Factor Analysis / PCA · the reliability angle is Methods §1.3 Reliability & Validity.
85Nine hypotheses and a packet of seeds
Exam-levelA seed packet gives no germination rate, so a grower sows twenty seeds and counts how many come up. Thirteen do. She writes down nine candidate rates and updates all nine at once, using Bayes' rule as a table.
.2 0.0000133 .5 0.0739288 .8 0.0545499
.3 0.0010178 .6 0.1658823 .9 0.0019705
- Complete the product and posterior columns. What is the total of the product column called, and what is its value here?
- Which hypothesis is the most probable, and what is the posterior mean?
- Build the smallest region holding at least 95% of the posterior. Name the hypotheses in it, its endpoints, and the probability it actually holds.
- A classmate writes "95% credible region: .5 to .8". Say in one sentence what is wrong with that.
Worked solution
- The product column, and the total that normalizes it product = prior × likelihood = likelihood ÷ 9 in every row total of the likelihood column = .4761876, so the product column totals .4761876 ÷ 9 = .0529097 posterior = product ÷ .0529097, which is the same as likelihood ÷ .4761876 .0000 .0000 .0021 .0306 .1553 .3484 .3450 .1146 .0041 That total is the marginal likelihood, also called the evidence. It is the probability of 13 of 20 before the rate is known, with each candidate contributing in proportion to its prior. A flat prior makes the arithmetic shorter than it looks: dividing every row by 9 and then normalizing gives the same posterior as normalizing the likelihoods directly. Check that your posterior column sums to 1 before going on.
- Most probable hypothesis and posterior mean largest posterior: p = .6 at .3484, with .7 close behind at .3450 mean = .5(.1553) + .6(.3484) + .7(.3450) + .8(.1146) + smaller terms = .6364 Twenty seeds cannot separate .6 from .7, and the table shows this by putting almost the same probability on both. The mean is between them and slightly below the observed 13/20 = .65, pulled down by the flat prior's weight on the low candidates.
- The smallest region holding 95% take in descending order of mass: .6 (.3484), .7 (.6933), .5 (.8486), .8 (.9631) four hypotheses clear the target, so the region is p = .5, .6, .7, .8 endpoints .5 and .8 · mass carried = 96.3% Three hypotheses hold only 84.9%, so a fourth is needed. A flat prior times a binomial likelihood has a single peak, so the hypotheses you take are always neighbors and the region is a single range.
- What is wrong with calling it 95% The region holds 96.3%, not 95%. A posterior spread over nine separate values cannot be cut at an exact percentage, because each hypothesis is either in the region or out of it. Report the probability the region actually holds, as in "the smallest 95% region runs from .5 to .8 and holds 96.3% of the posterior". The overshoot shrinks as the grid gets finer, but it never disappears.
The product column totals .0529097, the marginal likelihood. The posterior runs .0000, .0000, .0021, .0306, .1553, .3484, .3450, .1146, .0041; the most probable hypothesis is .6 and the posterior mean is .6364. The smallest region reaching 95% is p = .5 to .8, which holds 96.3%, and 96.3% is the number to report.
From §3.7 Bayesian Thinking and §3.8 Bayesian Estimation · check it on the grid widget.
86The same seeds, without the table
Exam-levelNow run the same twenty seeds, thirteen of which germinated, through the shortcut instead of the grid. A Beta prior combined with a binomial likelihood gives a Beta posterior. It is the one case in this course where the posterior can be written down directly.
- A flat prior is Beta(1, 1). Write the posterior in Beta form, and give its mean, mode and standard deviation.
- Give the central 95% credible interval, and say why it is a different object from the .5-to-.8 region of the previous problem.
- A colleague reran it with a Beta(6, 4) prior. Give the new posterior, say how many trials that prior was worth, and describe what it did to the estimate and to the interval.
- Why do the grid and the Beta route agree on all nine hypotheses? Name a situation in which the shortcut is not available at all.
Worked solution
- The update is addition Beta(1, 1) + 13 successes and 7 failures → Beta(1 + 13, 1 + 7) = Beta(14, 8) mean = 14 ÷ 22 = .6364 · mode = 13 ÷ 20 = .65 SD = √(14 × 8 ÷ (22² × 23)) = √.010061 = .1003 Add the successes to the first parameter and the failures to the second. The mode is exactly the observed 13/20, as it always is with a flat prior: the prior adds nothing, so the most probable value is the one the data alone would pick. The mean is a little below it because the posterior has a longer left tail.
- The central interval 95% central credible interval = [.430, .819], width .389 This is a central interval, built by cutting 2.5% off each tail of a continuous posterior, and its endpoints can be any two numbers in the range. The previous problem's region was a set of whole hypotheses chosen by probability, so its endpoints can only be grid values and its coverage overshot to 96.3%. Both summarize the same posterior at different resolutions. As candidates are added, the grid region approaches the shortest 95% interval, which for this skewed posterior is close to the central one but not identical.
- An informed prior Beta(6, 4) + 13 and 7 → Beta(19, 11) worth a + b = 6 + 4 = 10 trials, of which 6 succeeded, i.e. a belief centered near .6 mean = 19 ÷ 30 = .6333 · mode = 18 ÷ 28 = .6429 · SD = .0866 95% interval = [.457, .793], width .336 The estimate barely moved, from .6364 to .6333, because the prior agreed with the data. The interval changed: ten pretend trials were added to twenty real ones, so it narrowed by about 13% of its width. A prior that agrees with your data makes the estimate more precise, and one that disagrees pulls the estimate toward itself and has to be defended. Either way, report the prior in the write-up.
- Why they agree, and when the shortcut runs out With a flat prior the grid's posterior column is the likelihood divided by its own total, and the Beta(14, 8) density is proportional to that same likelihood. Two columns proportional to each other are identical once both are scaled to sum to 1, so the agreement is exact, and it holds for an informed Beta prior too. It fails with a prior that is not a Beta, a likelihood that is not binomial, or a model with several parameters at once. In any of those there is no conjugate posterior to write down, and the grid, or a sampler, is the only option.
Beta(14, 8), with mean .6364, mode .65 and SD .1003; the central 95% interval is [.430, .819]. A Beta(6, 4) prior, worth 10 trials, gives Beta(19, 11) with mean .6333 and interval [.457, .793], so the estimate barely changed and the interval narrowed. Grid and shortcut agree because both columns are proportional to the same likelihood, and the shortcut is no longer available once the prior or the likelihood is outside the conjugate pair.
From §3.7 Bayesian Thinking · the Beta distribution itself is in the distribution playground.
🧪 Stats 3 · Latent variables & causal inference
Eight problems written the way the Stats 3 syllabus examines them, from the two parts of the course that ask you to produce a number by hand. They cover a measurement model read off a loading matrix, a posterior built as a table, and the three causal designs that estimate an effect from an assignment rule. They build on the arithmetic of problems 81 to 86 above and apply it to the kinds of questions an exam asks.
87The item that runs the other way
Warm-upA four-item wellbeing scale is answered on a 1 to 7 agreement scale. Items q1, q2 and q4 are worded so that agreeing means more wellbeing; q3 is worded so that agreeing means less. SPSS produced the correlation matrix below before any item was recoded, and three of its six entries are negative.
- Recode q3 and give the corrected correlation matrix, plus q3's new mean and SD.
- Where do Bartlett's 6 degrees of freedom come from, and what does rejecting it actually tell you?
- What does a KMO of .78 say about this matrix?
- Compute α on the corrected matrix, then on the matrix exactly as printed above.
- If q3 is never recoded, does the one-factor solution break? Say what changes and what does not.
Worked solution
- The recode, and what it moves q3′ = 8 − q3, because the constant is (scale minimum + scale maximum) = 1 + 7 r13 = +.48 · r23 = +.44 · r34 = +.41, and r12, r14, r24 are untouched mean = 8 − 2.6 = 5.4 · SD = 1.10, unchanged Reversing subtracts from a constant, so it flips direction and leaves every distance unchanged. The SD stays the same, and each correlation changes sign but not size. The constant is 8, not 7. Check it by confirming that a 1 becomes a 7 and a 7 becomes a 1, because a wrong constant can go unnoticed through a whole analysis.
- Bartlett's degrees of freedom df = p(p − 1) ÷ 2 = 4 × 3 ÷ 2 = 6, one per correlation in the matrix χ²(6) = 48.2, p < .001 The null hypothesis is that the population correlation matrix is an identity matrix, meaning no two items are correlated. Rejecting it tells you only that there is some shared variance to factor. It rejects easily at any reasonable sample size, so treat it as a minimum requirement. A Bartlett test that fails to reject means you should stop; one that rejects does not show that the data are suitable.
- KMO .78 sits in Kaiser's middling band (.90 marvelous, .80 meritorious, .70 middling, .60 mediocre, .50 miserable, below .50 unacceptable) KMO compares the ordinary correlations with the partial correlations: if items correlate because they share a factor, partialling out the others should leave little correlation. Middling is enough to proceed. Having only four items limits this analysis more than the sampling adequacy does.
- α twice corrected: σ²total = 4 + 2(.55 + .48 + .50 + .44 + .47 + .41) = 4 + 5.70 = 9.70 α = (4 ÷ 3)(1 − 4 ÷ 9.70) = (4 ÷ 3)(.5876) = .784 as printed: σ²total = 4 + 2(.55 − .48 + .50 − .44 + .47 − .41) = 4 + 0.38 = 4.38 α = (4 ÷ 3)(1 − 4 ÷ 4.38) = (4 ÷ 3)(.0868) = .116 α adds covariances with their signs, so three negative ones nearly cancel three positive ones and the total-score variance falls from 9.70 to 4.38. A reliability near zero on a scale you have reason to trust is the classic symptom of a reverse-worded item that was not recoded. Learn to recognize it, because the fix takes one line.
- Why the factor solution does not break It does not. q3 loads about −.6 where it would have loaded +.6. Its communality is the square of the loading, so it is unchanged, every implied correlation reproduces the printed signs, and the fit statistics are identical. The mistake is dangerous because extraction, rotation and variance explained all look normal, and only reliability shows the error. Recode first, before anything else in the workflow, and as a second check compare a recoded item's mean with the scale midpoint.
q3′ = 8 − q3 gives r13 = .48, r23 = .44 and r34 = .41 with the other three unchanged; its mean becomes 5.4 and its SD stays 1.10. Bartlett's 6 df is one per correlation, and rejecting says only that the matrix is not an identity. KMO .78 is middling. α is .784 corrected and .116 uncorrected, while the loadings change only in sign and the fit not at all.
From §3.5 Factor Analysis / PCA · reliability itself is Methods §1.3, and the descriptives calculator will check a recoded item's mean for you at Quick Descriptives.
88Two factors, and the residual that stays
Exam-levelSix items go through maximum likelihood extraction with two factors, rotated to an orthogonal solution, so the factors are uncorrelated and the loading matrix below is the whole model. The paper prints six of the fifteen observed correlations beside it, along with the fit statistic for a one-factor and a two-factor solution.
i4 .10 .78 · i5 .15 .72 · i6 .05 .68 Observed correlations r12 = .59 · r14 = .17 · r25 = .20 · r34 = .11 · r36 = .16 · r45 = .57 Formulas and fit σij = βi1βj1 + βi2βj2 · df = ((p − m)² − (p + m)) ÷ 2
one factor: χ² = 26.4 · two factors: χ² = 3.10
- Give the correlation the model implies for each of the six printed pairs.
- Give every communality and uniqueness, then both eigenvalues, and say what share of the six items' variance the solution accounts for.
- Form the six residuals and name the largest. What is it telling you?
- Work out the fit-test degrees of freedom for one, two and three factors. What does the three-factor answer mean?
- How many factors do you report, and does the largest residual change that?
Worked solution
- The implied correlations σ12 = .80(.70) + .10(.15) = .560 + .015 = .575 σ14 = .80(.10) + .10(.78) = .080 + .078 = .158 σ25 = .70(.15) + .15(.72) = .105 + .108 = .213 σ34 = .75(.10) + .05(.78) = .075 + .039 = .114 σ36 = .75(.05) + .05(.68) = .0375 + .034 = .0715 σ45 = .10(.15) + .78(.72) = .015 + .5616 = .5766 With two factors the implied correlation is a sum of two products; that is the only difference from the one-factor case. Look at the cross-block pairs: items 1 and 4 are implied to correlate .158 even though neither loads meaningfully on the other's factor. Each has a small loading on the other factor, and the two products add.
- Communalities, uniquenesses, eigenvalues h² = .65, .5125, .565, .6184, .5409, .4649 ψ = 1 − h² = .35, .4875, .435, .3816, .4591, .5351 λ1 = .80² + .70² + .75² + .10² + .15² + .05² = 1.7275 λ2 = .10² + .15² + .05² + .78² + .72² + .68² = 1.6242 Σλ = 3.3517 = Σh² · 3.3517 ÷ 6 = 55.86% An eigenvalue is the sum of squared loadings down a column and a communality is the sum along a row, so the two totals are the same number summed in two directions. The sum of the eigenvalues divided by the number of items is therefore the share of variance explained, and an eigenvalue of 1 equals the variance of one standardized item.
- The residuals 1,2: .59 − .575 = +.015 · 1,4: .17 − .158 = +.012 · 2,5: .20 − .213 = −.013 3,4: .11 − .114 = −.004 · 4,5: .57 − .5766 = −.007 3,6: .16 − .0715 = +.089 Five of the six are under .02 in absolute value, which is about as close as a fitted matrix gets. The sixth is past the .05 that usually prompts a second look: items 3 and 6 load on different factors, yet they correlate .16 against the .0715 the model implies. A residual is about the pair it belongs to, so read items 3 and 6 side by side. Shared wording, a shared response format, or a reversed pair of items in the same block can produce this, and none of those is a third factor.
- Degrees of freedom m = 1: ((6 − 1)² − (6 + 1)) ÷ 2 = (25 − 7) ÷ 2 = 9 m = 2: ((6 − 2)² − (6 + 2)) ÷ 2 = (16 − 8) ÷ 2 = 4 m = 3: ((6 − 3)² − (6 + 3)) ÷ 2 = (9 − 9) ÷ 2 = 0 Zero degrees of freedom means the model has exactly as many free parameters as the matrix has numbers to reproduce, so it fits perfectly and there is no test to run. Six items cannot support three factors, whatever the software prints, and the count is simple arithmetic: 21 numbers in the matrix, against 18 loadings plus 6 uniquenesses minus 3 for rotational freedom.
- The verdict one factor: χ²(9) = 26.4, p = .0018 → rejected two factors: χ²(4) = 3.10, p = .54 → retained Report two. One factor leaves misfit that the test detects; with two, the remaining discrepancy is within what sampling noise would produce. The residual does not change the count. A global fit statistic combines every pair in the matrix, so a single local misfit of .089 can hide inside an acceptable χ². Read the residual matrix as well as the test every time, because they answer different questions.
Implied .575, .158, .213, .114, .0715 and .5766; communalities .65, .5125, .565, .6184, .5409 and .4649 against uniquenesses .35, .4875, .435, .3816, .4591 and .5351; eigenvalues 1.7275 and 1.6242, accounting for 55.86% of the six items' variance. The largest residual is +.089 between items 3 and 6. df is 9, 4 and 0 for one, two and three factors, so three cannot be tested at all. Report two factors, and read items 3 and 6 for shared wording rather than adding a factor.
From §3.5 Factor Analysis / PCA · the lesson's Loadings In, Correlations Out widget draws the residual grid, and the printed tables hold the χ² criticals.
89Two people, two ways to score them
Warm-upA one-factor solution on four items is finished, and the analyst now wants a score per respondent to use in a regression. SPSS offers to save factor scores; a colleague says just to average the four items. Two respondents show what the choice changes.
- Compute each respondent's regression factor score.
- Compute each respondent's unit-weighted mean of the same four z scores.
- The two methods disagree about who scores higher. Explain why, from the numbers.
- What does a determinacy of .92 mean, and what is the lowest two defensible score sets could correlate?
- Why is a factor score called predicted rather than computed, and what are the advantages of regression scores and of Bartlett scores?
Worked solution
- The refined scores A: .35(1.20) + .30(0.80) + .10(−0.40) + .32(1.00) = .42 + .24 − .04 + .32 = 0.94 B: .35(0.50) + .30(1.40) + .10(0.90) + .32(0.30) = .175 + .42 + .09 + .096 = 0.781
- The unit-weighted scores A: (1.20 + 0.80 − 0.40 + 1.00) ÷ 4 = 2.60 ÷ 4 = 0.65 B: (0.50 + 1.40 + 0.90 + 0.30) ÷ 4 = 3.10 ÷ 4 = 0.775
- Why they swap The refined score puts A ahead by .16; the simple average puts B ahead by .125. Item 3 explains the swap. Its coefficient is .10, less than a third of item 1's, because it is the weakest indicator of the factor, but a unit-weighted average gives it the same weight as the others. A is high on items 1 and 4, which have large weights, and low on item 3; B is the reverse. Weighting decides the comparison whenever two people are close and their profiles differ like this, which happens most of the time in the middle of a distribution. In practice the two sets of scores usually correlate above .95 across a whole sample. That is the argument for the simple average: it gives nearly the same ranking for nearly everyone, and it transfers to a new sample, where the weights do not.
- Determinacy .92² = .846, so about 85% of the score's variance is the factor it estimates 2(.92²) − 1 = 1.6928 − 1 = .693 The second number is the worrying one. Two sets of scores, each correlating .92 with the factor and each consistent with the fitted model, can correlate as little as .69 with each other, which is enough to reorder a sample substantially. This is called factor score indeterminacy. It is a property of the model, not of the software: a factor is defined by its relationships to the items, and those relationships do not fix one value per person.
- Predicted, and which method A factor is unobserved by definition, so no value in the data is the factor itself. The software returns the model's best estimate for this person given their answers. That is a prediction in the same sense that a regression line predicts: a fitted value with error around it, not a measurement. Calling it computed suggests it can be treated as data. Regression (Thurstone) scores maximize the correlation with their own factor, but they are shrunk toward the mean and correlate with the other factors' scores even in an orthogonal solution. Bartlett scores are unbiased, so the expected score for a person at a given factor level is that level, and they stay uncorrelated with the other factors. Use Bartlett scores when the score goes into a further model as a variable, and regression scores when you want the best ordering of individuals. Say in the write-up which you used, because the numbers differ.
Refined scores 0.94 for A and 0.781 for B; unit-weighted means 0.65 and 0.775. The two methods disagree about who is higher because item 3 is weighted .10 by one and .25 by the other. A determinacy of .92 means 85% of the score's variance is the factor, and two defensible score sets may correlate as little as .693 with each other. Factor scores are predicted rather than computed because the factor is never observed; regression scores maximize correlation with the factor, Bartlett scores are unbiased and uncorrelated with the other factors.
From §3.5 Factor Analysis / PCA · what a predicted value is in the ordinary case is §1.18 Simple Linear Regression.
90Two batches, one posterior
Exam-levelA group sows seeds in two sittings. The first tray has 10 seeds and 7 come up; a week later a second tray of 6 gives 5. Half the group updates once on each batch in turn; the other half waits and updates once on the pooled count. They get different-looking arithmetic and argue about which is right.
.6 .2363 · .7 .2932 · .8 .2212 · .9 .0631
- Take the batch-1 posterior above as the prior and update it on batch 2. Give the posterior to four decimals and its mean.
- Now update the flat prior once on the pooled 12 of 16. What do you get?
- The two routes multiply by different constants, 720 against 1820. Why does that not change the answer? Would reversing the order of the batches?
- Build the smallest region holding at least 95% of the final posterior. Name its hypotheses, its endpoints and the probability it actually holds.
- The conjugate shortcut gives Beta(13, 5), whose mean is 13/18 = .7222, while the grid's mean is .7226. Which is wrong?
Worked solution
- Sequential: the batch-1 posterior becomes the prior product = (batch-1 posterior) × 6p⁵(1 − p), then divide by the column total .0000 .0000 .0004 .0067 .0472 .1722 .3465 .3398 .0873 mean = Σp × posterior = .7226 The batch-1 posterior had its peak at .7, with a lot of probability at .6 as well. Five of six germinating shifts the whole column right and narrows it, so .7 and .8 now hold 68% between them. This is the sequential form of Bayes' rule, and it is the form to learn well, because evidence usually arrives in stages.
- Pooled: one update on 12 of 16 product = (1/9) × 1820p¹²(1 − p)⁴, then normalize .0000 .0000 .0004 .0067 .0472 .1722 .3465 .3398 .0873 The same nine numbers, exactly: the two columns agree to machine precision. The un-normalized products are quite different, so the result can look surprising at first.
- Why the constants cannot matter two-step: every row carries 120 × 6 = 720 · pooled: every row carries 1820 720p¹²(1 − p)⁴ ÷ Σ720p¹²(1 − p)⁴ = p¹²(1 − p)⁴ ÷ Σp¹²(1 − p)⁴ Each route's coefficient is the same for every row, so it appears in the column total too and cancels when you divide. To change a posterior, a factor has to vary between rows, and a binomial coefficient counts arrangements of the data, not anything about p. The evidence is in the exponents: 7 + 5 = 12 successes and 3 + 1 = 4 failures either way. Reversing the order gives the same result for the same reason: multiplication commutes, so the posterior after both batches cannot depend on which came first. Sequential and pooled updating give the same posterior.
- The 95% region take in descending order of mass: .7 (.3465), .8 (.6862), .6 (.8584), .9 (.9457), .5 (.9929) region = {.5, .6, .7, .8, .9}, endpoints .5 to .9, holding 99.3% Four hypotheses reach 94.6%, just short of the target, so a fifth is needed and the region overshoots to 99.3%. The set is contiguous, so you can report it as a range. That is not guaranteed in general, and a bimodal posterior can give a set with gaps. The overshoot comes from the coarse grid: with nine candidates the smallest step is a whole hypothesis, so you cannot stop at exactly 95%. More candidates shrink the overshoot.
- Neither is wrong A flat prior is Beta(1, 1), and 12 successes with 4 failures takes it to Beta(1 + 12, 1 + 4) = Beta(13, 5), whose mean is 13/18 = .7222. The grid's .7226 is the mean of the same posterior evaluated at nine points and renormalized, so it approximates the same answer and does not compete with it. Check it the other way round: the Beta(13, 5) density evaluated at those nine values and scaled to sum to 1 reproduces the grid column exactly, because both are proportional to p¹²(1 − p)⁴. Add candidates and the grid mean moves toward .7222. The grid is the general method and the conjugate is the special case where the answer can be written down.
Both routes give .0000, .0000, .0004, .0067, .0472, .1722, .3465, .3398, .0873 with a mean of .7226. Order does not matter, because each route's binomial coefficient is constant down its own column and normalizing divides it out. The 95% region is {.5, .6, .7, .8, .9}, running .5 to .9 and holding 99.3%, because four hypotheses reach only 94.6%. The conjugate Beta(13, 5) mean of .7222 and the grid's .7226 are the same posterior at two resolutions.
From §3.7 Bayesian Thinking · the Bayes by Hand grid does this table live, and Problem 85 and Problem 86 run the single-batch version.
91The letter that nobody had to open
Exam-levelA faculty runs an optional tutoring program. Because students choose whether to attend, a direct comparison of attenders with non-attenders says little about the program's effect. So 400 students are split by lottery and 200 are sent a letter encouraging them to sign up. On either side of the lottery, attending is neither required nor barred.
attenders (160) 70.0 · non-attenders (240) 56.0 Formula SE of a difference in proportions = √(p̄(1 − p̄)(1/n1 + 1/n2))
- Give the first stage, the reduced form and the Wald ratio.
- Compute the first-stage F. Which of the instrument's three conditions does it test, and which does it leave untouched?
- The naive comparison gives 14.0 marks and the instrument gives 8.0. What accounts for the gap, and which way did the bias run?
- Split the 400 into always-takers, compliers and never-takers. Whose effect is the 8.0?
- Suppose the letter itself lifted marks by 1.0, quite apart from attendance. What is the corrected estimate now, and what would that same 1.0 have done to a study whose first stage was .10?
Worked solution
- Three numbers, and the ratio between two of them first stage: .60 − .20 = .40 more of the letter group attended reduced form: 63.2 − 60.0 = 3.2 marks Wald ratio = 3.2 ÷ .40 = 8.0 marks Both are differences between randomized groups, so both are unbiased. The letter raised attendance by 40 percentage points and marks by 3.2. If the letter affects marks only through attendance, then attending is worth 3.2/.40 marks. The reduced form is diluted because only 40% of the letter group changed behavior, and dividing by the first stage undoes that dilution.
- The first-stage F p̄ = 160 ÷ 400 = .40 SE = √(.40 × .60 × (1/200 + 1/200)) = √.0024 = .0490 t = .40 ÷ .0490 = 8.16 · F = t² = 66.7 Far above the rule of thumb of 10, so the instrument is not weak. That is all it shows. Relevance is the only one of the three conditions you can check in the data, because it is a claim about two observed variables. Independence comes from the lottery. Exclusion is a claim that a path does not exist, and no statistic computed from this dataset can confirm or refute it. So an F of 66.7 does not validate the design.
- Why the naive comparison is nearly twice as large naive: 70.0 − 56.0 = 14.0 · instrument: 8.0 · gap 6.0 Selection, and the bias is upward. Students who go to optional tutoring are the ones who were already likely to do better: more motivated, better organized, more likely to have kept up. The naive comparison adds that difference to the program's effect, so here it overstates by 6.0 marks. The instrument does not adjust for motivation, which was not measured. It avoids the problem by comparing groups that the lottery made alike.
- Three kinds of student always-takers: 20% = 80 students, who attend whatever the post brings compliers: .60 − .20 = 40% = 160, who attended because of the letter never-takers: 1 − .60 = 40% = 160, who stay away either way This split holds only if no student was put off attending by the letter. That is the monotonicity assumption, and it is usually easy to believe. The 8.0 is the effect for the 160 compliers only. It is not the effect on the always-takers, who probably need tutoring least, and it says nothing about the never-takers, who are often the students a faculty most wants to reach. A different encouragement that moved a different group of students would give a different number, and both would be correct.
- What a one-mark exclusion violation does reduced form left for attendance: 3.2 − 1.0 = 2.2 honest ratio = 2.2 ÷ .40 = 5.5, so the reported 8.0 was 2.5 marks too high with a first stage of .10 instead: 1.0 ÷ .10 = 10.0 marks of bias A violation enters the numerator and is then divided by the first stage, so the weaker the instrument, the more the violation is magnified. That is a second, less familiar reason to worry about a small F. A weak instrument is not only imprecise; it also turns a small violation of an untestable assumption into a large error in the estimate. Here the violation is plausible. A letter from the faculty saying the exam matters may raise the marks of a student who never books a session. So the write-up has to argue for the exclusion restriction, because no statistic can establish it.
First stage .40, reduced form 3.2 marks, Wald ratio 8.0 marks per attender. The first-stage F is 66.7, testing relevance alone. The naive 14.0 overstates by 6.0 because attenders self-select on motivation. The sample splits into 80 always-takers, 160 compliers and 160 never-takers, and the 8.0 is the compliers' effect. A direct effect of 1.0 mark would cut the corrected estimate to 5.5, and the same 1.0 against a first stage of .10 would bias it by 10.0.
From §3.13 Instrumental Variables & 2SLS · why adjustment could not have done this is §3.12 Causal DAGs & Confounding.
92A bursary at sixty marks
Exam-levelA merit bursary goes to every applicant who scores 60 or more on an entrance exam, and only to them. An analyst centers the running variable at the cutoff, bins applicants in two-point bands and reports the first-year average in each band. High scorers are scarce, so the window reaches 6 points below the cutoff and only 4 above.
above: x = +1 → 62.2 · +3 → 62.6 Robustness, as reported bandwidth ±6: estimate 4.0, SE 1.2 · bandwidth ±3: estimate 4.3, SE 2.1 Two checks scores of 59: 38 applicants · scores of 60: 41 applicants
mean parental income just above the cutoff, minus just below: +4,200 (SE 1,100)
- Fit a line to each side and give the estimated jump. Why is the running variable centered?
- Fit the same five bins with one common slope and a treatment dummy. Which of the two numbers do you report, and what decides it?
- What do you learn by comparing the two bandwidths, and what is the cost?
- Read the two checks. What is your verdict on the design?
- If the design had held up, whose effect would the estimate describe?
Worked solution
- A line on each side below: x̄ = −3, ȳ = 56.5, Σ(x − x̄)(y − ȳ) = 4.0, Σ(x − x̄)² = 8 b = 4.0 ÷ 8 = 0.50, intercept = 56.5 − 0.50(−3) = 58.0 above: x̄ = 2, ȳ = 62.4, Σ(x − x̄)(y − ȳ) = 0.4, Σ(x − x̄)² = 2 b = 0.4 ÷ 2 = 0.20, intercept = 62.4 − 0.20(2) = 62.0 jump = 62.0 − 58.0 = 4.0 marks Center the running variable so that the difference between the intercepts is the jump. Each line's intercept is its fitted value at x = 0, which is the cutoff, so their difference is the vertical gap exactly where the rule changes. Uncentered, the two intercepts are fitted values at a score of zero, extrapolated far outside the window, and their difference means nothing.
- The same bins with one slope pooled within-side slope = (4.0 + 0.4) ÷ (8 + 2) = 0.44 jump = (62.4 − 56.5) − 0.44(2 − (−3)) = 5.9 − 2.2 = 3.7 Report the 4.0. The two sides' slopes are 0.50 and 0.20, so the assumption of one common slope is false here, and that error has to show up somewhere. Where it shows up depends on the window. With a symmetric window the two models would have agreed even with slopes this different, because the misfit on the two sides would have canceled at the cutoff. This window is lopsided, six points below and four above, so the misfit does not cancel and 0.3 marks of it ends up in the jump. A lopsided window is normal at a selective cutoff, where high scorers are always scarcer, so letting the slopes differ is the default.
- Two bandwidths ±6: 4.0 with SE 1.2, t = 3.33 · ±3: 4.3 with SE 2.1, t = 2.05 The estimates agree within a fraction of a standard error. That is evidence that the 4.0 is a real jump, not an artifact of the fitted lines. The narrow window depends far less on the functional form, so a result that holds in the narrow window was not produced by the fit. The cost is precision, and it is large: the standard error nearly doubles. Every regression discontinuity study faces this tradeoff, so papers report several bandwidths.
- The checks, and the verdict density: 38 applicants at 59 against 41 at 60, no pile-up on the winning side covariate: 4,200 ÷ 1,100 = t = 3.82, p < .001 The density check passes. Nothing suggests applicants placed themselves just above the line; a McCrary density test checks this formally by fitting the density on each side of the cutoff and testing whether the two meet. The covariate check fails, and it decides the question. Parental income is fixed long before the exam, so a bursary awarded afterwards cannot have caused it. Something other than the bursary changes at 60. Perhaps a second scheme uses the same threshold, perhaps admissions treat 60 as a band boundary, perhaps richer applicants are coached to clear exactly that line. Report that the design is broken as it stands and the 4.0 cannot be read as the bursary's effect. The next step is to find out what else changes at 60.
- Whose effect it would have been Only applicants scoring at or very near 60. The comparison works because people a mark either side of the line are alike in everything that varies smoothly, and that argument weakens with every point you move away from the cutoff. The design says nothing about an applicant who scored 45 or 85, and extending the two fitted lines out to them is extrapolation, not estimation. Regression discontinuity gives a credible estimate only because the estimate is local.
The two fits are 58.0 + 0.50x below and 62.0 + 0.20x above, so the jump is 4.0 marks; centering makes each intercept a fitted value at the cutoff. One common slope of 0.44 gives 3.7, and the 4.0 is the one to report, because the slopes differ and the window is lopsided. The two bandwidths agree at the cost of precision. The density check passes, but parental income jumps with t = 3.82, so the design is broken and the 4.0 is not the bursary alone. Had it held, the estimate would apply to applicants at the cutoff.
From §3.14 Regression Discontinuity Design · the fuzzy case uses the cutoff as an instrument, as in §3.13 Instrumental Variables, and the lesson's Jump at the Cutoff widget moves the bandwidth for you.
93Bike lanes in two cities
Exam-levelA city builds a connected bike-lane network in 2023. A comparable neighboring city does not. A transport team has counts of cycling trips per 1,000 residents for both cities in 2022 and 2024, and later finds a 2020 count in an older report.
control city: 2020 → 98 · 2022 → 110 · 2024 → 134 Model y = b0 + b1Treated + b2Post + b3(Treated × Post)
- Using 2022 and 2024 only, give each city's change and the difference-in-differences estimate.
- Give all four regression coefficients, and say what b1 and b2 mean. What do they not mean?
- Take 2022 as the reference period and give the event-study coefficients for 2020 and 2024. What does the 2020 one say?
- Extend the pre-period difference linearly. What does the estimate become, and what have you assumed instead?
- What must the standard errors do here, and what is the limit with these data?
Worked solution
- The two-by-two treated: 168 − 120 = +48 · control: 134 − 110 = +24 DiD = 48 − 24 = +24 trips per 1,000 The first difference removes anything about each city that did not change; the second removes anything that changed the same way in both, such as a national fuel price, a weather year or a pandemic recovering. What remains is the change that happened in one city and not the other.
- The same thing as a regression b0 = 110, the control city before b1 = 120 − 110 = +10, the gap between the cities before anything happened b2 = 134 − 110 = +24, what happened to the control city over the same period b3 = +24, and 110 + 10 + 24 + 24 = 168 reproduces the treated city's 2024 count Only b3 is an effect. State the other two precisely, because they are often reported as findings. b1 is the standing difference between the cities, the confound the design is built to remove, so reporting it as "the treated city cycles more" treats the confound as the result. b2 is the common time shock, what would have happened anyway; read as an effect of time, it describes only the control city. Written with unit and time fixed effects instead of two dummies, the model says the same thing, and with two units and two periods it is arithmetically identical.
- The pre-period coefficient 2020: (96 − 120) − (98 − 110) = −24 − (−12) = −12 2024: (168 − 120) − (134 − 110) = 48 − 24 = +24 With 2022 as the reference, a period before the treatment should have a coefficient of zero, and this one is −12. The treated city was already pulling ahead by 12 trips per 1,000 every two years before any lanes were built. That is a differential pre-trend, the part of the assumption you can see. Parallel trends is a claim about the treated city's unobserved path after 2023, which nothing can check. But a city that was not moving in parallel beforehand gives little reason to think it would have started.
- Letting the trend continue counterfactual 2024 = 120 + 24 (the control's change) + 12 (its own drift) = 156 adjusted effect = 168 − 156 = +12, half the naive 24 Parallel trends was not tested and repaired here. It was replaced with a different untestable assumption: that the pre-period drift would have continued at exactly the same rate. That assumption is sometimes reasonable and sometimes badly wrong, since a drift can flatten on its own. The exercise does show that a lot depends on the choice: the answer moves from 24 to 12 depending on which of two assumptions you make, and no data can decide between them. Report it as a sensitivity analysis beside the main estimate, so that readers see both.
- Standard errors, and their limit The same two cities are each counted three times, so the observations are not independent: whatever makes one city cycle more than expected in 2022 is still there in 2024. The standard answer is to cluster the standard errors by unit, and with a real panel of, say, forty cities that is what to do. It does not help this study. Cluster-robust standard errors rely on having many clusters, and two clusters is effectively none. This design has one treated unit and one control unit, so no conventional standard error on the 24 can be trusted, whatever the software prints. That is a limit of the design, not of the estimator, and the only fix is more untreated comparison cities.
The treated city gained 48 and the control 24, so the DiD estimate is +24 trips per 1,000. The coefficients are b0 = 110, b1 = +10 (the standing gap, not an effect), b2 = +24 (the common time shock, not an effect) and b3 = +24. The 2020 event-study coefficient is −12 against a reference of zero, so parallel trends is already in doubt; continuing that drift linearly halves the estimate to +12. Standard errors must be clustered by city, and with two clusters none is trustworthy.
From §3.15 Difference-in-Differences · the design intuition and its two canceled biases are Methods §1.6 Quasi-Experiments.
94Three studies, three strategies
StretchA journal club reads three papers in two weeks. None of them randomizes anything, and all three claim a causal effect. Say what assumption each one depends on, and what evidence would undermine it. There is no arithmetic in this problem; the work is in naming things precisely.
- Name the design in each paper.
- State each paper's identifying assumption in one sentence.
- For each, name the single piece of evidence that would most undermine it.
- Which estimate is a local average treatment effect, and over whom? Which population does each of the other two belong to?
- What do all three have in common that the adjustment strategy of §3.12 does not?
Worked solution
- The designs A: regression discontinuity, with date of birth as the running variable B: instrumental variables, with the lottery number instrumenting years served C: difference-in-differences, one region against its neighbors before and after In each case the assignment mechanism identifies the design, not the analysis. A strict rule on a continuous variable is a discontinuity; a random nudge that only some people act on is an instrument; a policy that starts for one group at one moment, with a comparison group available, is a difference-in-differences.
- The assumptions A, continuity: absent the pension rule, everything relevant varies smoothly across 1 January 1960 B, exclusion: a person's lottery number affects their earnings only through service C, parallel trends: absent the wage rise, the two regions' teenage employment would have moved together All three are statements about something that was never observed, so no software can test any of them. State each assumption in the seminar before discussing a single coefficient, because if you cannot state the assumption, you cannot evaluate the paper.
- What would undermine each one A: a second rule keyed to the same birthdate. School-entry cohorts, conscription and tax bands all use January boundaries, and if any of them changes at 1 January 1960, the treatment is a bundle of policies and the jump reflects all of them. The check for this is a covariate that should not change at the cutoff but does. B: men with low numbers staying in education to avoid the draft. That is a second path from the number to earnings that does not go through service, and it breaks exclusion. It would not show up in the first-stage F, which would still look excellent. C: pre-period employment already diverging, or any evidence the region raised its wage because its labor market was changing. Policy is rarely random in time, and a region that legislates in response to changing conditions is the most common way parallel trends fails.
- Whose effects these are B is the local average treatment effect, over compliers B's compliers are the men who served because their number came up and would not have served otherwise. So the estimate covers neither volunteers, who would have served whatever the number, nor those who would have avoided service either way. A applies to people at the cutoff, those born within days of 1 January 1960, and says nothing about someone born in 1955. C is the effect on the treated region in those periods, which need not transfer to a region with a different labor market or to a different size of increase. All three estimates are local, each in a different way, and a discussion that ignores this is discussing the wrong quantity.
- What they share Each one identifies the effect from an assignment rule, not from a list of covariates. The backdoor criterion closes a confounding path by adjusting for a variable you measured, and it cannot help with a path through motivation, ability or health that was never measured. These three designs do not try to block the confounded comparison. They use only the part of the variation in the treatment that is free of confounding: variation created by a rule, a lottery or a date. All three designs have the same two drawbacks. The estimate is local, so it applies to a population the design picked, which may not be the one you are interested in. And it rests on an assumption that no test can settle, so a reader has to judge the argument a paper makes in place of a test.
A is regression discontinuity on date of birth, assuming continuity, broken by a second rule using the same boundary. B is instrumental variables with the lottery number, assuming exclusion, broken by draft avoidance through education. C is difference-in-differences, assuming parallel trends, broken by a pre-existing divergence or by the policy responding to conditions. B is the LATE, over compliers; A applies to people at the cutoff and C to the treated region in those periods. All three identify the effect from an assignment rule, not a covariate list, and in exchange each gives a local estimate that rests on an untestable assumption.
From §3.13, §3.14 and §3.15 · the adjustment strategy they replace is §3.12 Causal DAGs & Confounding, and the design intuition is Methods §1.6.
🔍 Research Toolkit · Spot the problem
Six problems with almost no arithmetic in them. Each one gives you a study, a figure or a sentence that looks perfectly respectable and asks what is wrong with it. They test whether you can judge an analysis as well as run one, and they draw on Methods, Data, Ethics and Writing.
95The module that raises exam scores
Exam-levelA university builds an optional online tutorial module for its introductory statistics course. Usage is tracked automatically. At the end of term the learning-technology team compares final exam marks and issues a press release.
- Students who used the module: M = 71.0 (n = 104)
- Students who did not: M = 62.0 (n = 96)
- t(198) = 4.10, p < .001, d = 0.58
- Headline: "New online module raises exam scores by nine points"
- The statistics are computed correctly. What is the problem?
- Name three specific variables that could produce this result with a module that does nothing.
- The team offers to rerun the analysis controlling for prior GPA. Does that fix it?
- Design the study that would actually answer the question.
- Rewrite the headline.
Worked solution
- Self-selection The students were not assigned to groups. They decided for themselves whether to use the module, so the two groups differ in whatever made them decide, and the module is only one possible explanation for the nine-point gap. The t-test is valid as a description of two groups that already existed. But the word "raises" has no support, because a comparison of self-selected groups cannot distinguish an effect of the treatment from a difference between the people who chose it.
- Three plausible confounds Prior mathematical preparation: students who already find statistics tractable are more likely to engage with extra material and more likely to score well. Conscientiousness: the trait that produces module use also produces lecture attendance, problem sets and revision. Available time: students working long hours in paid jobs have less of everything, including both module use and study time. Each of these affects both module use and exam marks, so each is a confound.
- Does controlling for GPA fix it? It helps, but it does not fix it. Adjusting for prior GPA removes the part of the gap explained by measured prior ability, and the adjusted estimate will almost certainly be smaller than nine points. What remains is everything that predicts both usage and outcome but was never measured: motivation this term, hours available, whether a friend recommended the module. You can only adjust for confounders you have data on. Drawing the assumed structure as a causal diagram helps here, because it shows which variables you would need to adjust for and which you actually have.
- The study that would settle it Randomize access. Give the module to a random half of the cohort and withhold it from the other half for the term. Alternatively, stagger the rollout so that every student eventually gets it, in a random order; ethics committees and students' unions usually find this easier to accept. Pre-register the primary outcome and the analysis. Analyze by assigned group, not by actual usage, because as soon as you analyze by who chose to log in, self-selection is back. If randomization is impossible, a regression-discontinuity or difference-in-differences design around a rollout date is better than a naive comparison.
- A better headline "Students who chose to use the new module scored nine points higher, though they may have differed before the term began." It is longer and duller, but it is true. The internal version should add that a randomized rollout next year would answer the question properly.
Self-selection. The groups were formed by student choice, so the nine-point gap confounds the module with prior ability, conscientiousness and available time. Controlling for GPA shrinks the estimate but does not justify causal language; only random assignment does that.
From §1.4 Experiments & Random Assignment and §1.6 Quasi-Experiments.
96Four thousand responses and no answer
Warm-upA city council is deciding whether to pedestrianize the main square. It posts a survey link on the council website and its social media accounts, leaves it open for six weeks, and reports the result to the planning committee.
- 4,300 responses received
- 78% in favor of pedestrianization
- "Margin of error ±1.5%"
- Conclusion: "Over three quarters of residents support the scheme"
- City population: about 260,000 adults
- Who could actually end up in this sample, and who could not?
- Does 4,300 responses make the estimate trustworthy?
- What is wrong with quoting a margin of error here?
- Name one more threat specific to open online surveys.
- What should the council have done, and is the survey worthless?
Worked solution
- The frame and the volunteers Two filters act before anyone answers. Coverage: only people who visit the council website or follow its social accounts ever see the link, which excludes residents without reliable internet, those who do not follow local government, and anyone whose news comes through other channels. Self-selection: of the people who saw it, the ones who answered are those who cared enough to click, and strong feelings on both sides drive response far more than mild ones. Organized campaigns on either side can mobilize supporters through a single post. The actual sample is the people who saw the link and chose to respond, and they are not the adult population of the city.
- Why 4,300 does not help A larger sample reduces variance, not bias. A convenience sample's estimate is centered in the wrong place, and collecting more of the same kind of response only narrows the spread around that wrong center. 4,300 self-selected responses give a more precise wrong answer than 430 would. Only a better sampling method removes the bias.
- The margin of error The ±1.5% figure is the most misleading number in the report. That formula assumes a probability sample in which every resident had a known, non-zero chance of selection. Here the respondents selected themselves. Quoting the figure gives the result the authority of survey statistics without any of their properties. A margin of error describes sampling error alone, and sampling error is not this survey's problem.
- One more threat Nothing stops one person responding repeatedly, or a campaign asking supporters to. An open link with no authentication has no way to enforce one response per resident, and no way to confirm that respondents live in the city at all.
- What to do, and what the survey is worth For an estimate: draw a probability sample from the electoral register, stratify by neighborhood and age band so every part of the city is represented, follow up non-responders more than once, and report the response rate alongside the result. That design supports both the percentage and its margin of error. The open survey is not worthless, though. As a consultation it surfaces arguments, local knowledge and objections the council would not otherwise hear. It should be reported as what it is: 4,300 people chose to tell us this, with no claim about the other 255,700.
A self-selected sample drawn from an incomplete frame. The 78% describes people who saw the link and chose to respond, and the sample size does not make that more trustworthy. The ±1.5% margin of error is meaningless, because the formula assumes probability sampling that never happened.
From §1.8 Sampling Methods and §1.9 Designing Surveys.
97Four questionable practices in one paragraph
Exam-levelYou are reviewing a manuscript for a journal. The methods and results read as follows. Nothing in it is fabricated, and every number is real. It should still not be published in this form.
"We recruited 60 participants. After inspecting the data we excluded 7 participants whose scores fell more than 2 SD from the mean, as their responses were clearly unrepresentative. Because the effect was not significant at that point, we collected a further 30 participants and re-ran the analysis, which then reached significance. Participants completed measures of mood, arousal, sustained attention and reaction time. As predicted, the drug improved reaction time, F(1, 81) = 4.62, p = .034, η² = .05."
- Identify four distinct questionable research practices in this paragraph.
- For each one, state the fix.
- Are the degrees of freedom consistent with the recruitment described?
- None of this is fraud. Why does it matter more than fraud does?
Worked solution
- Post-hoc exclusion "After inspecting the data we excluded 7 participants" is an outlier rule chosen after seeing what it would do. A 2 SD cutoff is lenient enough to remove roughly 5% of a normal distribution by construction. Calling the excluded responses "clearly unrepresentative" is a judgment made with knowledge of the result. Fix: specify the exclusion rule before data collection, apply it blind to condition, and report the analysis both with and without exclusions.
- Optional stopping "Because the effect was not significant, we collected a further 30 participants" is the textbook definition of data-dependent stopping. Every additional look is another chance for the p-value to drop below .05, and this practice alone can push a nominal 5% false-positive rate toward 20% or more. Fix: fix the sample size in advance from a power analysis, or use a pre-planned sequential design with corrected thresholds, which is a legitimate and sometimes required approach. Deciding after each look whether to continue is not legitimate.
- Selective reporting of outcomes Four measures were collected and one is reported. The reader has no way to know whether reaction time was the planned primary outcome or the only one of four that reached significance. Fix: report every measure collected, nominate a primary outcome in advance, and correct for multiplicity across the rest or label them exploratory.
- HARKing "As predicted" cannot be checked, and given the three practices above there is good reason to doubt it. Presenting a finding from exploration as a prediction makes a hypothesis-generating result look like a confirmation. Fix: separate confirmatory from exploratory sections explicitly, and use a preregistration to document what was predicted.
- The degrees of freedom 60 recruited − 7 excluded + 30 added = 83 participants two groups, so dferror = 83 − 2 = 81 ✓ The arithmetic is fine. Every number in the paragraph is internally consistent, so this manuscript would pass a statistical-consistency screen and still be untrustworthy. The problem is the route the analysis took to those numbers, and no recomputation can detect it.
- Why this outranks fraud Fabrication is rare, with under 1% of surveyed researchers admitting it, and it is unambiguous when caught. These practices are common: in a survey of more than 2,000 psychologists, around 63% admitted failing to report all dependent measures and about 56% admitted deciding whether to collect more data after checking significance. They also feel like reasonable judgment calls at the time, which helps them persist. Rare deliberate fraud damages a few papers. Widespread flexibility in these gray areas fills the literature with effects that disappear on replication, and that is the main mechanism behind the replication crisis.
Post-hoc outlier exclusion, optional stopping, selective reporting of one outcome out of four, and HARKing. The degrees of freedom are consistent, but consistent numbers do not protect against a flexible analysis path.
From §4.5 Questionable Research Practices, §1.11 The Replication Crisis and §1.12 Preregistration.
98The cleaning log that broke the data
Exam-levelA research assistant gives you a cleaned dataset for a two-wave wellbeing study and, to their credit, a log of what they did to it. Reading the log is faster than discovering each problem later.
- a. "Deleted 14 rows that had a blank cell anywhere."
- b. "Replaced remaining blanks in the wellbeing items with 0 so the scale total would compute."
- c. "Three participants entered 999 for age. Left them in rather than lose cases. Mean age is 33.2 (n = 240)."
- d. "Reverse-scored items 3, 7 and 11 by multiplying by −1." (all items are 1–7 Likert)
- e. "Removed 6 participants with the lowest wellbeing scores, who looked like non-serious responders."
- f. "Merged wave 1 and wave 2 on participant initials."
- g. "Saved the cleaned file over the original."
- Which steps are defensible and which are errors?
- Give the correct version of steps (b) and (d).
- Using step (c), work out the true mean age.
- Which single step is the most serious, and why?
Worked solution
- Step-by-step verdict
Step Verdict Why a. Listwise deletion Defensible, needs justification Fine if the data are plausibly MCAR and the loss is small, but it must be reported and it contradicts step (b) b. Blanks → 0 Error 0 is not a valid response on a 1–7 scale c. 999 left in Error 999 is a missing-value code, not an age d. Reverse by ×(−1) Error Produces −1 to −7, destroying the scale e. Dropped lowest scorers Serious error Selection on the outcome variable f. Merged on initials Error Collides, breaks on name changes, and is identifying g. Overwrote the raw file Serious error The original data no longer exists - Fixing (b) and (d) For (b), leave missing values missing and decide an item-level rule instead: compute the scale when at least 80% of its items were answered, prorating from the items that were, and set it to missing otherwise. Filling with 0 invents a response below the bottom of the scale and pulls every affected participant's total down. correct reverse-scoring: x' = (min + max) − x = 8 − x so 1 → 7, 2 → 6, 4 → 4, 7 → 1 Multiplying by −1 gives a range of −1 to −7, which is not the reversed scale. It corrupts every scale total that includes those three items without producing a single value that looks obviously wrong. Recompute the reversed items from the raw file, which is a problem given step (g).
- The true mean age total of all 240 ages = 240 × 33.2 = 7,968 the three sentinels contribute 3 × 999 = 2,997 remaining total = 7,968 − 2,997 = 4,971 true mean = 4,971 / 237 = 21.0 years Three cells inflated the reported mean by 12.2 years in a sample of 240. Missing-value codes do this whenever a pipeline treats them as data, so the first step of any cleaning workflow is to check every variable's minimum and maximum against its plausible range.
- The most serious step Step (e), with step (g) close behind. Removing the six lowest wellbeing scores is not cleaning. It deletes cases on the basis of the outcome variable, which raises the mean by construction, and the researcher can see the direction of the change while making it. If non-serious responding is a concern, screen for it with something independent of the outcome: attention-check items, implausibly fast completion times, straight-lining down a column. Step (g) does a different kind of damage. Raw data should be read-only and every transformation should be done in a script, so that the cleaned file can always be regenerated and any mistake in this log can be undone. As things stand, none of these errors can be reversed.
Five clear errors: 0 for missing on a 1–7 scale, a 999 sentinel treated as an age (which inflated the mean from 21.0 to 33.2), reverse-scoring by −1 instead of 8 − x, dropping the lowest scorers, and merging on initials. Overwriting the raw file makes all of them permanent.
From §2.4 The Cleaning Workflow, §2.5 Outliers and §2.9 Reproducible Workflows · the worked version is the survey-cleaning guide.
99The figure that made 0.27 look enormous
Exam-levelA retail consultancy sends its client a one-page summary of a store-layout trial. The figure is the whole page, and you have been asked whether the client should spend two million on the rollout.
- Bar chart, two bars, drawn with 3-D perspective
- y-axis runs from 7.2 to 7.8; satisfaction is measured on a 1–10 scale
- Layout A bar at 7.35, Layout B bar at 7.62
- No error bars anywhere on the figure
- A red arrow between the bars, labeled "+27% improvement"
- Caption: "Figure 2. Layout B clearly outperforms Layout A."
- List everything wrong with the figure.
- Where does "+27%" come from, and what is the correct figure?
- Using the appendix, is the difference distinguishable from zero?
- Describe the figure you would send instead.
Worked solution
- The catalog of problems The truncated axis is the biggest problem. Starting at 7.2 instead of 0 turns a 0.27-point gap into a bar nearly three times the height of its neighbor, since A's bar fills 25% of the plot height and B's fills 70%. Bars encode value by length, so a bar chart with a truncated axis misrepresents its own data. Beyond that: no uncertainty is shown, so a reader cannot tell a solid difference from noise; the 3-D perspective distorts the apparent heights and adds nothing; two bars summarize 79 stores and hide every distribution; and the caption asserts a conclusion ("clearly outperforms") that the figure does not establish and, as question 3 shows, is wrong.
- Where the 27% came from 7.62 − 7.35 = 0.27 points relative change = 0.27 / 7.35 = 3.7% Someone read the difference of 0.27 as "27%". The actual relative increase in the mean is 3.7%, and even that is questionable, because a 1–10 satisfaction scale has no meaningful zero, so percentage changes on it depend on an arbitrary origin. Report the difference itself: Layout B scored 0.27 points higher on a 10-point scale.
- Is it distinguishable from zero? s²pooled = [40(1.42²) + 37(1.38²)] / 77 = (80.66 + 70.46)/77 = 1.963 spooled = 1.401 SE = 1.401 × √(1/41 + 1/38) = 1.401 × .2252 = 0.3155 t(77) = 0.27 / 0.3155 = 0.86, p = .39 d = 0.27 / 1.401 = 0.19 No. A difference at least this large would arise about 39% of the time if the two layouts were identical. The figure's whole visual argument rests on a difference the data cannot distinguish from zero, so the two-million rollout has no evidence behind it. With d = 0.19, detecting an effect this small with 80% power would need over 400 stores per layout, not 40.
- The figure to send instead Plot the individual store scores as two columns of points, jittered so they do not overlap, with the group mean marked and a 95% confidence interval drawn around it. Run the y-axis across the full 1 to 10 scale, or across a clearly labeled subrange with the truncation stated in the caption. Drop the third dimension. Make the caption descriptive: "Figure 2. Mean customer satisfaction by store layout, with 95% confidence intervals. Individual stores shown as points; n = 41 and 38." The overlapping intervals will then show the result. If the recommendation is to keep testing, the figure should make that obvious at a glance.
Truncated axis, no error bars, gratuitous 3-D, a conclusion in the caption, and a "+27%" that is really a 0.27-point difference (3.7% in relative terms). The difference is not distinguishable from zero, t(77) = 0.86, p = .39, d = 0.19, so the rollout has no evidence behind it.
From §3.3 Tables & Figures That Don't Lie · check the size of the effect in the effect-size converter.
100Three things wrong with one sentence
Warm-upA results paragraph comes back from a co-author. The analysis is sound and every number was computed correctly, but the sentence breaks exactly three APA 7 formatting rules. Find them, then write the version that goes in the paper.
"Participants receiving immediate feedback (M = 78.4, SD = 8.6) were more accurate than those receiving delayed feedback (M = 74.1, SD = 8.9), t(58) = 1.90, p = 0.062, d = .49. Accuracy correlated with practice time, r(60) = .34, p = .008."
- Find the three formatting errors and name the rule behind each.
- Write the corrected sentence.
- Confirm that the numbers themselves are consistent.
- Your supervisor circles something else in the sentence that is not a formatting error. What?
Worked solution
- Error 1: a leading zero on p written: p = 0.062 correct: p = .062 Drop the leading zero from any statistic that cannot exceed 1 in magnitude: p, r, R², η², β and Cramér's V. A probability of 0.062 is never going to be 1.062, so the zero carries no information.
- Error 2: a missing zero on d written: d = .49 correct: d = 0.49 This is the reverse of the first rule, and students often miss it because they over-apply the first. Cohen's d can exceed 1, so it keeps its leading zero. The same goes for t, F, M and SD. The question to ask is not "is it a decimal?" but "can this quantity exceed 1?"
- Error 3: the wrong df on the correlation written: r(60) = .34 correct: r(58) = .34 The number in parentheses after r is degrees of freedom, not sample size, and for a correlation that is n − 2. With 60 participants the value is 58. Writing r(60) tells a careful reader you had 62 people, which contradicts the methods section. The t-test in the same sentence has the right df. Both are 58 here only by coincidence, so check each df separately.
- The corrected sentence "Participants receiving immediate feedback (M = 78.4, SD = 8.6) scored higher on accuracy than those receiving delayed feedback (M = 74.1, SD = 8.9), though the difference was not statistically significant, t(58) = 1.90, p = .062, d = 0.49. Accuracy correlated with practice time, r(58) = .34, p = .008."
- Checking the numbers SE = √[(8.6² + 8.9²)/30] = √(153.17/30) = 2.26 t = (78.4 − 74.1)/2.26 = 1.90 ✓, two-tailed p = .062 ✓ spooled = √[(8.6² + 8.9²)/2] = 8.75, so d = 4.3/8.75 = 0.49 ✓ for r = .34 with df = 58: t = .34√(58/(1 − .34²)) = 2.75, p = .008 ✓ Everything is consistent. The consistency check in the APA formatter does this automatically. Formatting errors and arithmetic errors are separate, and a sentence can have either without the other.
- What the supervisor circled "Were more accurate" states a difference at p = .062. That is not a formatting error; it is a claim the test does not support. The correction above replaces it with a description of the observed means and an explicit statement that the difference was not significant. Avoid two temptations: do not write "approached significance", and do not pretend the 4.3-point gap was not observed. Report the estimate, report that it is compatible with no difference at this sample size, and give the confidence interval to show the uncertainty.
Leading zero on p (should be .062), missing leading zero on d (should be 0.49), and r(60) where the degrees of freedom are n − 2 = 58. The numbers themselves are all consistent; the fourth problem, reporting a difference at p = .062, is a writing error, not a formatting one.
From §3.2 Reporting Statistics in APA Style and §3.5 Non-Significant Results · the rules are on the APA cheat sheet and applied by the APA formatter.
Worked through these? Take a scored mock exam, drill definitions with the flashcards, or move from pencil-and-paper numbers to real files with the practice datasets. Teachers: using this site in a course covers handouts, embeds and a fourteen-week map.