What is a t-test?
A t-test is a statistical hypothesis test used to determine whether there is a significant difference between the means of one or two groups. It produces a t-statistic and a p-value, which together tell you how likely the observed difference is due to random chance. T-tests are especially useful for small samples (fewer than 30 observations), where a z-test would be inappropriate. See also our Cpk (Process Capability Index) — Process Capability Index.
What are the different types of t-tests?
The three main types are: (1) One-sample t-test — compares a sample mean to a known population mean. (2) Two-sample (unpaired) t-test — compares the means of two independent groups that share equal variance. (3) Welch's t-test — like the two-sample test but does not assume equal variances, making it more robust. (4) Paired t-test — compares means from the same group at two different times or under two conditions.
What does the p-value mean in a t-test?
The p-value represents the probability of observing a t-statistic as extreme as yours (or more extreme) if the null hypothesis were true. A p-value below your chosen significance level (α, commonly 0.05) means you reject the null hypothesis and conclude there is a statistically significant difference between the means. A higher p-value means the data do not provide enough evidence to reject the null.
When should I use a paired t-test vs. an unpaired t-test?
Use a paired t-test when your two sets of measurements come from the same subjects or are otherwise naturally linked — for example, measuring a patient's blood pressure before and after treatment. Use an unpaired (two-sample) t-test when the two groups are completely independent, such as comparing test scores between two separate classes.
What are the assumptions of a t-test?
T-tests assume: (1) The data are continuous and approximately normally distributed (or n ≥ 30 for the Central Limit Theorem to apply). (2) The observations are independent of each other. (3) For the standard two-sample t-test, the two groups have roughly equal variances — if not, use Welch's t-test instead. Violations of these assumptions can lead to unreliable results.
What is the difference between a one-tailed and two-tailed t-test?
A two-tailed test checks for a difference in either direction (μ₁ ≠ μ₂), which is appropriate when you have no directional prediction. A one-tailed test checks for a difference in a specific direction — either that Group 1's mean is greater than Group 2's (right-tailed) or less than it (left-tailed). One-tailed tests have more statistical power but should only be used when the direction of the effect is predicted in advance.
What is the difference between Welch's t-test and the standard two-sample t-test?
The standard two-sample t-test assumes that both groups have equal variances (homoscedasticity). Welch's t-test relaxes that assumption, making it safer to use when the two groups have different sample sizes or noticeably different standard deviations. In practice, many statisticians recommend defaulting to Welch's t-test because it performs well even when variances are equal.
How many degrees of freedom does a t-test have?
For a one-sample or paired t-test, degrees of freedom (df) = n − 1. For a standard two-sample t-test, df = n₁ + n₂ − 2. Welch's t-test uses the Welch–Satterthwaite equation to calculate an approximate (fractional) df based on both sample sizes and variances, which is why you may see a non-integer result for that test type. You might also find our Median Calculator useful.