# 8.3 - Comparing Two Population Means: Independent Samples

Printer-friendly version
 Unit Summary Sampling Distribution of the Differences Between the Two Sample Means for Independent Samples 2-Sample t-Procedures: Pooled Variances versus Non-Pooled Variances Performing the 2-Sample t-Procedure Using Minitab

An Introduction to Statistical Methods and Data Analysis, (See Course Schedule).

### Sampling Distribution of the Differences Between the Two Sample Means for Independent Samples

The point estimate for $\mu_1 - \mu_2$ is  $\bar{x}_1 - \bar{x}_2$.

In order to find a confidence interval for $\mu_1 - \mu_2$ and perform a hypothesis test, we need to find the sampling distribution of $\bar{x}_1 - \bar{x}_2$ .

We can show that when the sample sizes are large or the samples from each population are normal and the samples are taken independently, then $\bar{y}_1 - \bar{y}_2$ is normal with mean $\mu_1 - \mu_2$ and standard deviation is $\sqrt{\frac{{\sigma_1}^2}{n_1}+\frac{{\sigma_2}^2}{n_2}}$.

However, in most cases, $\sigma_1$ and $\sigma_2$ are unknown and they have to be estimated. It seems natural to estimate $\sigma_1$ by $s_1$ and $\sigma_2$ by $s_2$.  When the sample sizes are small, the estimates may not be that accurate and one may get a better estimate for the common standard deviation by pooling the data from both populations if the standard deviations for the two populations are not that different.

### 2-Sample t-Procedures: Pooled Variances Versus Non-Pooled Variances for Independent Samples

In view of this, there are two options for estimating the variances for the 2-sample t-test with independent samples:

1. 2-sample t-test using pooled variances
2. 2-sample t-test using separate variances

When to use which? When we are reasonably sure that the two populations have nearly equal variances, then we use the pooled variances test. Otherwise, we use the separate variances test.

### Using Pooled Variances to Do Inferences for Two-Population Means

When we have good reason to believe that the variance for population 1 is about the same as that of population 2, we can estimate the common variance by pooling information from samples from population 1 and population 2.  An informal check for this is to compare the ratio of the two sample standard deviations.  If the two are equal this ratio would be 1.  However, since these are samples and therefore involve error, we cannot expect the ratio to be exactly 1.

When the sample sizes are nearly equal (admittedly "nearly equal" is somewhat ambiguous so often if sample sizes are small one requires they be equal), then a good Rule of Thumb to use is to see if this ratio falls from 0.5 to 2 (that is neither sample standard deviation is more than twice the other).  If this rule of thumb is satisfied we can assume the variances are equal.  Later in this lesson we will examine a more formal test for equality of variances.

Let n1 be the sample size from population 1, s1 be the sample standard deviation of population 1.

Let n2 be the sample size from population 2, s2 be the sample standard deviation of population 2.

Then the common standard deviation can be estimated by the pooled standard deviation:

$s_p =\sqrt{\frac{(n_1-1)s_1^2+(n_2-1)s_2^2}{n_1+n_2-2}}$

The test statistic is:

$t^{*}=\frac{{\bar{x}}_1-{\bar{x}}_2}{s_p \sqrt{\frac{1}{n_1}+\frac{1}{n_2}}}$

with degrees of freedom equal to $df = n_1 + n_2 - 2$ .

### Example: Comparing Packing Machines

In a packing plant, a machine packs cartons with jars. It is supposed that a new machine will pack faster on the average than the machine currently used. To test that hypothesis, the times it takes each machine to pack ten cartons are recorded. The results (machine.txt), in seconds, are shown in the following table.

 New machine Old machine 42.1 41.3 42.4 43.2 41.8 42.7 43.8 42.5 43.1 44.0 41.0 41.8 42.8 42.3 42.7 43.6 43.3 43.5 41.7 44.1 $\bar{y}_1$ = 42.14, s1 = 0.683 $\bar{y}_2$ = 43.23, s2 = 0.750

Do the data provide sufficient evidence to conclude that, on the average, the new machine packs faster? Perform the required hypothesis test at the 5% level of significance.

It is given that:

$\bar{y}_1 = 42.14$, $s_1 = 0.683$
$\bar{y}_2 = 43.23$, $s_2 = 0.750$

Assumption 1: Are these independent samples? Yes, since the samples from the two machines are not related.

Assumption 2: Are these large samples or a normal population? We have $n_1 < 30$, $n_2 < 30$. We do not have large enough samples and thus we need to check the normality assumption from both populations.

Let's take a look at the normality plots for this data:

From the normality plots, we conclude that both populations may come from normal distributions.

Assumption 3: Do the populations have equal variance? Yes, since $s_1$ and $s_2$ are not that different. How do conclude this?  By using a rule of thumb where the ratio of the two sample standard deviations is from 0.5 to 2.  (They are not that different as $s_1/s_2 = 0.683 / 0.750 = 0.91$ is quite close to 1. We will discuss this in more details and quantify what is "close" later in this lesson.)

