Educerie

Educerie · AP · Statistics

AP Statistics 4.10

Carrying Out a Test for the Difference Between Two Population Means

How can a sample of numerical measurements tell us about the mean of a whole population, and how sure can we be?

What you will learn

  • Know how to calculate the two-sample t statistic and find its degrees of freedom and p-value
  • Understand how to interpret the p-value in context
  • Know how to make the decision and write the conclusion in terms of the alternative
  • Understand how the test and the interval agree

You must be able to

  1. Calculate the t statistic from summary values
  2. Find the p-value for the correct tail or tails and check df is in range
  3. Interpret the p-value as a probability, computed assuming equal population means
  4. Make the decision by comparing the p-value with alpha using both numbers
  5. Write the conclusion in context, in terms of the alternative, with convincing evidence
  6. Explain why a cause is claimed only after random assignment

In the exam. Section I multiple choice: the tt statistic from summary numbers, the tail for the p-value, the right reading of the p-value, or the decision and conclusion. In Section II (Q3 and Q4) this is the calculation and conclusion half of a full test of two means: tt, the degrees of freedom, the p-value, a comparison with α\alpha, and a conclusion in context. Common slips are comparing tt with α\alpha, using the wrong tail, and stating a conclusion about H0H_0 or in definitive language.

1The test statistic

The formula sheet gives the pattern "statistic minus parameter over standard error". For two means, with the null difference 0:

