Tutorials › AP Statistics › Worked Example: Interval for Two Group Means

Two-sample t confidence intervals · Tutorial 708 of 1000

Worked Example: Interval for Two Group Means

Work through the arithmetic for a 95% interval estimating the difference between two independent population means.

Intermediate 9 min read

What You'll Learn

  • Identify the center of a two-sample t interval from the stated subtraction order.
  • Calculate the standard error from two sample standard deviations and sample sizes.
  • Use Welch degrees of freedom to select a 95% t critical value.
  • Calculate the margin of error and both interval endpoints by hand.
  • Check the conditions and report the interval in context with appropriate rounding.

Build the Interval One Part at a Time

In “Using 2-SampTInt on Your Calculator,” you saw how a calculator produces an interval from summary statistics or raw data. Here, we do the arithmetic by hand. This makes each part of the interval visible and gives you a way to check calculator output.

The target is a 95% confidence interval for \(\mu_1-\mu_2\), the difference between two population means in the order population 1 minus population 2. As in “The Form of a Two-Sample t Interval,” the interval is centered at the observed difference in sample means. Its margin of error is a t critical value multiplied by the standard error.

Formula: For two independent samples, calculate a confidence interval for \(\mu_1-\mu_2\) as the difference in sample means plus or minus a t critical value times the standard error:
$$ (\bar{x}_1-\bar{x}_2)\ \pm\ t^* \sqrt{\frac{s_1^2}{n_1}+\frac{s_2^2}{n_2}} $$
Here, \(t^*\) is chosen for the confidence level and the Welch degrees of freedom. The standard error estimates the variability of \(\bar{x}_1-\bar{x}_2\).

Hand Calculation: A Reliable Sequence

Start by writing down which group is sample 1 and which is sample 2. This determines the subtraction order in both the statistic and the interval. Then calculate the center, standard error, degrees of freedom, critical value, and margin of error—in that order.

1
Set the order and find the center.
Calculate \(\bar{x}_1-\bar{x}_2\). Keep the group labels and units attached to your work.
2
Calculate the standard error.
Square each sample standard deviation, divide by its own sample size, add those contributions, and take the square root.
3
Find Welch degrees of freedom and \(t^*\).
Use the Welch formula from “Computing Two-Sample Degrees of Freedom With the Welch Formula.” For a 95% interval, select the critical value with 0.025 in each tail.
4
Calculate the margin of error and endpoints.
Multiply \(t^*\) by the standard error. Subtract this margin from the center for the lower endpoint and add it for the upper endpoint.

For a 95% interval, the central area under the t distribution is 0.95, leaving 0.05 outside the interval, or 0.025 in each tail. If using a t table, find the row for the degrees of freedom and the column for a two-sided 0.05 significance level (equivalently, an upper-tail area of 0.025). If the degrees of freedom are not listed exactly, use the appropriate conservative row or a calculator’s inverse t function. As described in “Computing Two-Sample Degrees of Freedom With the Welch Formula,” the Welch degrees of freedom need not be a whole number.

Retain several digits while working, especially for the standard error and degrees of freedom. Round the final endpoints consistently, usually to three decimal places when the context allows. Rounding an intermediate result too early can slightly change the margin of error and endpoints.

Worked Examples

Worked Example: Comparing Two Practice Formats

An invented education project compares the number of minutes students spend completing a practice set in two formats. The groups are independent random samples. Format 1 has \(\bar{x}_1=24.6\), \(s_1=2\), and \(n_1=8\); format 2 has \(\bar{x}_2=22.1\), \(s_2=3\), and \(n_2=12\). Construct a 95% confidence interval for the difference in population mean completion times, format 1 minus format 2.

