# Using the t-test for comparing averages between groups

### Understanding and interpreting the t-test and using SPSS.

Suppose you want to research whether people who drink tea have, on average, a higher blood pressure than people who don’t drink tea. When considering which statistical test you should use for this, you would probably end up with the t-test. This test is also known as the student’s t-test and is used to compare the averages of up to two groups. In this blog we explain which types of t-tests are available and when you end up using them.

**T-test: Assumptions**

The t-test is used to compare the mean of a continuous variable between a maximum of 2 groups. Continuous variables are variables that can have any value in a given interval, such as height, blood pressure, or distance. This is in contrast to discrete variables such as gender or marital status. To use the t-test, your data must be normally distributed. In that case, you may use the mean and standard deviation to show the distribution of your data.

**How do I know if my data is normally distributed**

There are different methods to evaluate this, it can be done visually or with a test. For starters, you can plot your variable in a histogram (in SPSS: Graphs - Legacy Dialogs - Histogram). If the histogram is roughly in the shape of a normal curve, you may assume that your data is normally distributed. However, in practice, it is often difficult to estimate this. In this case use a Q-Q plot (in SPSS: Analyze - Descriptive Statistics - Q-Q Plots). If the variable is normally distributed, the points should be on a straight line. If in doubt, you can still choose to take a formal test such as the Kolmogorov-Smirnov test or the Shapiro-Wilk test. However, these are often not necessary, and the explanation of these tests is beyond the scope of this blog.

**My data is not normally distributed, now what?**

In this case, you can do two things: transform your data hoping that it will be distributed normally or do a non-parametric test such as the Mann-Whitney U test. These topics will be discussed later.

**What types of t-tests are there?**

#### T-test with 1 group: the one sample t-test.

Use this test when you have taken a sample, of which you want to compare the average with the known population mean. For example, you have measured the BMI of 50 men with diabetes and you want to compare this with the known median BMI of men in the Netherlands. In this case, use the one-sample t-test (SPSS: Analyze = Compare Means - One Sample T-test).

#### T-test with independent samples: the independent-sample t-test

Use this test to compare the averages of two independent groups, as described in the introductory example. In this example, we test the null hypothesis that the average blood pressure of people who drink tea is as high as those who don’t drink tea. In SPSS choose: Analyze - Compare Means - Independent-Samples T-test.

#### T-test with dependent samples: paired samples t-test

If you have taken two measurements in the same test subject, you speak of paired measurements. For example, you measure the blood pressure of 10 test subjects twice at different times. In this case, the measurements are not independent, and you should not use the independent sample t-test. In this case, use the paired t-test (Analyze - Compare Means - Paired Samples T-test). Before doing this, check whether the difference between the measurements is normally distributed! In SPSS, use Transform - Compute Variable to calculate the difference between the two measurements.

**How do I interpret the output in SPSS?**

For the output of the independent sample t-test, note that Levene’s Test for Equality of Variances is not significant. However, if it is significant, use the results next to ‘equal variances not assumed’ (the bottom row). In the column Sig. (2-tailed), the two-tailed p-value is given. Furthermore, the output under ‘group statistics’ gives the means and standard deviations of the groups.

**How do I report the results of the t-test?**

In your methods, state in the section on statistical analysis that you used the t-test to compare continuous, normally distributed variables. In your results, you then report the means and standard deviations of the groups you compared. This way the reader is able to see the difference in size. Also state the two-sided p-value.