This is the "Independent Samples t Test" page of the "SPSS Tutorials" guide.

Alternate Page for Screenreader Users

Skip to Page Navigation

Skip to Page Content

Alternate Page for Screenreader Users

Skip to Page Navigation

Skip to Page Content

This LibGuide contains written and illustrated tutorials for the statistical software SPSS.

Last Updated: May 12, 2015
URL: http://libguides.library.kent.edu/SPSS
Print Guide
RSS UpdatesEmail Alerts

Independent Samples t Test Print Page |

The Independent Samples *t* Test compares the means of two independent groups in order to determine whether there is statistical evidence that the associated population means are significantly different. The Independent Samples *t* Test is a parametric test.

This test is also known as:

- Independent
*t*Test - Independent Measures
*t*Test - Independent Two-sample
*t*Test - Student
*t*Test - Two-Sample
*t*Test - Uncorrelated Scores
*t*Test - Unpaired
*t*Test - Unrelated
*t*Test

The variables used in this test are known as:

- Dependent variable, or test variable
- Independent variable, or grouping variable

The Independent Samples *t* Test is commonly used to test the following:

- Statistical differences between the means of two or more groups
- Statistical differences between the means of two or more interventions
- Statistical differences between the means of two or more change scores

**Note:** The Independent Samples *t* Test can only compare the means for two (and only two) groups. It cannot make comparisons among more than two groups. If you wish to compare the means across more than two groups, you will likely want to run an ANOVA.

Your data must meet the following requirements:

- Dependent variable that is continuous (i.e., interval or ratio level)
- Independent variable that is categorical (i.e., two or more groups)
- Cases that have values on both the dependent and independent variables
- Independent samples/groups (i.e., independence of observations)
- There is no relationship between the subjects in each sample. This means that:
- Subjects in the first group cannot also be in the second group
- No subject in either group can influence subjects in the other group
- No group can influence the other group
- Violation of this assumption will yield an inaccurate
*p*value - Random sample of data from the population
- Normal distribution (approximately) of the dependent variable for each group
- Non-normal population distributions, especially those that are thick-tailed or heavily skewed, considerably reduce the power of the test
- Among moderate or large samples, a violation of normality may still yield accurate
*p*values - Homogeneity of variances (i.e., variances approximately equal across groups)
- When this assumption is violated and the sample sizes for each group differ, the
*p*value is not trustworthy. However, the Independent Samples*t*Test output also includes an approximate*t*statistic that is not based on assuming equal population variances; this alternative statistic, called the Welch*t*Test statistic^{1}, may be used when equal variances among populations cannot be assumed. The Welch*t*Test is also known an Unequal Variance T Test or Separate Variances T Test. - No outliers

**Note:** When one or more of the assumptions for the Independent Samples *t *Test are not met, you may want to run the nonparametric Mann-Whitney *U* Test instead.

Researchers often follow several rules of thumb:

- Each group should have at least 6 subjects, ideally more. Inferences for the population will be more tenuous with too few subjects.
- Roughly balanced design (i.e., same number of subjects in each group) are ideal. Extremely unbalanced designs increase the possibility that violating any of the requirements/assumptions will threaten the validity of the Independent Samples
*t*Test.

The hypotheses can be expressed in two different ways that express the same idea:

Null hypothesis: | H_{0}: µ_{1} = µ_{2} |
the two population means are equal | |

Alternative hypothesis: | H_{1}: µ_{1} ≠ µ_{2} |
the two population means are not equal | |

OR | |||

Null hypothesis: | H_{0}: µ_{1} - µ_{2} = 0 |
the difference between the two population means is 0 | |

Alternative hypothesis: | H_{1}: µ_{1} - µ_{2} ≠ 0 |
the difference between the two population means is not 0 |

where µ_{1} and µ_{2} are the population means for group 1 and group 2, respectively.

The test statistic for an Independent Samples *t* Test is denoted as *t*, which is calculated using the following formula (assuming equal variances), and thus pooling the variances):

Where

Where

x_{1} = Mean of first sample

x_{2} = Mean of second sample*n*_{1} = Sample size (i.e., number of observations) of first sample*n*_{2} = Sample size (i.e., number of observations) of second sample*s*_{1} = Standard deviation of first sample (Note: once the standard deviation is squared in the equation it represents variance)*s*_{2} = Standard deviation of second sample (Note: once the standard deviation is squared in the equation it represents variance)*s _{p} *= pooled standard deviation (i.e., treats variances as equal)