1
State.
Let \(\mu_1-\mu_2\) be the true difference in mean completion time, in minutes, for students using format 1 minus students using format 2. We want a 95% confidence interval for this difference.
2
Plan and check conditions.
Use a two-sample t interval for independent means. The samples are independent random samples, and assume each sample is less than 10% of its respective population. Suppose plots of completion times show no pronounced skewness or outliers in either group. These checks support using the procedure.
3
Do.
Calculate the center, standard error, Welch degrees of freedom, and 95% critical value by hand, then use the margin of error to find both endpoints.
4
Conclude.
Report the interval in minutes for format 1 minus format 2, and interpret the range as plausible values for the true difference in population means.

The center is format 1’s sample mean minus format 2’s sample mean:

$$ \bar{x}_1-\bar{x}_2=24.6-22.1=2.5\text{ minutes} $$

Next calculate the standard error. Each group’s variance contribution uses its own sample standard deviation and sample size:

$$ SE_{\bar{x}_1-\bar{x}_2} = \sqrt{\frac{2^2}{8}+\frac{3^2}{12}} = \sqrt{\frac{4}{8}+\frac{9}{12}} = \sqrt{0.5+0.75} = \sqrt{1.25} \approx1.1180\text{ minutes} $$

For Welch degrees of freedom, substitute the two variance contributions, 0.5 and 0.75:

$$ df= \frac{(0.5+0.75)^2} {\frac{0.5^2}{8-1}+\frac{0.75^2}{12-1}} = \frac{1.5625}{\frac{0.25}{7}+\frac{0.5625}{11}} \approx17.99 $$

For 95% confidence and approximately 17.99 degrees of freedom, \(t^*\approx2.101\). The margin of error is:

$$ ME=t^*SE=2.101(1.1180)\approx2.3489\text{ minutes} $$

Subtract and add the margin of error to the center:

$$ 2.5\pm2.3489 \quad\Longrightarrow\quad (0.151,\ 4.849)\text{ minutes} $$

We are 95% confident that the true mean completion time for format 1 minus the true mean completion time for format 2 is between about 0.151 and 4.849 minutes. Both endpoints are positive, so the interval’s plausible differences have format 1’s mean completion time greater than format 2’s.

Worked Example: A Negative Sample Difference

An invented community project compares the number of hours residents spend on a weekly outdoor activity in two neighborhoods. Independent random samples have these summaries: neighborhood 1, \(\bar{x}_1=6.8\), \(s_1=4\), \(n_1=16\); neighborhood 2, \(\bar{x}_2=8.0\), \(s_2=4\), \(n_2=16\). Find a 95% confidence interval for \(\mu_1-\mu_2\), neighborhood 1 minus neighborhood 2.

The two groups are independent random samples, assume each is less than 10% of its neighborhood population, and suppose plots show no pronounced skewness or outliers for either group. These facts support a two-sample t interval. The center is negative because neighborhood 1’s sample mean is smaller:

$$ \bar{x}_1-\bar{x}_2=6.8-8.0=-1.2\text{ hours} $$

The standard error is:

$$ SE_{\bar{x}_1-\bar{x}_2} = \sqrt{\frac{4^2}{16}+\frac{4^2}{16}} = \sqrt{1+1} = \sqrt{2} \approx1.4142\text{ hours} $$

The two variance contributions are both 1, so Welch degrees of freedom simplify to:

$$ df= \frac{(1+1)^2}{\frac{1^2}{15}+\frac{1^2}{15}} = \frac{4}{2/15} =30 $$

For 95% confidence and \(df=30\), \(t^*\approx2.0423\). Thus:

$$ ME=2.0423(\sqrt{2})\approx2.8883\text{ hours} $$

The endpoints are:

$$ -1.2\pm2.8883 \quad\Longrightarrow\quad (-4.088,\ 1.688)\text{ hours} $$

We are 95% confident that the true mean weekly activity time in neighborhood 1 minus that in neighborhood 2 is between about \(-4.088\) and \(1.688\) hours. The negative center is not a calculation error; it follows from the stated order and the sample means. The interval includes zero, so it contains differences in either direction as well as no difference.

Worked Example: Checking the Margin of Error

