When we compare the averages of two groups using samples, the gap between our sample averages is only one batch's estimate, so we need an interval for how far apart the true averages really are.
1
Standard error of a difference in means
To know how wide to make that interval, we first need the standard error of the difference between two sample means: how much the gap between the two sample averages typically varies from batch to batch.
Remember that for a single sample of size n with sample standard deviation s, the sample mean xˉ is more stable than an individual measurement and varies from batch to batch with a standard error of:
SE=ns
Suppose we test a random sample of n1=25 Brand A headphones (xˉ1=55 hours,s1=15 hours) and an independent random sample of n2=16 Brand B headphones (xˉ2=40 hours,s2=16 hours) to see how much the gap between their sample averages varies.
Standard error of a difference in means
Text solution
Subtract the sample averagesStart with the gap between the two sample means as our center estimate.
xˉ1−xˉ2=55−40=15 hours
Standard error of each sample meanDivide each brand's sample standard deviation by the square root of its sample size to find how much each average varies on its own.
So our sample gap is 15 hours, and from batch to batch that gap typically varies by about 5 hours.
Try changing Brand B's standard error to see how the combined standard error stretches along the hypotenuse. Whenever both brands vary, it is larger than either brand's standard error alone, but shorter than the two added directly together because independent variations partially cancel out.
Two standard errors combine like the diagonal of a right triangle: when both brands vary, it's longer than either one alone, and shorter than adding them end-to-end.
2
Degrees of freedom and building the interval
Now that we have the 15-hour sample gap and its 5-hour standard error, we want to extend a margin of error to either side to build a 95% confidence interval for the true difference in means.
Just like in a one-sample t interval, estimating the population standard deviations from sample standard deviations s1 and s2 adds extra uncertainty, so we multiply the standard error by a larger t∗ value instead of the normal multiplier 1.96. For a single sample, we looked up t∗ using n−1 degrees of freedom, but now we have two different sample sizes, n1=25 and n2=16.
Degrees of freedom and building the interval
Brand A:
n1=25,
xˉ1=55,
s1=15
Brand B:
n2=16,
xˉ2=40,
s2=16
95% confidence interval=15±?×5
A−B
15
SE=5
−10
0
10
hours
Text solution
Cautious degrees of freedom by handSubtract 1 from the smaller sample size (n2=16) to look up the 95% multiplier on a t-table.
df=16−1=15⟹t∗=2.13
Multiply for the margin of errorMultiply the 5-hour standard error by t∗ to find how far the interval reaches on each side of the 15-hour gap.
Margin of error=t∗×SE=2.13×5=10.65 hours
Add and subtract from the sample gapSubtract and add the margin of error around the 15-hour difference to find the interval endpoints.
So our 95% confidence interval for the difference in average battery life is [4.35 hours,25.65 hours] by hand, or [4.80 hours,25.20 hours] using a calculator or software, which finds df=30.6 and t∗=2.04.
Putting the sample gap and margin of error together gives the two-sample t interval for a difference in means:
sample gap(xˉ1−xˉ2)±margin of errort∗n1s12+n2s22
When working by hand on a test, always use the smaller sample size minus 1 for df. If a problem gives you the degrees of freedom from a calculator or software, that formula combines both sample sizes and standard deviations to count information from both batches, giving a larger df, a smaller t∗, and a slightly narrower interval.
3
Interpreting the interval and checking for zero
Now that we have the interval [4.35 hours,25.65 hours], we want to see what its endpoints tell us about the two brands and decide whether the data give convincing evidence that one brand lasts longer on average.
Look at how the conclusion changes if Brand A's sample had averaged 46 hours instead of 55 hours, with the same 10.65-hour margin of error.
Interpreting the interval and checking for zero
95% confidence interval[4.35,25.65] hours
A−B
4.35
15
25.65
−10
0
10
20
hours
Convincing evidence thatBrand A lasts longer?
0(no difference)
4.35
15
25.65
−4.65
6
+16.65
−20
−10
0
10
20
hours
Negative:B beats A
Positive:A beats B
Text solution
Subtract the new sample averagesWhen Brand A averages 46 hours and Brand B averages 40 hours, the sample gap shrinks to 6 hours.
xˉ1−xˉ2=46−40=6 hours
Add and subtract the margin of errorGoing 10.65 hours to either side of 6 takes the lower endpoint past zero into negative numbers.
Because we subtracted Brand A−Brand B, Brand A might average up to 4.65 hours less than Brand B or up to 16.65 hours more, and since 0 (no difference) sits inside the interval, we do not have convincing evidence of a difference between the two brands.
Slide Brand A's sample average to see how the confidence interval moves across 0. As long as the whole interval stays on one side of 0, every plausible value favors the same brand. Once the interval crosses 0, either brand could be higher, and a tie of 0 is also plausible.
The difference between two sample averages gives convincing evidence of a true difference only when the entire confidence interval stays on one side of zero.
4
Experiments and causal conclusions
Sampling two existing products tells us whether their population averages differ, but when we want to find out whether a treatment actually causes a change in the average, we run a randomized experiment instead.
Suppose 40 volunteers with insomnia are randomly assigned into two groups of 20, one taking a tart cherry supplement and the other taking a placebo, and subtracting Placebo−Supplement gives a 95% confidence interval of [8 minutes,22 minutes] for the difference in time to fall asleep.
Experiments and causal conclusions
40 volunteers
random assignment
Supplement
Placebo
0
20
40
60
minutes to fall asleep
The math works the exact same way, with df=20−1=19 by hand. Because the 40 volunteers were randomly assigned to balance out natural sleep differences, and [8 minutes,22 minutes] sits entirely above 0, we have convincing evidence that the supplement causes people like the volunteers to fall asleep between 8 and 22 minutes faster on average.
5
Conditions for a two-sample t interval
Before trusting a two-sample t interval in either a sampling study or an experiment, we check three conditions to make sure the standard error formula and the t∗ multiplier are valid.
Conditions for a two-sample t interval
1.Random
2.Independent
3.Normal or Large Sample
Random: The data come from two separate random samples, or from two groups formed by random assignment in an experiment.
Independent: Measurements within each group are independent (when sampling without replacement, each sample is less than 10% of its population), and the two groups themselves are independent of each other, not paired measurements on the same individuals.
Normal / Large Sample: Both sample sizes are at least 30 (n1≥30 and n2≥30) so the Central Limit Theorem makes the sampling distribution roughly normal automatically; any sample under 30 must have a graph of its data showing no strong skewness or outliers.
Key concepts
Here is the whole decision and calculation in one place:
Two separate groups vs. paired data
Use a two-sample t interval when comparing two independent groups, such as n1=25 Brand A headphones and n2=16 Brand B headphones, or 40 volunteers randomly split into two groups of 20. Do not use this method when the exact same individuals are measured twice (such as 20 people timed on a placebo one week and a supplement the next). That is paired data, where you subtract each person's two numbers first and run a one-sample t interval on their individual differences.
Three conditions first
Check for two random samples or random assignment (Random), separate groups with samples under 10% of their populations when sampling without replacement (Independent), and bothn1≥30 and n2≥30 (Normal / Large Sample). For each sample under 30 (like 25 and 16, so both here), check its graph for strong skewness or outliers.
Building the interval on a right triangle
Start with the sample gap xˉ1−xˉ2, square and add the two individual standard errors n1s1 and n2s2 under a square root, and multiply by t∗:
(xˉ1−xˉ2)±t∗n1s12+n2s22
For our headphones, (55−40)±2.1325152+16162=15±2.13(5)=[4.35,25.65] hours, where by hand we look up t∗ using the smaller sample size minus 1 (df=16−1=15).
Signs, zero, and causation
Write down your subtraction order (Group 1−Group 2) first: positive values favor Group 1, negative values favor Group 2, and 0 means a tie. An interval entirely on one side of 0 (like [4.35,25.65]) gives convincing evidence of a difference (and of a cause-and-effect relationship if treatments were randomly assigned), while an interval that crosses 0 (like [−4.65,+16.65]) does not, though 95% confidence never means 100% certainty.
6
Practice
1
A safety inspector tests the breaking strength of two brands of climbing rope using independent random samples. For Brand A, a sample of n1=36 ropes has an average breaking strength of xˉ1=520 pounds and a standard deviation of s1=36 pounds. For Brand B, a sample of n2=25 ropes has an average breaking strength of xˉ2=475 pounds and a standard deviation of s2=40 pounds. For 95% confidence, a t-table gives t∗=2.06 for df=24,t∗=2.03 for df=35, and t∗=2.00 for df=59. Using the cautious by-hand method, find the 95% confidence interval for the true difference in mean breaking strength (Brand A−Brand B).
Watch out: adding the standard errors directly as 6+8=14 pounds would ignore how independent variations partially cancel, and give a wrong interval of [16.16,73.84].By hand, use the smaller sample size minus 1 to get df=25−1=24 and t∗=2.06 (be careful not to use the larger sample's df=35 or df=35+24=59 from adding both samples' degrees of freedom, which would give t∗=2.03 or 2.00 and make the interval too narrow at [24.7,65.3] or [25.0,65.0]).
Find the standard error ns for each brand first, then combine them on a right triangle; which of the two sample sizes decides the cautious by-hand df?
The sample difference is:
xˉ1−xˉ2=520−475=45 pounds
The individual standard errors are SE1=3636=6 pounds for Brand A and SE2=2540=8 pounds for Brand B. Combine them on a right triangle (watch out: adding the standard errors directly as 6+8=14 pounds would ignore how independent variations partially cancel, and give a wrong interval of [16.16,73.84]):
SE=62+82=36+64=100=10 pounds
By hand, use the smaller sample size minus 1 to get df=25−1=24 and t∗=2.06 (be careful not to use the larger sample's df=35 or df=35+24=59 from adding both samples' degrees of freedom, which would give t∗=2.03 or 2.00 and make the interval too narrow at [24.7,65.3] or [25.0,65.0]). The margin of error is 2.06×10=20.6 pounds, giving 45±20.6, or [24.4 pounds,65.6 pounds].
2
A school district takes independent random samples of ninth graders and twelfth graders to compare their daily screen time. Subtracting Ninth Grade−Twelfth Grade, the 95% confidence interval for the difference in population means is [−18 minutes,+34 minutes]. Explain what the negative and positive endpoints mean in context, decide whether the interval gives convincing evidence of a difference in average screen time between the two grades, and explain whether an interval of [+4 minutes,+56 minutes] would prove with 100% certainty that ninth graders average more screen time.
Write out Ninth Grade−Twelfth Grade to see which grade is higher when the difference is negative versus positive, then check whether 0 sits inside the interval.
Because the subtraction order is Ninth Grade−Twelfth Grade,−18 minutes means ninth graders might average up to 18 minutes less screen time per day than twelfth graders (watch out for reversing the order and thinking −18 means twelfth graders average 18 minutes less), while +34 minutes means ninth graders might average up to 34 minutes more. Because 0 (no difference) is inside the interval, there is not convincing evidence of a difference in average daily screen time between the two grades (don't be fooled into saying there is convincing evidence just because +34 is farther from 0 than −18). Even if the interval were [+4 minutes,+56 minutes] (entirely above 0), it would provide convincing evidence that ninth graders average more screen time, but never 100% certainty, because about 5% of samples give a 95% confidence interval that misses the true difference, and we can't tell whether ours is one of them.
3
Fifty adult volunteers who suffer from high blood pressure are randomly assigned into two groups of 25: one group drinks a hibiscus tea daily for four weeks, and the other drinks a look-alike placebo tea. At the end of the experiment, researchers measure systolic blood pressure and calculate a 95% confidence interval for Hibiscus Tea−Placebo of [−14.2 mmHg,−2.8 mmHg]. Explain why the Random condition is met even though the participants are volunteers, interpret the interval in context, and state whether there is convincing evidence that the hibiscus tea causes a reduction in blood pressure.
Check how the 50 volunteers were placed into the two tea groups, and look at the subtraction order (Hibiscus Tea−Placebo) to see what negative endpoints mean for blood pressure.
Although the 50 participants were not randomly sampled from a population (watch out for saying the Random condition fails because they are volunteers), the Random condition is met because the volunteers were randomly assigned to the two treatments, which balances natural differences between the groups. Because we subtracted Hibiscus Tea−Placebo, negative values mean the hibiscus tea group had lower blood pressure: we are 95% confident that for people like the volunteers in this study (be careful not to generalize to all adults), drinking the hibiscus tea reduces average systolic blood pressure by between 2.8 mmHg and 14.2 mmHg compared to the placebo. Because the entire interval is negative and does not contain 0, there is convincing evidence that the hibiscus tea causes a lower average systolic blood pressure.
4
A student compares two independent random samples: Group 1 has n1=17,xˉ1=82, and s1=20, while Group 2 has n2=36,xˉ2=70, and s2=18. Because the student subtracts the means (82−70=12), they also subtract the standard errors (1720−3618=4.85−3=1.85) and use df=36−1=35 for a by-hand t∗ lookup. Identify both mistakes in the student's work, calculate the correct standard error and by-hand degrees of freedom, and state whether using a calculator's degrees of freedom (df=28.7) would make the resulting confidence interval wider or narrower.
First, standard errors are never subtracted. Having two sample averages that vary makes the gap between them less stable, not more stable, so we square both standard errors, add them together, and take the square root.Watch out for adding the unsquared standard errors 4.85+3=7.85 before taking the square root, which would give 2.80.
Ask what having two varying sample averages does to the stability of the gap between them, and check which of the two sample sizes (n1=17 or n2=36) sets the by-hand degrees of freedom.
First, standard errors are never subtracted. Having two sample averages that vary makes the gap between them less stable, not more stable, so we square both standard errors, add them together, and take the square root (and watch out for adding the unsquared standard errors 4.85+3=7.85 before taking the square root, which would give 2.80):
SE=17202+36182=23.53+9=32.53≈5.70
Second, the cautious by-hand method uses the smaller sample size minus 1, which is df=17−1=16 (not 35). A calculator's df=28.7 counts information from both samples, giving a smaller t∗ multiplier and a narrower, more precise confidence interval than the by-hand method with df=16 (don't think a larger df makes the interval wider; more degrees of freedom means less uncertainty from estimating the standard deviations, which shrinks t∗).
5
For each study below, determine whether all three conditions (Random, Independent, and Normal / Large Sample) are met for a two-sample t interval for a difference in means, and explain why: (A) A coach times a random sample of 22 swimmers in a 100-meter race wearing standard suits on Monday and times the exact same 22 swimmers wearing racing suits on Friday to compare the two sets of 22 times. (B) A biologist takes independent random samples of 14 fish from Lake X and 45 fish from Lake Y (both huge lakes); a plot of the 14 fish from Lake X shows a strong outlier, while the 45 fish from Lake Y are slightly skewed. (C) An economist takes independent random samples of 40 apartments in City A and 50 apartments in City B (each less than 10% of all apartments in its city); histograms of both samples show moderate right skewness with no extreme outliers.
In each study, check whether the two groups are separate individuals or the same individuals measured twice, and whether both sample sizes reach 30 when skewness or outliers are present.
(A) Not validThe Independent condition is violated because the exact same 22 swimmers are measured twice (watch out for treating the two sets of 22 times as independent groups just because there are two lists of numbers), making this paired data that requires a one-sample t interval on each swimmer's individual time difference.
(B) Not validThe Normal / Large Sample condition is violated because both groups must be at least 30 for the Central Limit Theorem to apply automatically (be careful not to add the sample sizes as 14+45=59≥30 or assume Lake Y's n2=45 makes up for Lake X), and here Lake X has n1=14<30 with a strong outlier in its sample data.
(C) ValidAll three conditions are met because the data come from two independent random samples that are each less than 10% of their populations, and both sample sizes are at least 30 (n1=40≥30 and n2=50≥30), so the Central Limit Theorem makes the sampling distribution of the difference in means roughly normal despite moderate skewness.