T-Test Calculator
One-sample ยท two-sample ยท paired ยท Welch ยท t curve
Result
Enter data and click Calculate
Perform one-sample, two-sample, paired, or Welch t-tests with full results.
T-Distribution Visualization
Python Compiler
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 uses the t-distribution, which accounts for small sample sizes and unknown population standard deviations.
Hypothesis Testing
Compare a sample mean to a known value or compare two group means to determine if the difference is statistically significant.
Statistical Significance
The p-value tells you the probability of observing your data under the null hypothesis. Small p-values suggest significant results.
Effect Size
Cohenโs d measures the practical significance of the difference. A result can be statistically significant but have a small effect.
Types of T-Tests
Choosing the Right T-Test
| Scenario | Test Type | When to Use |
|---|---|---|
| Compare sample mean to a known value | One-Sample | Testing if a batch mean equals the specification value |
| Compare two independent groups with similar variances | Two-Sample | Treatment vs control, males vs females |
| Before and after measurements on same subjects | Paired | Pre-test vs post-test, left eye vs right eye |
| Two independent groups with unequal or unknown variances | Welch | Default choice when unsure about equal variances |
Tip: When in doubt, use the Welch t-test. It is robust to unequal variances and performs well even when variances are actually equal.
Interpreting Results
โ Significant Result
When p < ฮฑ, reject the null hypothesis. The observed difference is unlikely due to random chance alone. Report the t-statistic, df, and p-value.
โ Not Significant
When p โฅ ฮฑ, fail to reject the null hypothesis. There is insufficient evidence of a significant difference. This does not prove the groups are equal.
๐ Effect Size (Cohenโs d)
Small: d โ 0.2, Medium: d โ 0.5, Large: d โ 0.8. A significant p-value with tiny d may lack practical importance.
โ๏ธ Confidence Interval
The CI for the mean difference shows the range of plausible values. If it excludes zero, the result is significant at that confidence level.
Assumptions & When to Use Alternatives
- 1. Normality: Data should be approximately normally distributed, or sample size should be large enough (n โฅ 30) for the Central Limit Theorem to apply.
- 2. Independence: Observations must be independent of each other (except in paired tests where pairs are dependent but differences are independent).
- 3. Equal Variances: The two-sample t-test assumes equal variances. Use Welchโs t-test if this assumption is violated.
- 4. Continuous Data: T-tests are designed for continuous (interval or ratio) data, not ordinal or categorical data.
Non-parametric alternatives: If your data violates normality with small samples, consider the Mann-Whitney U test (for independent samples) or Wilcoxon signed-rank test (for paired samples). For comparing more than two groups, use ANOVA instead.