The calculated *t* value is then compared to the critical *t* value from the *t* distribution table based on a chosen confidence level. If the calculated *t* value > critical *t* value, reject the null hypothesis.

Your data should include two variables (represented in columns) that will be used in the analysis. The independent variable should be categorical and include exactly two groups. The dependent variable should be continuous (i.e., interval or ratio). **Note:** SPSS restricts categorical indicators to numeric or short string values only.

To run an Independent Samples *t* Test in SPSS, click **Analyze** > **Compare** **Means** > **Independent-Samples T Test.**

The Independent-Samples T Test window opens where you will specify the variables to be used in the analysis. All of the variables in your dataset appear in the list on the left side. Move variables to the right by selecting them in the list and clicking the blue arrow buttons. You can move a variable(s) to either of two areas: **Grouping Variable** or **Test Variable(s)**.

**A.** **Test Variable(s):** The dependent variable(s). This is the continuous variable whose means will be compared between the two groups. You may run multiple *t* tests simultaneously by selecting more than one test variable.

**B.** **Grouping Variable:** The independent variable. The categories (or groups) of the independent variable will define which samples will be compared in the *t* test. The grouping variable must have at least two categories (groups); it may have more than two categories but a *t* test can only compare two groups, so you will need to specify which two groups to compare. You can also use a continuous variable by specifying a cut point to create two groups (i.e., values at or above the cut point and values below the cut point).

**C.** **Define Groups**: Click **Define Groups **to define the category indicators (groups) to use in the *t* test. If the button is not active, make sure that you have already moved your independent variable to the right in the **Grouping Variable** field. Then, simply click the field where “[variable name](?, ?)” appears (e.g., “Gender (?,?)”); this will highlight the text field in yellow. **Define Groups** should now be active. Once you click the button, the Define Groups window opens.

**1.** **Use specified values:** If your grouping variable is already categorical, you can choose to **Use specified values**. Enter the values for the categories you wish to compare in the **Group 1** and **Group 2** fields. For example, if you wish to compare males and females, and your gender variable take values of 1 and 2, you would type “1” in the first text box, and “2” in the second text box. If your grouping variable has more than two categories (e.g., takes on values of 1, 2, 3, 4), you will need to specify which of the groups should be compared (e.g., 2 and 4).

**2.** **Cut point:** A designated cut point will divide the values of a variable into two groups—one group with values above the cut point, and one group with values below the cut point. This option transforms a variable into two and only two groups so that the transformed variable can be used as the grouping variable in an Independent Samples *t* Test. Cut points can be used on variables of any type (e.g., categorical, continuous) but may not make practical sense for some types of variables (e.g., nominal categorical). Additionally, using a dichotomized variable created via a cut point generally reduces the power of the test compared to using a non-dichotomized variable.

**D.** **Options: **Clicking **Options ** will open a window where you can specify the **Confidence Interval Percentage **and how the analysis will address** Missing Values** (i.e., **Exclude cases analysis by analysis** or **Exclude cases listwise**). Click **Continue **when you are finished making specifications.

Click **OK** to run the Independent Samples *t* Test.

Perhaps you wish to know whether the average height for women is significantly (statistically) different from the average height for men. This involves testing whether the sample means for height among female and male subjects in your sample are statistically different (and by extension, infering whether the means for height in the population are significantly different). You can use an Independent Samples *t* Test to compare the mean heights for males and females.

The hypotheses for this example can be expressed in two different ways that express the same idea and are mathematically equivalent:

Null hypothesis: | H_{0}: µ_{male} = µ_{female} |
the population means for males and females are equal | |

Alternative hypothesis: | H_{1}: µ_{male} ≠ µ_{female} |
the population means for males and females are not equal | |

OR | |||

Null hypothesis: | H_{0}: µ_{male} - µ_{female} = 0 |
the difference between the male and female population means is 0 | |

Alternative hypothesis: | H_{1}: µ_{male} - µ_{female} ≠ 0 |
the difference between the male and female population means is not 0 |

where µ_{male} and µ_{female} are the population means for males and females, respectively.

In the sample data, we will use two variables: *Gender* and *Height*. The variable *Gender* has values of either “1” or “2” which correspond to male and female, respectively. The variable *Gender* will serve as our grouping variable and will function as the independent variable in the Independent Samples *t* Test. The variable *Height* is a continuous measure of height in inches and exhibits a range of values from 58.44 to 80.45 (**Analyze** > **Descriptive** **Statistics** > **Descriptives**). The variable *Height* will serve as the dependent variable. In SPSS, the data look like this:

