12 Testing Two Population Means

12.3 Two Independent Samples T-test

Goals:
Learn how to identify independent samples;
Learn how to do a Two Independent Samples T-test;
Learn how to build a confidence interval using two
  independent samples.

Suppose that X and Y are populations of numbers with means μX and μY, respectively, and suppose that the difference μX-μY makes sense. Suppose further that we wish to make a decision on the difference μX-μY, but that in doing so, the samples drawn from X and Y are independent, i.e., selections from X have no impact on selections from Y. In this situation, it may be appropriate to perform a Two-Independent Samples T-Test, which we introduce in this section.

Suppose that x1,x2,,xm is a simple random sample drawn from X, and y1,y2,yn is a simple random sample independently drawn from Y. If the populations X and Y are normally distributed, or if the sample sizes m and n are both sufficiently large, then it is reasonable to use a T-Test with test statistic given by

t=(x¯-y¯)-(μX-μY)sx2m+sy2n,df=smaller of m-1 and n-1. (12.3)

If it is reasonable to assume that the populations X and Y have equal variances, then the test statistic reduces to

t=(x¯-y¯)-(μX-μY)sp1m+1n,df=m+n-2, (12.4)

where sp denotes a pooled standard deviation and is given by

sp=(m-1)sx2+(n-1)sy2m+n-2. (12.5)

If you are unsure whether it proper to assume that X and Y have the same variance, then use Equation (12.3). But, if you can assume the variances are the same, then Equation (12.4) is preferred.4949Assuming the variances are equal is additional information, meaning a likely stronger result. The pooled standard deviation probably won’t change the value of t by much, but the larger degrees of freedom will likely yield a smaller p-value.

Example 12.3.1.

A researcher wished to test whether filling a football with air or helium would change the average distance of a punt. One set of footballs were filled with air and the other were filled with helium. Each football was punted by the researcher, and the distance recorded in yards. The data is given in the table below. At a significance level of 5%, determine whether there is significant evidence that the true average distance of helium-filled punts is different from the true average distance of air-filled punts. Assume that the two populations of distances are normally distributed.

𝐀𝐢𝐫𝐇𝐞𝐥𝐢𝐮𝐦35.051.641.135.646.752.342.847.939.942.053.447.138.935.639.343.556.860.137.056.032.841.9

Solution. Recall that if we let μa and μh denote the true averages of the researcher punting distances of air-filled and helium-filled footballs, respectively, then the competing hypotheses are:

H0:μa-μh=0H1:μa-μh0

The direction of extreme is two-sided, and the samples are independent. Since the populations are normally distributed, a two-independent samples T-Test is appropriate. One way to assess if it is reasonable to assume the population standard deviations are equal is to examine the summary statistics, as shown in Figure 12.7.

Figure 12.7: Summary Statistics

We will add to a repertoire of assessing when two standard deviations are not the same, but sx=7.09 and sy=8.16 do not strongly suggest different variances, so we will use the pooled test. The computation of sp using Equation (12.5) is shown in Figure 12.8.5050Make a note that what you get is between sx and sy. If it isn’t, then something went wrong in the calculation.

Figure 12.8: Pooled Sample Standard Deviation

Now use Equation (12.4) to compute the test statistic, as in Figure 12.9.

Figure 12.9: Test Statistic

Recalling that this is a two-sided test, the p-value calculation is shown in 12.10.

Figure 12.10: p-value

Since the p-value is greater than 0.05, we fail to reject H0. That is, there is insufficient evidence that the true average punting distances (when kicked by the researcher) are different whether the football is filled with air or helium.

Example 12.3.2.

A study was conducted to assess whether student learning in college algebra would improve in an online course versus a traditional classroom. A single instructor with experience in both environments was selected to run two courses, one traditional and one online. A group of 50 college algebra students were randomly assigned to either of the two sections, so that 25 were in each. At the end of the semester, students were given a common final exam. The scores on the final are given below. Using the data, at a 10% significance level, determine if there is significant evidence that student learning is improved in online college algebra courses. Assume that the two populations of final exam scores are normally distributed.

𝐓𝐫𝐚𝐝7175818583309180608285637480775569𝐎𝐧𝐥𝐢𝐧𝐞85878277808179668976807665

Solution. Let μo and μt denote the true average exam score for online and traditional college algebra courses taught by the instructor, respectively. The competing hypotheses are:

H0:μo-μt0H1:μo-μt>0

The direction of extreme is to the right.

By computing the summary statistics as in Figure 12.11, it is evident that assuming the population variances are the same is not reasonable.

Figure 12.11: Summary Statistics

Using Equation (12.3), the test statistic is shown in Figure 12.12.

Figure 12.12: Test Statistic

The p-value is given in Figure 12.13.

Figure 12.13: p-value

Since the p-value is not larger than 0.1, we reject H0, i.e., there is significant evidence that the true average exam score in the online courses is larger than the true average score in the traditional courses.