t=(xˉ1−xˉ2)−0s12n1+s22n2the standard error is the one from Topic 4.7t=\frac{(\bar x_1-\bar x_2)-0}{\sqrt{\dfrac{s_1^2}{n_1}+\dfrac{s_2^2}{n_2}}} \qquad \textcolor{#838c91}{\text{the standard error is the one from Topic 4.7}}

When H0H_0 is true, tt has a t-distribution. The degrees of freedom come from technology. They lie between the smaller of n1−1n_1-1 and n2−1n_2-1, and n1+n2−2n_1+n_2-2.

Check your df against that range. A df of 8 from samples of 35 and 32 would be an error.

There is no pooled version of the standard error here. Each sample keeps its own ss. When a calculator asks "Pooled?", choose "No".

2The p-value

The p-value is a tail area under the t-distribution with those degrees of freedom, set by HaH_a.

  • Ha:μ1−μ2>0H_a:\mu_1-\mu_2>0: the area to the right of tt.
  • Ha:μ1−μ2<0H_a:\mu_1-\mu_2<0: the area to the left of tt.
  • Ha:μ1−μ2≠0H_a:\mu_1-\mu_2\ne 0: the area in both tails beyond ±∣t∣\pm|t|, twice the one-tail area.

Use technology and write what you entered. With a table only, use the smaller of n1−1n_1-1 and n2−1n_2-1 as df, or the next lower row if that df is not printed (Table B prints 1 to 30, then 40, 50, 60, 80, 100 and 1000). Table B then gives a range for the p-value, a little larger than the exact one.

3Interpreting the p-value

A correct interpretation has three parts: a probability of a result at least as extreme, in the direction of HaH_a, computed assuming H0H_0 is true (the population means are equal, in context), and the context.

It is not the probability that H0H_0 is true.

4Worked example: an experiment

The teacher from Topic 4.9 randomly assigned 35 students to solve a puzzle with music and 32 to solve it in silence. Times in seconds:

GroupnnMeanStandard deviation
Music (group 1)3521238
Silence (group 2)3223241

Set-up. Two-sample t-test for a difference between population means. μ1\mu_1 = the mean puzzle time, in seconds, of all students like these who would solve it with music; μ2\mu_2 = the same for silence. H0:μ1−μ2=0H_0:\mu_1-\mu_2=0 and Ha:μ1−μ2<0H_a:\mu_1-\mu_2<0, with α=0.05\alpha=0.05. The conditions are met: a randomized experiment, and both groups have at least 30 students.

Statistic. The observed difference is 212−232=−20212-232=-20.

SE=38235+41232=41.26+52.53=9.68SE=\sqrt{\frac{38^2}{35}+\frac{41^2}{32}}=\sqrt{41.26+52.53}=9.68
t=−209.68=−2.07t=\frac{-20}{9.68}=-2.07

Degrees of freedom and p-value. Technology gives df =63.2=63.2, between 31 and 65, as it should be. The area to the left of t=−2.07t=-2.07 is 0.02150.0215.

Figure 1. The two-sample t-statistic is about -2.07, found with the degrees of freedom technology gives, 63.2: the p-value 0.0215 is the shaded area to the left of it −4 −2 0 2 4 density t t = −2.07 p-value = 0.0215
Figure 1 · The two-sample t-statistic is about -2.07, found with the degrees of freedom technology gives, 63.2: the p-value 0.0215 is the shaded area to the left of it

Read Figure 1 in this order:

  • The curve is the t-distribution when H0H_0 is true, centered at 0.
  • The amber line marks the observed t=−2.07t=-2.07, 2.07 standard errors below 0.
  • The alternative says music lowers the mean, so the left tail is shaded. Its area, 0.0215, is the p-value.

With a table, the smaller of 34 and 31 is 31, but Table B has no row for 31. Use the next lower row, df =30=30: the table gives t=2.042t=2.042 for a tail probability of 0.025 and t=2.457t=2.457 for 0.01. Our ∣t∣=2.07|t|=2.07 lies between, so the p-value is between 0.01 and 0.025. This agrees with the exact 0.0215.

Interpretation. Assuming the mean puzzle times with music and in silence are equal, the probability of getting a difference in sample means of -20 seconds or lower, in groups of 35 and 32 assigned at random, is 0.0215.

Decision. The p-value 0.0215 is less than α=0.05\alpha=0.05, so we reject H0H_0.

Conclusion. There is convincing evidence that the mean puzzle time of students like these is lower with music than in silence. Because students were randomly assigned, the data support music as the cause of the lower time.

If the teacher had asked only whether the means differ, the p-value would be 2(0.0215)=0.0432(0.0215)=0.043. It is still below 0.05 here, but a borderline case could flip, which is why HaH_a comes from the question.

5Worked example: small samples

Return to the study app from Topic 4.7. App group: n1=12n_1=12, xˉ1=84.92\bar x_1=84.92, s1=7.15s_1=7.15. No-app group: n2=14n_2=14, xˉ2=76.29\bar x_2=76.29, s2=6.31s_2=6.31. Students were randomly assigned, and the boxplots show no outliers and no strong skew. Test whether the app raises the mean score, at α=0.05\alpha=0.05.

  • H0:μ1−μ2=0H_0:\mu_1-\mu_2=0 and Ha:μ1−μ2>0H_a:\mu_1-\mu_2>0, with μ1\mu_1 the mean quiz score of all students like these who would use the app and μ2\mu_2 the mean of those who would not.
  • SE=2.665SE=2.665, so t=8.632.665=3.24t=\dfrac{8.63}{2.665}=3.24.
  • Technology: df =22.2=22.2, and the right-tail area is 0.00190.0019.
  • Table check with df =11=11: t=3.106t=3.106 for 0.005 and t=3.497t=3.497 for 0.0025. Our t=3.24t=3.24 lies between, so the p-value is between 0.0025 and 0.005, a little above the exact 0.0019 because df 11 is conservative.

Decision. 0.0019<0.050.0019<0.05, so we reject H0H_0.

Conclusion. There is convincing evidence that the mean quiz score of students like these is higher with the app than without it.

Notice that the Topic 4.7 interval, (3.11, 14.16), agrees. It was entirely above 0.

6The decision and the conclusion

  • Decision. Compare the p-value with α\alpha using both numbers. If p-value ≤α\le\alpha, reject H0H_0. If p-value >α>\alpha, fail to reject. Never say "accept H0H_0".
  • Conclusion. State it in context, in terms of HaH_a, with non-definitive language, and refer to both populations.

Reject: "There is convincing evidence that the mean ... of [population 1] is [less than / greater than / different from] that of [population 2]."

Fail to reject: "There is not convincing evidence that the mean ... of [population 1] is [less than / greater than / different from] that of [population 2]."

For an experiment with random assignment, you may say the treatment caused the difference. For two samples from existing populations, you may not.

7A test and an interval agree

For a two-sided test at α=0.05\alpha=0.05 and a 95% interval for μ1−μ2\mu_1-\mu_2, the results fit together. If 0 is outside the interval, the p-value is below 0.05. If 0 is inside, it is above.

Example: the gym samples (A: n=30n=30, xˉ=52.1\bar x=52.1, s=8.4s=8.4; B: n=34n=34, xˉ=47.6\bar x=47.6, s=9.7s=9.7) give the interval (-0.02, 9.02) in Topic 4.7. Zero is just inside, and the two-sided test has t=1.99t=1.99 and a p-value of 0.051, just above 0.05. They agree.

Practice questions

30 questions on this note, from easy to hard. Each one you get right lights a star of this topic's constellation.