T test EN - pdmoerland/wiki-biostatistiek-bilingual GitHub Wiki

T-test

Deze pagina lezen in het Nederlands.

Author: dr. ir. N. van Geloven
Authorship

This page was translated from the Dutch-language original using AI and has not been fully reviewed. Where the two differ, the Dutch version takes precedence.

Contents

The t-test is a parametric test for testing hypotheses about the means of (semi-)continuous data. The most commonly used t-test is the unpaired t-test. This test compares the means of 2 independent groups. For paired groups there is the paired t-test, and for hypotheses about the mean in 1 group there is the one sample t-test.

Unpaired t-test

When do I use the unpaired t-test?

If you want to test whether the means of two separate groups are equal to each other, you can use the unpaired t-test. For example, if you want to test whether the mean age is the same for two arms in a study.

The t-test assumes that the mean difference between the two groups is normally distributed (more precisely: that the sampling distribution of mean differences is normally distributed). If both groups originate from a normally distributed population, this assumption is satisfied. You can therefore assess whether your study sample meets the normality assumption of the two sample unpaired t-test by examining the histogram for both groups. The larger the sample, the less you need to worry - thanks to the central limit theorem - about the normality of the data. This blog post explains what the central limit theorem is and why it is relevant here.

The standard two sample unpaired t-test additionally assumes that both groups come from a distribution with the same variance (spread). With, for example, 'Levene's Test for equality of variance', you can test whether the variance in both groups can be assumed equal. SPSS provides this test result in the output of the two sample unpaired t-test, along with the result of the t-test both assuming and not assuming equal variance.

Example of the use of an unpaired t-test:

Table 1. Baseline characteristics of the patients
Variable* Treated Group Placebo Group p-value**
Age - yr 67 (5.0) 64 (4.2) 0.12
Weight - kg 79 (10.2) 85 (15.4) 0.33
*Variables are denoted as mean (SD). **Group differences were tested with the two sample unpaired t-test.

Which test can I use to compare two virus measurements?

I have taken two measurements (regarding the amount of a virus: not normally distributed) at time point A and time point B in a patient population. I have split this population into two groups, namely: improved and not improved. Now I want to know whether the decrease (or increase) in the amount of virus differs between the improved and not-improved patients. I would like to know which test I can use for this.

Several approaches are possible for the design you describe. Here is a suggestion: if you are interested in the decrease (or increase) between the two time points, you can consider these differences as the outcome measure. Each patient then has a single outcome, namely their difference in virus level. You have divided the patients into two groups (improved, not improved). You then want to test whether the outcome measure differs between these two groups. You write that the amount of virus is not normally distributed. You could re-examine this for the difference in virus amount. A log transformation might help make the data less skewed (you would then, in effect, be looking at a log-reduction factor). The two groups can then be compared using either the unpaired t-test or a non-parametric test (Mann-Whitney U test).

Can I use the t-test with unequal group sizes?

Within my study population, I want to compare groups based on different variables. When I form groups, one comparison results in 14 participants in one group and 97 in the other group. This is a very large difference, and I wondered whether this might have too strong an influence on the result? My question is therefore whether I can simply use the t-test in SPSS to compare these two groups, or what the alternative would be otherwise.

The t-test takes the available numbers into account in its calculation (in the degrees of freedom), so unequal group sizes are, in principle, not a problem. What is assumed to be equal (in the standard t-test) is the spread (variance) in both groups. And of course, a normal distribution is also assumed. You could take a critical look at that. For smaller groups (n=14), the normality assumption is sometimes hard to substantiate well. In that case, it can be 'safer' to use a non-parametric test, such as the Mann-Whitney U test.

When can we assume equal variances in the t-test?

We have a question about t-tests on data with unequal variance. In the kind of experiments we do, it almost never happens that groups show unequal variance, but occasionally it does. We wondered what we should do if, in an experiment with more than 2 groups, there is 1 group whose variance is significantly different. Should we then, for example, do a Welch test for comparisons involving the group that shows a different variance, and a Student t-test for comparisons between groups with the same variance? Or should we in that case use a test that does not assume equal variance throughout the entire experiment, or even across experiments? Or can we assume that it is just chance that the variance is different that one time, and simply use the tests that assume equal variance? We would not find it desirable to have to statistically treat different datasets/experiments, or even groups within an experiment, differently, while the type of data is the same.

Here the guidelines are not black and white. You can take into account what your expectations are regarding the variance (or whether you think it is chance). In doing so, I would also take into account the sample size, and thus how convincingly the data tell you that there are unequal variances. In addition, it is important in any case to perform a strong 'overall' test before comparing groups pairwise (One-way ANOVA or non-parametric equivalent).

Paired t-test

When do I use the paired t-test?

If you want to test whether the means of a variable measured twice, paired, are equal to each other, you can use the paired t-test. For example, if you want to test whether blood values differ before and after administering a medication.

The paired t-test assumes that the difference between two paired measurements is normally distributed (more precisely: that the sampling distribution of mean differences is normally distributed). To assess whether your data is suitable for a paired t-test, you can calculate the difference between the two measurements for each pair and plot the histogram. Testing the normality of your data with a formal test, such as the Kolmogorov-Smirnov test, is discouraged in this context https://doi.org/10.1111/j.1365-2230.2006.02206.x. The larger the sample, the less you need to worry - thanks to the central limit theorem - about the normality of the data. This blog post explains what the central limit theorem is and why it is relevant here.

One sample t-test

When do I use the one sample t-test?

If you want to test whether the mean of a variable (for example, height) in a population is equal to a certain, pre-specified value, you can use the one sample t-test. For example, if you want to test the hypothesis that the mean height of men with a certain condition is lower than the (known) Dutch average height of men (1.82 m).

The one sample t-test assumes that the variable has a normal distribution in the population. To be able to reasonably assume that the measured values in a study sample come from a normal distribution, you can create a histogram of the data.

Where do I find the t-test in SPSS?

You will find the t-tests in SPSS 28 under Analyze->Compare Means.


Finished reading? You can go to the Overview of all topics, or to Choosing a test for help picking a suitable test or analysis. Want to learn more about biostatistics? Then follow the AMC e-learning Practical Biostatistics. Did you find something on these pages that isn't correct? Does a link not work? Or would you like to contribute to the wiki? Then get in touch with us.

This biostatistics wiki is an initiative of the former statistics helpdesk of Amsterdam UMC, location AMC. Amsterdam UMC staff can request statistical support via intranet.

⚠️ **GitHub.com Fallback** ⚠️