A t-test is a statistical hypothesis test. People use it when they want to compare a mean (average) of a measurement from one group A to some theoretical, expected value. People also use it when they want to compare the mean (average) of a measurement of two groups A and B. They want to decide if the mean in group A is different to the theoretical value or to the mean in group B.
Example[change | change source]
For example, pretend there are two groups of people. One group exercises a lot and the other doesn't. Do the people who exercise tend to live longer than those who don't? Then the property of interest is the average life time. Is the average life time of people who exercise different to the average life time of people who don't? A t-test can help answer this question.
When this is used[change | change source]
The t-test is used when the property's variance in the groups is unknown. When people want to do the t-test they have to calculate the variance from the sample (the collection of data). This calculated variance is almost always different to the true variance in the group. The t-test was created to care about this difference.