The Difference between Two Means

This section covers how to test for differences between means from two separate groups of subjects and gives an example of opinions on animal research. The detailed testing procedure is carried out using the standard steps in hypothesis testing.

Formatting Data for Computer Analysis

Most computer programs that compute t tests require your data to be in a specific form. Consider the data in Table 2.

Table 2. Example Data.

Group 1 Group 2
3 2
4 6
5 8

Here there are two groups, each with three observations. To format these data for a computer program, you normally have to use two variables: the first specifies the group the subject is in and the second is the score itself. The reformatted version of the data in Table 2 is shown in Table 3.

Table 3. Reformatted Data.

G Y
1 3
1 4
1 5
2 2
2 6
2 8


To use Analysis Lab to do the calculations, you would copy the data and then

  1. Click the "Enter/Edit Data" button. (You may be warned that for security reasons you must use the keyboard shortcut for pasting data.)
  2. Paste your data.
  3. Click "Accept Data".
  4. Set the Dependent Variable to \mathrm{Y}.
  5. Set the Grouping Variable to \mathrm{G}.
  6. Click the "t-test/confidence interval" button.

The t value is -0.718, the df = 4, and p = 0.512.