Wiki Page, Math 13 - Perez Sandbox : Module 25 - Hypothesis Test for a Difference in Two Population Means

Wiki Page
2026-01-17T21:15:43-08:00

The Hypothesis Test for a Difference in Two Population Means

The general steps of this hypothesis test are the same as always. As expected, the details of the conditions for use of the test and the test statistic are unique to this test (but similar in many ways to what we have seen before.)

Step 1: Determine the hypotheses

The hypotheses for a difference in two population means are similar to those for a difference in two population proportions. The null hypothesis, , is again a statement of “no effect” or “no difference.”

: , which is the same as :

The alternative hypothesis, , can be any one of the following.

: , which is the same as :

: , which is the same as :

: , which is the same as :

Step 2: Collect the data

As usual, how we collect the data determines whether we can use it in the inference procedure. We have our usual two requirements for data collection.

Samples must be random to remove or minimize bias.

Samples must be representative of the populations in question.

We use this hypothesis test when the data meets the following conditions.

The two random samples are independent.

The variable is normally distributed in both populations. If this is not known, samples of more than 30 will have a difference in sample means that can be modeled adequately by the t-distribution.

As we discussed previously, t-procedures are robust even when the variable is not normally distributed in the population. If checking normality in the populations is impossible, then we look at the distribution in the samples. If a histogram or dotplot of the data does not show extreme skew or outliers, we take it as a sign that the variable is not heavily skewed in the populations, and we use the inference procedure. (Note: This is the same condition we used for the one-sample t-test previously.)

Step 3: Assess the evidence

If the conditions are met, then we calculate the t-test statistic. The t-test statistic has a familiar form of , but we will not expect you to calculate it. Instead we will use StatCrunch.

If you are curious, here is the formula for the T-statistic:

As we learned previously, the t-distribution depends on the degrees of freedom (df). In the one-sample and matched-pair cases df = n - 1. For the two-sample t-test, determining the correct df is based on a complicated formula that we do not cover in this course. For this reason, we will use StatCrunch for all of these calculations.

Step 4: State a conclusion

To state a conclusion, we follow what we have done with other hypothesis tests. We compare our P-value to a stated level of significance.

If the P-value , we reject the null hypothesis in favor of the alternative hypothesis.

If the P-value , we fail to reject the null hypothesis. We do not have enough evidence to support the alternative hypothesis.

As always, we state our conclusion in context, usually by referring to the alternative hypothesis.

EXAMPLE Context and Calories

Does the company you keep impact what you eat?

