JMP | Statistical Discovery.™ From SAS.
Try JMP
Statistics Knowledge Portal
A free online introduction to statistics
Correlation vs Causation
Correlation Coefficient
The Method of Least Squares
Regression Model Assumptions
Interpreting Regression Output
Curve Fitting
Multiple Linear Regression
Fitting the Multiple Linear Regression Model
Interpreting Results in Explanatory Modeling
Multiple Regression Residual Analysis and Outliers
Multiple Regression with Categorical Predictors
Multiple Linear Regression with Interactions
Variable Selection in Multiple Regression
Multicollinearity
One-Way ANOVA
The t-Test
The t-Distribution
One-Sample t-Test
Two-Sample t-Test
Paired t-Test
The Chi-Square Test
Chi-Square Distribution
Chi-Square Test of Independence
Chi-Square Goodness of Fit Test
Types of Graphs
Box Plot
Mosaic Plot
Types of Design of Experiments
DOE Examples and Applications
What is a t-test?
A t-test (also known as Student's t-test) is a tool for evaluating the means of one or two populations using hypothesis testing. A t-test may be used to evaluate whether a single group differs from a known value (a one-sample t-test), whether two groups differ from each other (an independent two-sample t-test), or whether there is a significant difference in paired measurements (a paired, or dependent samples t-test).
How are t-tests used?
First, you define the hypothesis you are going to test and specify an acceptable risk of drawing a faulty conclusion. For example, when comparing two populations, you might hypothesize that their means are the same, and you decide on an acceptable probability of concluding that a difference exists when that is not true. Next, you calculate a test statistic from your data and compare it to a theoretical value from a t-distribution. Depending on the outcome, you either reject or fail to reject your null hypothesis.
What if I have more than two groups?
You cannot use a t-test. Use a multiple comparison method. Examples are analysis of variance (ANOVA), Tukey-Kramer pairwise comparison, Dunnett's comparison to a control, and analysis of means (ANOM).
t-Test assumptions
While t-tests are relatively robust to deviations from assumptions, t-tests do assume that:
The data are continuous.
The sample data have been randomly sampled from a population.
There is homogeneity of variance (i.e., the variability of the data in each group is similar).
The distribution is approximately normal.
For two-sample t-tests, we must have independent samples. If the samples are not independent, then a paired t-test may be appropriate.
Types of t-tests
There are three t-tests to compare means: a one-sample t-test, a two-sample t-test and a paired t-test. The table below summarizes the characteristics of each and provides guidance on how to choose the correct test. Visit the individual pages for each type of t-test for examples along with details on assumptions and calculations.
Student's t-test
Independent groups t-test
Independent samples t-test
Equal variances t-test
Pooled t-test
Unequal variances t-test
Paired groups t-test
Dependent samples t-test
Number of variables
One Two Two
Type of variable
Continuous measurement
Categorical or Nominal to define groups
Categorical or Nominal to define pairing within group
Purpose of test
Decide if the population mean is equal to a specific value or not Decide if the population means for two different groups are equal or not Decide if the difference between paired measurements for a population is zero or not
Example: test if...
Mean heart rate of a group of people is equal to 65 or not Mean heart rates for two groups of people are the same or not Mean difference in heart rate for a group of people before and after exercise is zero or not
Estimate of population mean
Sample average Sample average for each group Sample average of the differences in paired measurements
Population standard deviation
Unknown, use sample standard deviation Unknown, use sample standard deviations for each group Unknown, use sample standard deviation of differences in paired measurements
Degrees of freedom
Number of observations in sample minus 1, or:
n–1 Sum of observations in each sample minus 2, or:
n1 + n2 – 2 Number of paired observations in sample minus 1, or:
The table above shows only the t-tests for population means. Another common t-test is for correlation coefficients. You use this t-test to decide if the correlation coefficient is significantly different from zero.
One-tailed vs. two-tailed tests
When you define the hypothesis, you also define whether you have a one-tailed or a two-tailed test. You should make this decision before collecting your data or doing any calculations. You make this decision for all three of the t-tests for means.
To explain, let's use the one-sample t-test. Suppose we have a random sample of protein bars, and the label for the bars advertises 20 grams of protein per bar. The null hypothesis is that the unknown population mean is 20. Suppose we simply want to know if the data shows we have a different population mean. In this situation, our hypotheses are:
$ \mathrm H_o: \mu = 20 $
$ \mathrm H_a: \mu \neq 20 $
Here, we have a two-tailed test. We will use the data to see if the sample average differs sufficiently from 20 – either higher or lower – to conclude that the unknown population mean is different from 20.
Suppose instead that we want to know whether the advertising on the label is correct. Does the data support the idea that the unknown population mean is at least 20? Or not? In this situation, our hypotheses are:
$ \mathrm H_o: \mu >= 20 $
$ \mathrm H_a: \mu < 20 $
Here, we have a one-tailed test. We will use the data to see if the sample average is sufficiently less than 20 to reject the hypothesis that the unknown population mean is 20 or higher.
See the "tails for hypotheses tests" section on the t-distribution page for images that illustrate the concepts for one-tailed and two-tailed tests.
How to perform a t-test
For all of the t-tests involving means, you perform the same steps in analysis:
Define your null ($ \mathrm H_o $) and alternative ($ \mathrm H_a $) hypotheses before collecting your data.
Decide on the alpha value (or α value). This involves determining the risk you are willing to take of drawing the wrong conclusion. For example, suppose you set α=0.05 when comparing two independent groups. Here, you have decided on a 5% risk of concluding the unknown population means are different when they are not.
Check the data for errors.
Check the assumptions for the test.
Perform the test and draw your conclusion. All t-tests for means involve calculating a test statistic. You compare the test statistic to a theoretical value from the t-distribution. The theoretical value involves both the α value and the degrees of freedom for your data. For more detail, visit the pages for one-sample t-test, two-sample t-test and paired t-test.
Free Online Statistics Course
Try JMP for Free
Statistical Thinking for Industrial Problem Solving
Build practical skills in using data to solve problems better.
Data analysis software for Mac and Windows
JMP links dynamic data visualization with powerful statistics.
© 2022 JMP Statistical Discovery LLC. All Rights Reserved.