We can thus proceed with the pooled t-test.

Let $\mu_1$ denote the mean for the new machine and $\mu_2$ denote the mean for the old machine.

Step 1.

$H_0: \mu_1 - \mu_2=0$,
$H_a: \mu_1 - \mu_2 < 0$

Step 2. Significance level:

$\alpha = 0.05$.

Step 3. Compute the t-statistic:

$s_p= \sqrt{\frac{9\cdot (0.683)^2+9\cdot (0.750)^2}{10+10-2}}=0.717$

$t^{*}=\frac{({\bar{x}}_1-{\bar{x}}_2)-0}{s_p \sqrt{\frac{1}{n_1}+\frac{1}{n_2}}}=\frac{42.14-43.23}{0.717\cdot \sqrt{\frac{1}{10}+\frac{1}{10}}}=-3.40$

Step 4. Critical value:

Left-tailed test
Critical value = $-t_{\alpha} = -t_{0.05}$
Degrees of freedom $= 10 + 10 - 2 = 18$
$-t_{0.05} = -1.734$
Rejection region $t^* < -1.734$

Step 5. Check to see if the value of the test statistic falls in the rejection region and decide whether to reject Ho.

$t^*= -3.40 < -1.734$
Reject $H_0$ at $\alpha = 0.05$

Step 6. State the conclusion in words.

At 5% level of significance, the data provide sufficient evidence that the new machine packs faster than the old machine on average.

When one wants to estimate the difference between two population means from independent samples, then one will use a t-interval. If the sample variances are not very different, one can use the pooled 2-sample t-interval.

Step 1. Find $t_{\alpha / 2}$ with  $df = n_1 + n_2 - 2$.

Step 2. The endpoints of the (1 - $\alpha$) 100% confidence interval for $\mu_1 - \mu_2$ is:

${\bar{x}}_1-{\bar{x}}_2\pm t_{\alpha/2}\cdot s_p\cdot \sqrt{\frac{1}{n_1}+\frac{1}{n_2}}$

the degrees of freedom of t is $n_1 + n_2 - 2$.

### Example: Comparing Packing Machines, cont'd

Continuing from the previous example, give a 99% confidence interval for the difference between the mean time it takes the new machine to pack ten cartons and the mean time it takes the present machine to pack ten cartons.

Step 1. $\alpha = 0.01$,  $t_{\alpha / 2} = t_{0.005} = 2.878$, where the degrees of freedom is 18.

Step 2.

${\bar{x}}_1-{\bar{x}}_2\pm t_{\alpha/2}\cdot s_p\cdot \sqrt{\frac{1}{n_1}+\frac{1}{n_2}}=(42.13-43.23)\pm 2.878 \cdot 0.717 \cdot \sqrt{\frac{1}{10}+\frac{1}{10}}$

The 99% confidence interval is (-2.01, -0.17).

Interpret the above result:

We are 99% confident that $\mu_1 - \mu_2$ is between -2.01 and -0.17.

### Using Minitab to Perform a Pooled t-procedure (Assuming Equal Variances)

1. Stat > Basic Statistics > 2-Sample t.

The following dialog boxes will then be displayed.

Note: When entering values into the Samples in different columns input boxes, Minitab always subtracts the Second value (column entered second) from the First value (column entered first).

2. Select the Options box and enter the desired Confidence level, Null hypothesis value (again for our class this will be 0), and select the correct Alternative hypothesis from the drop down menu.  Finally, check the box for Assume equal variances.  This latter selection should only be done when we have verified the two variances can be assumed equal.

The Minitab output for the packing time example is as follows:

Notice at the bottom of the output, 'Both use Pooled StDev'.  This tells us the equal variance method was used.  The value is this case, 0.7174, represents the pooled standard deviation $s_p$.

### Using Minitab

Click on this link to follow along with how a pooled t-test is conducted in Minitab.

Click on the 'Minitab Movie' icon to display a walk through of 'Conducting a Pooled t-test in Minitab'.

#### What to do if some of the assumptions are not satisfied:

Assumption 1. What should we do if the assumption of independent samples is violated?

If the samples are not independent but paired, we can use the paired t-test.

Assumption 2. What should we do if the sample sizes are not large and the populations are not normal?

We can use a nonparametric method to compare two samples such as the Mann-Whitney procedure.

Assumption 3. What should we do if the assumption of equal variances is violated?

We can use the separate variances 2-sample t-test.

### Using Separate (Unpooled) Variances to Do Inferences for Two-Population Means

We can perform the separate variances test using the following test statistic:

$t^{*}=\frac{{\bar{x}}_1-{\bar{x}}_2}{\sqrt{\frac{s_1^2}{n_1}+\frac{s_2^2}{n_2}}}$

