# T-Test

The T-test is used to test whether a difference between two group means is statistically significant. These group means may come from two independent samples (say, one sample of boys and one of girls, or samples from two school classes) or from "paired" samples. The latter cases arises if a sample is compared "to itself", as it were, e.g., if the first and the present salary of individuals is compared. Finally, one or more means from a single sample may be tested against a pre-defined value.

*Example for independent samples*:

T-TEST GROUPS = var17 (1,2) | |

/ VARIABLES = grade. |

*Examples for paired samples*:

T-TEST PAIRS = var31 var32 var33 (PAIRED).

T-TEST PAIRS = var31 var32 WITH var33 (PAIRED).

*One-sample t-test*:

T-TEST TESTVAL 3.5/VARIABLE var31.

In the command for the independent samples case, after keyword `GROUPS`

the variable is named that indicates to which group each case belongs. The values indicating group membership are made explicit in parentheses. After keyword `VARIABLES`

, the (metric) variable(s) is or are mentioned with respect to which the groups are compared. Note that SPSS will first display a test on homogeneity of variances. SPSS then computes two test statistics for the T test, one for the case of equal variances in both groups and one for unequal variances. If the variances differ significantly, the latter test statistic and the significance value that accompanies it should be used. – More than one variable can be provided in the variables list.

In the paired sample case, each case in the data set is compared to itself; therefore, no indication of group membership is necessary. All you have to do is to name the variables on which the cases are to be compared. The final clause `(PAIRED)`

obviously is redundant and may be omitted in newer versions of SPSS. The *difference between the two examples provided* is a follows: In the first example, all three possible pairs of comparisons between variables are tested; in the second example, the mean of var31 and var32, respectively, is tested against var33.

Finally, the one-sample test compares the mean of var31 against a pre-defined value, which is indicated as 3.5 in this example. Typically, such a pre-defined value may come from previous knowledge about the subject, but you may choose any value you are interested in. Note that again you may list several variables, all of which are tested against the values indicated after keyword `TESTVAL`

.

© W. Ludwig-Mayerhofer, IGSW | Last update: 11 Dec 2009