To run the Independent Samples *t *Test, click **Analyze** > **Compare** **Means** > **Independent-Samples T Test**. Move the variable *Gender* to the **Grouping Variable** field, and move the variable *Height* to the **Test Variable(s)** area. Now *Gender* is defined as the independent variable and *Height* is defined as the dependent variable.

Click **Define Groups**, which opens a new window. **Use specified values** is selected by default. Type “1” in the first text box, and “2” in the second text box; this indicates that we will compare groups 1 and 2, which correspond to males and females, respectively.

Click **Continue**. Click **OK** to run the Independent Samples *t* Test. Output for the analysis will display in the Output Viewer.

Two sections (boxes) appear in the output: **Group Statistics** and **Independent Samples Test**. The first section, **Group Statistics**, provides basic information about the group comparisons, including the sample size (*n*), mean, standard deviation, and standard error mean for height separately for each gender, male and female. In this example, there are 46 males and 45 females. The mean height for males is 70.74 inches, and the mean height for females is 64.03 inches.

The second section, **Independent Samples Test**, displays the results most relevant to the Independent Samples *t* Test. There are two parts that provide different pieces of information: Levene’s Test for Equality of Variances and t-test for Equality of Means. **T-test for Equality of Means** provides the results for the actual Independent Samples *t* Test. Levene’s Test, which indicates whether the assumption of equal variances has been met for the two samples, will be discussed separately. Here, we focus on the T Test for Equality of Means results.

**T-test for Equality of Means**: This area provides the actual *t* test statistic and significance. In this example (assuming equal variance, and thus using the first row in the table), *t* = 12.279. Note that *t* is calculated by dividing the mean difference by the standard error difference.

Note that the mean difference in height is 6.71. The mean difference is calculated by subtracting the mean of the second group from the mean of the first group; in this example, the mean height for females was subtracted from the mean height for males (70.74 minus 64.03 = 6.71). The sign of the mean difference indicates the sign of the *t *value. The positive *t* value in this example indicates that the mean height for the first group, males, is significantly greater than the mean height for the second group, females.

The associated *p* value is .000 (2-tailed test). Since *p* = .000, we can the null hypothesis that the mean heights for males and females are the same and conclude that there is a significant difference in mean heights for males and females.

Based on the results, we can state the following:

- The average height for men is about 7 inches taller than the average height for women.
- There is a significant difference in mean heights between females and males (
*p*= .000).

You may recall that one of the assumptions of the *t* test is homogeneity of variances (i.e., approximately equal variances across groups). Conveniently, running the Independent Samples *t* Test also produces results for Levene’s test, which tests the equality of variances across groups.

The hypotheses for Levene’s test are:

Null hypothesis: | H_{0}: σ_{1}^{2} - σ_{2}^{2} = 0 |
the population variances are equal | |

Alternative hypothesis: | H_{1}: σ_{1}^{2} - σ_{2}^{2} ≠ 0 |
the population variances are not equal |

The output in the Independent Samples Test table includes two rows: **Equal variances assumed** and** Equal variances not assumed**. In the column for **Levene’s Test for Equality of Variances**, in the row **Equal variances assumed**, we find results that test whether or not the population variances are likely to be equal across the two groups (i.e., males and females). In this example, we will use 0.05 as our threshold for significance: a *p* value that is larger than 0.05 fails to reject the null hypothesis, while a *p* value that is equal to or smaller than 0.05 rejects the null hypothesis and accepts the alternative hypothesis. In this example, *p* = .480, so we do not reject the null hypothesis that the population variances are equal.

If Levene’s test indicates that the variances are equal across the two groups (i.e., male and female), you will rely on the first row of output, **Equal variances assumed**, when you look at the results for the actual Independent Samples *t* Test (under *t*-test for Equality of Means). If Levene’s test indicates that the variances are not equal across the two groups, you will need to rely on the second row of output, **Equal variances not assumed**, when you look at the results of the Independent Samples *t* Test (under the heading *t*-test for Equality of Means).

The difference between these two rows of output lies in the way the independent samples *t* test statistic is calculated. When equal variances are assumed, the calculation uses pooled variances; when equal variances cannot be assumed, the calculation utilizes un-pooled variances and a correction to the degrees of freedom. The formulas are as follows:

Pooled variances:

Where

Un-pooled variances:

Where

The corresponding syntax for the Independent Samples *t* Test example is:

T-TEST GROUPS=Gender(1 2)

/MISSING=ANALYSIS

/VARIABLES=Height

/CRITERIA=CI(.95).

Running this syntax in the Syntax Editor will produce the same output.

Loading...