Real, or Big?
Look at the outbreak data, then test whether two group means differ and see what the confidence interval for the gap says.
Assumes: mean, standard deviation, the standard error of one mean, t-scores and p-values, t confidence intervals for one mean, and pressing Run on R code. There is one short R edit.
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 pesticide 2's term, written the same way as pesticide 1's, then Run.
Hint 1
Pesticide 1's term iss1^2 / n1. Pesticide 2's uses s2 and n2.Hint 2
Pesticide 2's term is its SD squared, divided by its number of farms: copys1^2 / n1 and change both 1s to 2s.What does the p-value say?
The cell gives t ≈ 5.0 and p ≈ 0.00008. What does that p-value tell you?
What does the interval for the gap say?
The numbers. Gap: x̄₂ − x̄₁ = 9 − 5 = 4 points. SE of the gap: 0.804 (your cell's output). Two-sided p ≈ 0.00008.
95% confidence interval for μ₂ − μ₁ = gap ± t* × SE. σ is unknown (we used each group's s), so t* comes from the t-distribution, with df = the smaller n − 1 = 19, as in the test: in R, qt(0.975, 19) ≈ 2.093.
Work out the 95% interval for μ₂ − μ₁. Does it include 0, and how does that fit with the p-value?
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, and say what the p-value means (step 2);
- build a 95% t interval for the gap and say why it leaves out 0 exactly when the two-sided p-value is below 0.05 (step 2).
If one of these isn't clear yet, go back to the step in brackets.
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.
- simplificationDegrees of freedom = the smaller n − 1, OpenIntro's conservative rule, for both the test and the interval. R's
t.test()uses a more exact (Welch) df and gives a slightly smaller p-value and a slightly narrower interval. - parameterSE of the gap = √(1²/30 + 3.5²/20) ≈ 0.804; t ≈ 4.98; two-sided p ≈ 0.00008; t* = qt(0.975, 19) ≈ 2.093, so the 95% interval is about 2.32 to 5.68 points.
- simplificationThe test is two-sided, matching the two-sided 95% interval.
Left out: effect size (Cohen's d) and statistical vs practical significance (a later lesson), the conditions for inference, one-sided tests, and testing the outbreak data (the in-class investigation).