#### 5.3.1 Testing for differences of means

A common statistical test involves hypotheses about means. The `T-TEST` command is used to find out whether or not two separate subsets have the same mean.

t-test uses the file `physiology.sav` previously encountered. A researcher suspected that the heights and core body temperature of persons might be different depending upon their sex. To investigate this, he posed two null hypotheses:

- The mean heights of males and females in the population are equal.
- The mean body temperature of males and females in the population are equal.

For the purposes of the investigation the researcher decided to use a p-value of 0.05.

In addition to the T-test, the `T-TEST` command also performs the Levene test for equal variances. If the variances are equal, then a more powerful form of the T-test can be used. However if it is unsafe to assume equal variances, then an alternative calculation is necessary. pspp performs both calculations.

For the height variable, the output shows the significance of the Levene test to be 0.33 which means there is a 33% probability that the Levene test produces this outcome when the variances are unequal. Such a probability is too high to assume that the variances are equal so the row for unequal variances should be used. Examining this row, the two tailed significance for the height t-test is less than 0.05, so it is safe to reject the null hypothesis and conclude that the mean heights of males and females are unequal.

For the temperature variable, the significance of the Levene test is 0.58 so again, it is unsafe to use the row for equal variances. The unequal variances row indicates that the two tailed significance for temperature is 0.19. Since this is greater than 0.05 we must reject the null hypothesis and conclude that there is insufficient evidence to suggest that the body temperature of male and female persons are different.

         PSPP> get file='/usr/share/pspp/examples/physiology.sav'.
         PSPP> recode height (179 = SYSMIS).
         PSPP> t-test group=sex(0,1) /variables = height temperature.

Output:

         1.1 T-TEST.  Group Statistics
         #==================#==#=======#==============#========#
         #              sex | N|  Mean |Std. Deviation|SE. Mean#
         #==================#==#=======#==============#========#
         #height      Male  |22|1796.49|         49.71|   10.60#
         #            Female|17|1610.77|         25.43|    6.17#
         #temperature Male  |22|  36.68|          1.95|     .42#
         #            Female|18|  37.43|          1.61|     .38#
         #==================#==#=======#==============#========#
         1.2 T-TEST.  Independent Samples Test
         #===========================#=========#===============================   =#
         #                           # Levene's| t-test for Equality of Means      #
         #                           #----+----+------+-----+------+---------+-   -#
         #                           #    |    |      |     |      |         |     #
         #                           #    |    |      |     |Sig. 2|         |     #
         #                           #  F |Sig.|   t  |  df |tailed|Mean Diff|     #
         #===========================#====#====#======#=====#======#=========#=   =#
         #height      Equal variances# .97| .33| 14.02|37.00|   .00|   185.72| ... #
         #          Unequal variances#    |    | 15.15|32.71|   .00|   185.72| ... #
         #temperature Equal variances# .31| .58| -1.31|38.00|   .20|     -.75| ... #
         #          Unequal variances#    |    | -1.33|37.99|   .19|     -.75| ... #
         #===========================#====#====#======#=====#======#=========#=   =#

Example 5.6: The `T-TEST` command tests for differences of means. Here, the height variable's two tailed significance is less than 0.05, so the null hypothesis can be rejected. Thus, the evidence suggests there is a difference between the heights of male and female persons. However the significance of the test for the temperature variable is greater than 0.05 so the null hypothesis cannot be rejected, and there is insufficient evidence to suggest a difference in body temperature.