An invented sports-club survey compares weekly training hours for two independent groups of members. Group 1 has \(\bar{x}_1=56.4\), \(s_1=3\), and \(n_1=10\); group 2 has \(\bar{x}_2=53.9\), \(s_2=3\), and \(n_2=10\). Construct a 95% interval for \(\mu_1-\mu_2\), group 1 minus group 2.

Assume the members in each group were selected by independent random samples, each sample is less than 10% of its respective population, and plots show no strong skewness or outliers. The two-sample t interval is appropriate. The center is:

$$ \bar{x}_1-\bar{x}_2=56.4-53.9=2.5\text{ hours} $$

The standard error is:

$$ SE_{\bar{x}_1-\bar{x}_2} = \sqrt{\frac{3^2}{10}+\frac{3^2}{10}} = \sqrt{0.9+0.9} = \sqrt{1.8} \approx1.3416\text{ hours} $$

The two variance contributions are equal, so the Welch degrees of freedom are \(18\). For \(df=18\) and 95% confidence, \(t^*\approx2.1009\). Keep the standard error unrounded in the multiplication:

$$ ME=2.1009(\sqrt{1.8})\approx2.8187\text{ hours} $$

Therefore, the interval is:

$$ 2.5\pm2.8187 \quad\Longrightarrow\quad (-0.319,\ 5.319)\text{ hours} $$

We are 95% confident that group 1’s true mean weekly training time minus group 2’s true mean weekly training time is between about \(-0.319\) and \(5.319\) hours. This example is also an arithmetic check: the margin of error is larger than the center, so the lower endpoint must be negative.

Common Mistakes and AP Exam Tips

  • Reversing the subtraction order: If the parameter is \(\mu_1-\mu_2\), the center must be \(\bar{x}_1-\bar{x}_2\). Reversing the order changes the signs of the center and both endpoints.
  • Mixing up standard deviations and variances: The formula uses \(s_1^2/n_1\) and \(s_2^2/n_2\). Square each \(s\), divide by its own \(n\), and take the square root only after adding the contributions.
  • Using a z critical value: The population standard deviations are not given; the procedure uses sample standard deviations and a t critical value based on Welch degrees of freedom.
  • Using the wrong t-table column: For a 95% interval, use 0.025 in each tail. Do not use a one-sided 0.05 critical value.
  • Rounding too early: Keep extra digits for the standard error and Welch degrees of freedom until the final endpoints. A small rounding change in \(t^*\) or the standard error changes the margin of error.
  • Skipping conditions because summary statistics are provided: Means, standard deviations, and sample sizes do not establish random sampling, independence, the 10% condition, or acceptable distribution shapes. Use the design and any available plots; identify missing information rather than assuming it.
  • Reporting endpoints without context: State the confidence level, both populations, the variable and its units, and the subtraction order. The interval estimates a difference between population means, not either mean alone.

For a full-credit response, identify \(\mu_1-\mu_2\) in context, name the two-sample t interval, check the conditions, show the center and standard error, use an appropriate \(t^*\), and report both endpoints with units. Finish with a contextual interpretation of the interval.

Key takeaway: A 95% two-sample t interval is the sample mean difference plus or minus \(t^*\) times the standard error. Calculate each variance contribution separately, use Welch degrees of freedom for the critical value, and preserve the stated subtraction order from the center through the final interpretation.

Check Your Understanding

Use the hand-calculation sequence and conditions from this tutorial to answer each question.

  1. For a 95% interval, how much area is in each tail beyond the central t distribution area?
  2. If \(s_1=5\), \(n_1=25\), \(s_2=4\), and \(n_2=16\), what is the standard error for \(\bar{x}_1-\bar{x}_2\)?
  3. If \(\bar{x}_1=18.2\) and \(\bar{x}_2=20.7\), what is the center for an interval estimating \(\mu_1-\mu_2\)?
  4. Why should Welch degrees of freedom be used when choosing the critical value for the usual two-sample t interval?
  5. Name two conditions that summary statistics alone cannot verify.