This example comes from an article titled “Impact of Group Settings and Gender on Meals Purchased by College Students” (Allen-O'Donnell, M., T. C. Nowak, K. A. Snyder, and M. D. Cottingham, Journal of Applied Social Psychology 49(9), 2011).

In this study, researchers examined this issue in the context of gender-related theories in their field. For our purposes, we look at this research more narrowly.

Step 1: Stating the hypotheses

In the article, the authors make the following hypothesis. “The attempt to appear feminine will be empirically demonstrated by the purchase of fewer calories by women in mixed-gender groups than by women in same-gender groups.”

We translate this into a simpler and narrower research question: Do women purchase fewer calories when they eat with men compared to when they eat with women?

Here the two populations are “women eating with women” (population 1) and “women eating with men” (population 2). The variable is the calories in the meal. We test the following hypotheses at the 5% level of significance.

The null hypothesis is always : , which is the same as : .

In this case the alternative hypothesis : , which is the same as : .

Here represents the mean number of calories ordered by women when they were eating with other women, and represents the mean number of calories ordered by women when they were eating with men.

Note: It does not matter which population we label as 1 or 2, but once we decide, we have to stay consistent throughout the hypothesis test. Since we expect the number of calories to be greater for the women eating with other women, the difference is positive if “women eating with women” is population 1. If you prefer to work with positive numbers, choose the group with the larger expected mean as population 1. This is a good general tip.

Step 2: Collect Data

As usual, there are two major things to keep in mind when considering the collection of data.

Samples need to be representative of the population in question.

Samples need to be random in order to remove or minimize bias.

Representative Samples?

The researchers state their hypothesis in terms of “women.” We did the same. But the researchers gathered data by watching people eat at the HUB Rock Café II on the campus of Indiana University of Pennsylvania during the Spring semester of 2006. Almost all of the women in the data set were white undergraduates between the ages of 18 and 24, so there are some definite limitations on the scope of this study. These limitations will affect our conclusion (and the specific definition of the population means in our hypotheses.)

Random Samples?

The observations were collected on February 13, 2006, through February 22, 2006, between 11 a.m. and 7 p.m. We can see that the researchers included both lunch and dinner. They also made observations on all days of the week to ensure that weekly customer patterns did not confound their findings. The authors state that “since the time period for observations and the place where [they] observed students were limited, the sample was a convenience sample.” Despite these limitations, the researchers conducted inference procedures with the data, and the results were published in a reputable journal. We will also conduct inference with this data, but we also include a discussion of the limitations of the study with our conclusion. The authors did this, also.

Do the data met the conditions for use of a t-test?

The researchers reported the following sample statistics.

In a sample of 45 women dining with other women, the average number of calories ordered was 850, and the standard deviation was 252.

In a sample of 27 women dining with men, the average number of calories ordered was 719, and the standard deviation was 322.

One of the samples has fewer than 30 women. We need to make sure the distribution of calories in this sample is not heavily skewed and has no outliers, but we do not have access to a spreadsheet of the actual data. Since the researchers conducted a t-test with this data, we will assume that the conditions are met. This includes the assumption that the samples are randomly selected and independent.

Step 3: Assess the evidence

We used StatCrunch to conduct the two sample T-test.

Two sample T summary hypothesis test:
: Mean of Population 1
: Mean of Population 2
: Difference of means
:
:
(without pooled variances)

Hypothesis Test Results

Difference | Sample Diff. | Std. Err. | DF | T-Stat | P-value
| 131 | 72.466186 | 45.027286 | 1.8077397 | 0.0387

NOTE: We will not require you to calculate the test statistic by hand or to use an applet to find the P-value. If you are curious, here is the formula for computing the T-statistic: Here our population 1 is “women eating with other women.” So , , and , and population 2 is "women eating with men." So , , and .

The formula for determining the degrees of freedom is even worse. We will leave these calculations to StatCrunch and focus instead on drawing conclusions.

Step 4: State a conclusion

Generic Conclusion

The hypotheses for this test are : and : . Since the P-value is less than the significance level (0.0385 < 0.05), we reject and accept .

Conclusion in context

At Indiana University of Pennsylvania, the mean number of calories ordered by undergraduate women eating with other women is greater than the mean number of calories ordered by undergraduate women eating with men (P-value = 0.0385).

A Comment about Conclusions

In the conclusion above, we did not generalize the findings to all women. Since the samples included only undergraduate women at one university, we included this information in our conclusion. But our conclusion is a cautious statement of the findings. The authors see the results more broadly in the context of theories in the field of social psychology. In the context of these theories, they write, “Our findings support the assertion that meal size is a tool for influencing the impressions of others. For traditional-age, predominantly White college women, diminished meal size appears to be an attempt to assert femininity in groups that include men.” This viewpoint is echoed in the following summary of the study for the general public on National Public Radio.

Both men and women appear to choose larger portions when they eat with women, and both men and women choose smaller portions when they eat in the company of men, according to new research published in the Journal of Applied Social Psychology. The study, conducted among a sample of 127 college students, suggests that both men and women are influenced by unconscious scripts about how to behave in each other’s company. And these scripts change the way men and women eat when they eat together and when they eat apart.

Should we be concerned that the findings of this study are generalized in this way? Perhaps. But the authors of the article address this concern by including the following disclaimer with their findings: “While the results of our research are suggestive, they should be replicated with larger, representative samples. Studies should be done not only with primarily White, middle-class college students, but also with students who differ in terms of race/ethnicity, social class, age, sexual orientation, and so forth.”

This is an example of good statistical practice. It is often very difficult to select truly random samples from the populations of interest. Researchers therefore discuss the limitations of their sampling design when they discuss their conclusions.

In the following activities, you will have the opportunity to practice parts of the hypothesis test for a difference in two population means.