Skip to the content.

T-test

A statistical test used to determine if there is a significant difference between the means of two groups. Typically, the data in question follows a normal distribution with an unknown variance. Commonly, a T-test is used to determine if a particular treatment has an impact on a population of interest.

The null hypothesis of a T-test is that the means between the two groups are the same.

The alternative hypothesis is that the means between two groups are different.

An important point to keep in mind is the whether you intend on using a one-tailed or two-tailed T-test. A one-tailed T-test looks for either a directional (increase or decrease) change in the mean while a two tailed T-test just looks for a change (could be an increase OR a decrease).

Finally, the type of T-test you intend to use is extremely important and basically boils down to whether your two datasets have the same variance.

Student’s T-test

Then two groups are sampled from populations that are normally distributed and the variance between the populations are the same. This is typically a very risky assumption to make BUT if you are sure that the variance between the populations is the same you can go ahead and use the Student’s T-test.

Welch’s T-test

Then two groups are sampled from populations that are normally distributed and the variance between the populations are NOT the same. I would assume that ~ 9/10 times you would be safer off using the Welch’s T-test.

Which T-test to use?

As a general rule of thumb, your default choice for conducting a T-test should be the Welch’s T-test. If, for some reason, you really want ignore this warning and choose to use the Student’s T-test, you might as well run the Welch’s T-test in parallel. If the results between the two tests are the same, congratulations, you got lucky but if the results are different, trust the results from the Welch’s T-test.

Here are some pointers when setting up a T-test using different tools.

Values needed to conduct a T-test

To conduct a T-test using JMP, Excel, or R, you will need your data points recorded in two columns; one column for each treatment. The data for this analysis should be numeric. Then conduct the analysis by specifying which column corresponds to which group.

Here is an example of how you data should be formatted:

Height Group 1 (inches) Height Group 2 (inches)
68 48
70 50
75 60
70 52
72 55
73 58
77 56
78 59
71 51

Values returned from a T-test

The T-test will produce the following values. I have provided a brief description of how to interpret them.

Visualizing the results

Just because you ran the analysis in JMP does not mean you have to use JMP to visualize your results. As long as you have a statistically significant result you can generate the plots however you would like (e.g., Excel, Google Sheets, R, Python). All you need to do is add an annotation to the figure that the P-value was < 0.05. A box-and-whisker plot would be a good way of visualizing the results of a T-test. The box-and-whisker plot would present both the spread of the data while also incorporating error bars associated with the mean calculation.