with

$df=\frac{(n_1-1)\cdot(n_2-1)}{(n_2-1)C^2+(1-C)^2(n_1-1)}$

(round down to nearest integer)

where

$C=\frac{s_1^2/n_1}{\frac{s_1^2}{n_1}+\frac{s_2^2}{n_2}}$

NOTE: This calculation for the exact degrees of freedom is cumbersome and is typically done by software.  An alternate, conservative option to using the exact degrees of freedom calculation can be made by choosing the smaller of  $n_1-1$  and $n_2-1$.

### Using Minitab to Perform a Non-Pooled t-procedure (Assuming Unequal Variances)

To perform a separate variance 2-sample t-procedure use the same commands as for the pooled procedure EXCEPT we do NOT check box for Use Equal Variances

Stat > Basic Statistics > 2-sample t

For some examples, one can use both the pooled t-procedure and the separate variances (non-pooled) t-procedure and obtain results that are close to each other. However, when the sample standard deviations are very different from each other and the sample sizes are different, the separate variances 2-sample t-procedure is more reliable.

Independent random samples of 17 sophomores and 13 juniors attending a large university yield the following data on grade point averages (student_gpa.txt):

 Sophomores Juniors 3.04 2.92 2.86 2.56 3.47 2.65 1.71 3.60 3.49 2.77 3.26 3.00 3.30 2.28 3.11 2.70 3.20 3.39 2.88 2.82 2.13 3.00 3.19 2.58 2.11 3.03 3.27 2.98 2.60 3.13

At the 5% significance level, do the data provide sufficient evidence to conclude that the mean GPAs of sophomores and juniors at the university differ?

Check Assumption 1: Are these independent samples?

Yes, the students selected from the sophomores are not related to the students selected from juniors.

Check Assumption 2: Is this a normal population or large samples?

Since we don't have large samples from both populations, we need to check the normal probability plots of the two samples:

Now, we need to determine whether to use the pooled t-test or the non-pooled (separate variances) t-test.

We use the following Minitab commands:

Stat > Basic Statistics > Display Descriptive Statistics

To find the summary statistics for the two samples:

Descriptive Statistics

 Variable N Mean Median TrMean StDev sophomor 17 2.840 2.920 2.865 0.520 juniors 13 2.9808 3.0000 2.9745 0.3093
 Variable Minimum Maximum Q1 Q3 sophomor 1.710 3.600 2.440 3.200 juniors 2.5600 3.4700 2.6750 3.2300

Note: The standard deviations are 0.520 and 0.3093 respectively; both the sample sizes and the standard deviations are quite different from each other.

We, therefore, decide to use a non-pooled t-test.

Step 1. Set up the hypotheses:

$H_0: \mu_1 - \mu_2=0$
$H_a: \mu_1 - \mu_2 \ne 0$

Step 2. Write down the significance level.

$\alpha = 0.05$

Step 3. Perform the 2-sample t-test in Minitab with the appropriate alternative hypothesis.

Note: The default for the 2-sample t-test in Minitab is the non-pooled one:

Two sample T for sophomores vs juniors

 N Mean StDev SE Mean sophomor 17 2.840 0.520 0.13 juniors 13 2.981 0.309 0.086

95% CI for mu sophomor - mu juniors: ( -0.45, 0.173)
T-Test mu sophomor = mu juniors (Vs no =): T = -0.92
P = 0.36 DF = 26

Step 4. Find the p-value from the output.

p-value = 0.36

Step 5. Draw the conclusion using the p-value.

Since the p-value is larger than $\alpha = 0.05$, we cannot reject the null hypothesis.

Step 6. State the conclusion in words.

At 5% level of significance, the data does not provide sufficient evidence that the mean GPAs of sophomores and juniors at the university are different.

### Using Minitab

Click on this link to follow along with how a Separate Variance 2-Sample t Procedure is conducted in Minitab.

Click on the 'Minitab Movie' icon to display a walk through of 'Using Minitab to Perform a Separate Variance 2-sample t Procedure'.

Note that there are three stages to this process in Minitab:

Part 1 - Checking Assumptions
Part 2
- Deciding Whether a Separate Variance t-Test should be used
Part 3
- Using the Non-Pooled t-Test

### Example: Grade Point Average, cont'd

Continuing with the previous example, give a 95% confidence interval for the difference between the mean GPA of Sophomores and the mean GPA of Juniors.

Using Minitab:

95% CI for mu sophomor - mu juniors is:

(-0.45, 0.173)

Interpreting the above result:

We are 95% confident that the difference between the mean GPA of sophomores and juniors is between -0.45 and 0.173.

Remember: When entering values into the Samples in different columns input boxes, Minitab always subtracts the Second value (column entered second) from the First value (column entered first).