The tTest
What is a ttest?
A ttest (also known as Student's ttest) is a tool for evaluating the means of one or two populations using hypothesis testing. A ttest may be used to evaluate whether a single group differs from a known value (a onesample ttest), whether two groups differ from each other (an independent twosample ttest), or whether there is a significant difference in paired measurements (a paired, or dependent samples ttest).
How are ttests 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 tdistribution. 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 ttest. Use a multiple comparison method. Examples are analysis of variance (ANOVA), TukeyKramer pairwise comparison, Dunnett's comparison to a control, and analysis of means (ANOM).
tTest assumptions
While ttests are relatively robust to deviations from assumptions, ttests 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 twosample ttests, we must have independent samples. If the samples are not independent, then a paired ttest may be appropriate.
Types of ttests
There are three ttests to compare means: a onesample ttest, a twosample ttest and a paired ttest. 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 ttest for examples along with details on assumptions and calculations.
Onesample ttest  Twosample ttest  Paired ttest  

Synonyms  Student’s ttest 


Number of variables  One  Two  Two 
Type of variable 



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: n_{1} + n_{2} – 2  Number of paired observations in sample minus 1, or: n–1 
The table above shows only the ttests for population means. Another common ttest is for correlation coefficients. You use this ttest to decide if the correlation coefficient is significantly different from zero.
Onetailed vs. twotailed tests
When you define the hypothesis, you also define whether you have a onetailed or a twotailed test. You should make this decision before collecting your data or doing any calculations. You make this decision for all three of the ttests for means.
To explain, let’s use the onesample ttest. 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 twotailed 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 onetailed 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 tdistribution page for images that illustrate the concepts for onetailed and twotailed tests.
How to perform a ttest
For all of the ttests 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 ttests for means involve calculating a test statistic. You compare the test statistic to a theoretical value from the tdistribution. The theoretical value involves both the α value and the degrees of freedom for your data. For more detail, visit the pages for onesample ttest, twosample ttest and paired ttest.