12.3.1 Confidence Interval for a Difference of Means - Independent Case

We can construct confidence intervals for the difference of two means using the T-distribution, assuming the proper assumptions hold first. That is, if the two samples come from normal distributions or if the sample sizes are sufficiently large. For the independent case, we must know whether or not the samples come from random variables with same variances. This, again, will determine whether we use Eq. (12.3) or Eq. (12.4).

Let’s first look at the case when the the samples come from random variables with different variances. In this case, the confidence interval would be constructed based on the following formula.

(x¯-y¯)±t*sx2m+sy2n (12.6)

The degrees of freedom is then given by the smaller of m-1 or n-1.

Example 12.3.3.

A study was conducted to assess whether student learning in college algebra would improve in an online course versus a traditional classroom. A single instructor with experience in both environments was selected to run two courses, one traditional and one online. A group of 50 college algebra students were randomly assigned to either of the two sections, so that 25 were in each. At the end of the semester, students were given a common final exam. The scores on the final are given below. Assume that the two populations of final exam scores are normally distributed. Construct at 98% confidence interval for the difference in mean exam scores.

𝐓𝐫𝐚𝐝7175818583309180608285637480775569𝐎𝐧𝐥𝐢𝐧𝐞85878277808179668976807665

Solution. Extracting all of the pertinent descriptive stats we have the following.

Figure 12.14: Descriptive Stats

After obtaining the test statistic t* and the ME, we plug the respective values into Eq. (12.3).

Figure 12.15: Confidence Interval

For the case when we can assume equal variances, we instead calculate the pooled variance, sp. This used Eq. (12.5). Thus, the confidence interval formula is given as

(x¯-y¯)±t*sp1m+1n, (12.7)

with df=m+n-2.

Example 12.3.4.

A researcher wished to test whether filling a football with air or helium would change the average distance of a punt. One set of footballs were filled with air and the other were filled with helium. Each football was punted by the researcher, and the distance recorded in yards. Assume that the two populations of distances are normally distributed and that their variances are equal. Construct an 85% confidence interval for the difference in distance kicked.

𝐀𝐢𝐫𝐇𝐞𝐥𝐢𝐮𝐦35.051.641.135.646.752.342.847.939.942.053.447.138.935.639.343.556.860.137.056.032.841.9

Solution. Extracting all of the pertinent descriptive stats we have the following.

Figure 12.16: Descriptive Stats

Calculating the poolled standard deviation, the test statistic, and the mean error, we can plug in the values into Eq. (12.4).

Figure 12.17: Confidence Interval

12.3.2 Exercises

  1. 1.

    An engineer is interested if a new sheet metal molding machine performs faster than an older version a company has been using. In order to test this claim, the times to complete the same mold are recorded for both the new machine and for the old machine. Below are their times in seconds. The data is assumed to come from normally distributed random variables. Assume that the variances are equal. Answer the following.

    Old 32.73 33.32 33.83 32.27 33.39 33.11 31.70 33.82 32.67 32.62
    New 30.72 30.86 31.84 31.58 31.90 33.02 31.34 30.63 32.12 30.76
    1. (a)

      What is the population of interest?

    2. (b)

      State the competing hypotheses.

    3. (c)

      What is the direction of extreme?

    4. (d)

      What test will you use, and why is it reasonable to use?

    5. (e)

      Compute the test statistic and corresponding p-value.

    6. (f)

      Sketch the p-value.

    7. (g)

      Using α=0.05, state your conclusion, i.e., do you reject H0, or fail to reject H0?

    8. (h)

      State the conclusion in a appropriate for a scientific journal.

    9. (i)

      What type of error could have been made?

    10. (j)

      Calculate a 95% confidence interval for the difference in means.

  2. 2.

    Differences in post-test/pre-test scores are calculated in an effort to determine if curriculum changes are beneficial. Suppose two groups receive the same instruction except for one extra unit is taught to Group B. Group A does not receive this instruction. Both groups received the same exams regardless if they knew the material or not. Below is a sample taken between the groups. Assume the data comes from normally distributed random variables and that variances are not equal.

    Group A -1 -1 -3 -3 1 0 2 4 3 2
    Group B -1 1 0 2 2 1 1 1 0 1
    1. (a)

      What is the population of interest?

    2. (b)

      State the competing hypotheses.

    3. (c)

      What is the direction of extreme?

    4. (d)

      What test will you use, and why is it reasonable to use?

    5. (e)

      Compute the test statistic and corresponding p-value.

    6. (f)

      Sketch the p-value.

    7. (g)

      Using α=0.05, state your conclusion, i.e., do you reject H0, or fail to reject H0?

    8. (h)

      State the conclusion in a appropriate for a scientific journal.

    9. (i)

      What type of error could have been made?

    10. (j)

      Calculate a 95% confidence interval for the difference in means.