Real, or Big?
Look at the outbreak data, then test whether two group means differ and measure by how much. You'll use R.
Assumes: mean, standard deviation, the standard error of one mean, t-scores and p-values, and pressing Run on R code. In R you'll change one short piece of code at a time.
1. What's in the outbreak data?
A mid-sized city (about 100,000 residents) is having a winter outbreak of Mycoplasma pneumoniae (“walking pneumonia”), a bacterial respiratory infection. The city's health department has collected two small data sets, one row per person:
- fever.csv: diagnosis (
MP= Mycoplasma confirmed,No= tested negative for Mycoplasma) and the highest fever since symptoms began, in °F. Patients were picked at random from people who visited clinics with a fever during the outbreak. - WBC.csv: diagnosis and white blood cell count (cells per microliter of blood). Residents were picked at random from those tested at the department's community screening during the outbreak. Normal is roughly 4,500–11,000 cells per microliter; counts that are too high or too low are both dangerous.
Press Run. R reads both files, splits each measurement into the two diagnosis groups, and prints each group's count (number of patients), mean and SD, with a histogram of each group.
Read the table
In the fever_MP row, the mean is 102.04 °F and the sd is 1.28 °F. What does the 1.28 describe?
2. Could the gap between two means be chance?
A study compared two pesticides on wheat farms. Each farm's yield increase was measured in percentage points (“points”).
| Farms (n) | Mean increase (x̄) | SD (s) | |
|---|---|---|---|
| Pesticide 1 | 30 | 5 | 1 |
| Pesticide 2 | 20 | 9 | 3.5 |
Pesticide 2's farms gained 4 points more on average. Could that gap come from which farms happened to be in each group? The test: H₀: μ₁ = μ₂ (the two pesticides have the same mean over all farms) against HA: μ₁ ≠ μ₂. It works like the test for one mean, with the gap in place of the mean:
- SE of the gap = √(s₁²/n₁ + s₂²/n₂). Each group's mean wobbles by chance; the squared wobbles (s²/n) add, then you take the square root.
- t = (x̄₂ − x̄₁) ÷ SE: how many SEs apart the two means are.
- df = the smaller n − 1 (the safe rule in OpenIntro): here 20 − 1 = 19, and the p-value comes from t, as before.
Your task: in the se line, the pesticide 2 term is NA. Replace it with s2^2 / n2, then Run.
Hint 1
Pesticide 1's term iss1^2 / n1. Pesticide 2's uses s2 and n2.Hint 2
The first line should readse <- sqrt(s1^2 / n1 + s2^2 / n2).What does the p-value say?
The cell gives t ≈ 5.0 and p ≈ 0.00008. What does that p-value tell you?
3. How big is the gap?
The numbers so far. Pesticide 1: 30 farms, mean 5, SD 1. Pesticide 2: 20 farms, mean 9, SD 3.5. Gap: 9 − 5 = 4 points. SE of the gap: 0.80. t = 4 ÷ 0.80 ≈ 5.0.
An effect size measures how big a gap is. Cohen's d divides the gap by the spread of single farms, the pooled SD (both groups' SDs combined):
- d = (x̄₂ − x̄₁) ÷ pooled SD
- pooled SD = √( ((n₁ − 1)s₁² + (n₂ − 1)s₂²) ÷ (n₁ + n₂ − 2) ). Each group's s² is weighted by n − 1, so the bigger group counts more. With equal groups it is simply √((s₁² + s₂²) ÷ 2).
t divided the 4-point gap by the SE (0.80). d divides the same gap by the pooled SD, the spread of single farms. Before you run the cell: d will be…
Your task: replace the NA in the d line with the gap in means, pesticide 2 minus pesticide 1: (x2 - x1). Then Run.
Hint 1
The means arex1 and x2.Hint 2
The line should readd <- (x2 - x1) / sd_pooled. Keep the brackets: without them R divides only x1.Your prediction
You predicted smaller than 5, and the cell gives d ≈ 1.7 (4 ÷ 2.34). t divides by the SE (0.80), which shrinks as the groups grow; d divides by the spread of single farms (2.34), which doesn't. One step further: if the gap had been 2 points with the same SDs, d would be 2 ÷ 2.34 ≈ 0.85.
You predicted d would be about 5, like t. Both divide the 4-point gap by a spread, but not the same one: t by the SE of the gap (0.80), d by the spread of single farms (2.34), which is much bigger. So d ≈ 4 ÷ 2.34 ≈ 1.7. One step further: if the gap had been 2 points with the same SDs, d would be 2 ÷ 2.34 ≈ 0.85.
You predicted d would be bigger than 5. d divides the gap by the spread of single farms (2.34), which is bigger than the SE of the gap (0.80) that t used, so d comes out smaller: 4 ÷ 2.34 ≈ 1.7. One step further: if the gap had been 2 points with the same SDs, d would be 2 ÷ 2.34 ≈ 0.85.
Reading d. d ≈ 1.7 means the two means are 1.7 pooled SDs apart. Cohen's rough guide: 0.2 small, 0.5 medium, 0.8 large; what counts as large depends on the field. Here the effect is large.
4. A tiny gap in a huge study
A new study. Two fertilizers, A and B, on wheat farms. Farms with A gain 6.0 points on average, farms with B 6.2: a gap of 0.2 points. On single farms the gain varies a lot: SD 2 points in both groups. So d = 0.2 ÷ 2 = 0.1, a tiny effect.
Suppose the study had 5,000 farms in each group and found the same 0.2-point gap and SDs. The two-sided p-value would be…
Now pick the number of farms in each group. R works out the test for that n, the same way as in step 2. Left: single farms with A (solid) and B (dashed). Right: the gaps chance alone would give if A and B were the same, with the 0.2-point gap in red; the shaded tails are the p-value.
You predicted high: a 0.2-point gap looks too small to be significant. Click n = 20, then 500, then 5,000. At 20 farms per group p is high (0.755). At 5,000 it is below 0.001: low. The gap, the left-hand curves and d = 0.1 never change.
Some people predict low instead: “with 5,000 farms in each group, the two means are measured so precisely that a 0.2-point gap is very unlikely to come from chance alone.”
Look at the right-hand plot at n = 20 and at n = 5,000. Why is that prediction better than yours?
Why the p-value falls. The SE of the gap is √(2²/n + 2²/n). With 20 farms per group it is 0.63 points, so a 0.2-point gap is well inside what chance gives (t = 0.32). With 5,000 per group it is 0.04, and 0.2 is 5 SEs out (t = 5). The p-value asks “could chance alone give a gap this big?”, and the answer depends on n. Cohen's d asks “how big is the gap next to the spread of single farms?”, and it is 0.1 at every n.
Two kinds of significance. Statistically significant: p below the cutoff, so chance is an unlikely explanation. Practically significant: big enough to matter, judged from the effect size and the context. With 5,000 farms per group the gap is statistically significant but probably too small to matter (d = 0.1).
Another case: a sleep study with 10,000 people per group finds a new pill adds 2 minutes of sleep a night (SD 60 minutes). SE = 60 × √(2 ÷ 10,000) ≈ 0.85, t = 2 ÷ 0.85 ≈ 2.4, p ≈ 0.02 (low). But d = 2 ÷ 60 ≈ 0.03.
You predicted low, and that's right. Click n = 20, then 500, then 5,000. At 20 farms per group p is high (0.755); at 5,000 it is below 0.001. The gap, the left-hand curves and d = 0.1 never change.
Some people say: “a 0.2-point gap is tiny, so it can't be statistically significant.”
Using the right-hand plot, how would you explain to them why p is low with 5,000 farms in each group?
Why the p-value falls. The SE of the gap is √(2²/n + 2²/n). With 20 farms per group it is 0.63 points, so a 0.2-point gap is well inside what chance gives (t = 0.32). With 5,000 per group it is 0.04, and 0.2 is 5 SEs out (t = 5). The p-value asks “could chance alone give a gap this big?”, and the answer depends on n. Cohen's d asks “how big is the gap next to the spread of single farms?”, and it is 0.1 at every n.
Two kinds of significance. Statistically significant: p below the cutoff, so chance is an unlikely explanation. Practically significant: big enough to matter, judged from the effect size and the context. With 5,000 farms per group the gap is statistically significant but probably too small to matter (d = 0.1).
Another case: a sleep study with 10,000 people per group finds a new pill adds 2 minutes of sleep a night (SD 60 minutes). SE = 60 × √(2 ÷ 10,000) ≈ 0.85, t = 2 ÷ 0.85 ≈ 2.4, p ≈ 0.02 (low). But d = 2 ÷ 60 ≈ 0.03.
5. Say it in your own words
In 2–3 sentences: what is the difference between statistical significance and practical significance? Then make up an example of your own: a result that is statistically significant but not practically significant.
One way to say it. Statistical significance asks whether chance alone would rarely give a difference this big. It is judged with a p-value, which, for the same gap, gets smaller as the samples get bigger. Practical significance asks whether the difference is big enough to matter. It is judged with an effect size such as Cohen's d (the gap in units of the SD of single cases) and the context. Example: a store tests a new website layout on 50,000 shoppers in each group, and the average basket rises by $1 on about $60 (SD $30). p is below 0.001, but d = 1 ÷ 30 ≈ 0.03, and $1 may not pay for the redesign.
Compare with yours: did you say why the two can disagree, that the p-value depends on the sample size and d doesn't? And is the gap in your example small next to the spread of single cases, not just small in its units?
6. Check yourself
A tutoring app study. 4,000 students used the app and 4,000 did not. App users averaged 0.5 points higher on a 100-point exam. SD of single students' scores: 10 points in both groups. SE of the gap: √(10²/4000 + 10²/4000) ≈ 0.22. The test gives p ≈ 0.025.
Cohen's d = gap ÷ pooled SD (here the pooled SD is 10).
Which conclusion fits?
How sure were you?
You should now be able to:
- tell the SD of single values from the SE of a mean (step 1);
- work out the SE, t and p-value for the gap between two means (step 2);
- work out Cohen's d with the pooled SD, and say what it measures (step 3);
- explain why a gap can be statistically significant but too small to matter (step 4).
If one of these isn't clear yet, go back to the step in brackets.
Welcome back: two quick questions
Group A averages 64 on a test and group B averages 70. The pooled SD is 12. Cohen's d (B minus A) is…
A study is repeated with four times as many people in each group, and finds the same means and SDs. Compared with the first study…
Assumptions
- dataThe outbreak data are made up for this page; they are not real Mycoplasma pneumoniae data. 98 fever patients (60 without Mycoplasma, 38 with it) and 164 white blood cell counts (150 without, 14 with); neither looks normal (fever without the infection and both WBC groups lean right).
- dataThe pesticide numbers (30 farms: mean 5, SD 1; 20 farms: mean 9, SD 3.5) are a textbook-style practice problem. The fertilizer, sleep, store and tutoring studies are invented for the page.
- simplificationDegrees of freedom = the smaller n − 1, OpenIntro's conservative rule. R's
t.test()uses a more exact (Welch) df and gives slightly smaller p-values. - simplificationAll tests are two-sided. Step 4 uses summary numbers (gap 0.2, SD 2 in both groups), not simulated farms.
- interpretationCohen's 0.2 / 0.5 / 0.8 (small / medium / large) is a rough guide; what counts as large depends on the field.
Left out: the conditions for inference, one-sided tests, confidence intervals for a difference, and testing the outbreak data (the in-class investigation).