T-Test: Definition and Overview
A t-test is an inferential statistical test that compares the means of two groups to determine whether they are statistically different. It is commonly used in hypothesis testing when samples are approximately normally distributed and population variances are unknown.
Key points:
* Requires sample means, sample variances (or standard deviations), and sample sizes.
* Produces a t-value (t-score) and degrees of freedom (df).
* Compare the computed t-value to a critical value from the t-distribution (based on df and chosen significance level) to accept or reject the null hypothesis (that the two population means are equal).
Explore More Resources
Assumptions
A t-test is valid when:
* The outcome is measured on a continuous or ordinal scale.
* Samples are randomly selected.
* Data are approximately normally distributed (especially important for small samples).
* For pooled (equal-variance) t-tests: variances in the two groups are similar (homoscedasticity).
How the Test Works
- State hypotheses:
- Null hypothesis (H0): means are equal.
- Alternative hypothesis (H1): means differ (two-tailed) or one mean is greater/less (one-tailed).
- Compute the t-value = (difference in sample means) / (estimate of standard error).
- Determine degrees of freedom (depends on test type).
- Compare the absolute t-value to the critical t from a t-distribution table (or use a p-value).
- If |t| > critical value (or p < α), reject H0 — the difference is statistically significant.
- Otherwise, do not reject H0.
A larger absolute t-value indicates stronger evidence that the group means differ.
Explore More Resources
When to Use Each T-Test
Decide first whether samples are paired (dependent) or independent (unpaired):
- Paired (dependent): same subjects measured twice (before/after) or matched pairs.
- Independent (unpaired): observations in group A are unrelated to observations in group B.
For independent samples, choose between:
* Pooled (equal-variance) t-test: use when sample sizes and variances are similar.
* Welch’s (unequal-variance) t-test: use when sample sizes or variances differ. Welch’s is more robust when variances are unequal.
Explore More Resources
Formulas
Notation:
* mean1, mean2 = sample means
* var1, var2 = sample variances (squared standard deviations)
* n1, n2 = sample sizes
* s(diff) = standard deviation of paired differences
* sp^2 = pooled variance
- Paired t-test (dependent samples)
- Use when observations are matched or repeated measures.
- t = (mean1 − mean2) / ( s(diff) / sqrt(n) )
-
df = n − 1 (n = number of paired differences)
-
Pooled (equal-variance) independent t-test
- Pooled variance:
sp^2 = [ (n1 − 1)*var1 + (n2 − 1)*var2 ] / (n1 + n2 − 2)
- t = (mean1 − mean2) / sqrt( sp^2 * (1/n1 + 1/n2) )
-
df = n1 + n2 − 2
-
Welch’s (unequal-variance) t-test
- t = (mean1 − mean2) / sqrt( var1/n1 + var2/n2 )
- df ≈ ( (var1/n1 + var2/n2)^2 ) / ( (var1^2/((n1^2)(n1−1))) + (var2^2/((n2^2)(n2−1))) )
- Use this df (usually non-integer) when looking up the critical t; many software packages compute the exact p-value.
Example (Summary)
A gallery measures a diagonal dimension for two groups of paintings: group A (n1 = 10) and group B (n2 = 20). Sample means differ (e.g., 19.4 vs. 21.6). Because sample sizes and variances differ, Welch’s t-test is applied. Computation yields:
* t ≈ −2.2479 (use absolute value 2.2479)
* df ≈ 24.38 → rounded down to 24 for table lookup
* At α = 0.05 (two-tailed), critical t ≈ 2.064
Explore More Resources
Since 2.2479 > 2.064, reject the null hypothesis: the mean diagonal differs between the two groups (difference unlikely due to chance).
One-Tailed vs Two-Tailed Tests and the t-Distribution Table
- One-tailed: tests a directional hypothesis (e.g., mean1 > mean2). Use when you expect a specific direction.
- Two-tailed: tests for any difference (mean1 ≠ mean2). More common when direction is not predetermined.
Use the t-distribution table (or software) with the appropriate df and tail choice to find the critical t-value or p-value.
Explore More Resources
Practical Notes
- For moderate or large samples (n > ~30), the t-distribution approaches the normal distribution; z-tests may be used when population variance is known.
- Always check assumptions (normality, independence). If assumptions fail, consider nonparametric alternatives (e.g., Wilcoxon tests).
- Software (R, Python, SPSS, Excel) routinely implements t-tests and computes exact p-values and Welch df automatically.
Takeaways
- A t-test evaluates whether two sample means are sufficiently different to infer a population difference.
- Choose the appropriate variant: paired, pooled independent, or Welch’s independent test.
- The key inputs are sample means, variances (or standard deviations), and sample sizes; interpretation relies on the t-value and its degrees of freedom.