DigitHelm

T-Test Calculator | One-Sample

Perform a one-sample t-test to determine if a sample mean differs significantly from a known value.

Test Type

Quick Examples

What Is the T-Test Calculator | One-Sample?

This sample t test calculator supports three types of hypothesis testing using the Student t distribution: one-sample (compare a sample mean to a known population value), two-sample Welch's t-test (compare two independent groups), and paired t-test (compare matched pairs like before/after measurements). Enter your data, define your null hypothesis (H₀), and click Calculate. The tool finds the t value, degrees of freedom, exact p-value, Cohen's d effect size, and 95% confidence interval.

  • p-value computed via regularized incomplete beta function (exact, not table lookup)
  • Degrees of freedom (df) calculated using Welch-Satterthwaite for two-sample tests, no equal-variance assumption
  • Cohen's d effect size: small < 0.2, medium 0.2–0.8, large > 0.8
  • 95% CI shows the plausible range for the true mean difference
  • Paired test requires equal-length datasets (matched subjects)

Formula

t-Test Formulas

One-Sample

t = (x̄ − μ₀) / (s/√n)

Two-Sample

t = (x̄₁−x̄₂) / √(s₁²/n₁+s₂²/n₂)

Paired

t = d̄ / (s_d/√n); d = x₁−x₂

Cohen's d

d = |x̄₁−x̄₂| / s_pooled

95% CI

x̄ ± t*(α/2) × SE

Welch df

(s₁²/n₁+s₂²/n₂)²/[(s₁²/n₁)²/(n₁−1)+…]

How to Use

  1. 1Select the test type: One-Sample, Two-Sample (Welch), or Paired
  2. 2Enter your data (numbers separated by spaces or commas)
  3. 3For one-sample: enter the null hypothesis value μ₀ (the population mean to test against)
  4. 4Set the significance level α (0.05 is standard) and choose one-tailed or two-tailed
  5. 5Click Calculate, the t value, degrees of freedom, and p-value appear instantly
  6. 6Read the hypothesis testing decision, confidence interval, and Cohen's d effect size with full step-by-step working

Example Calculation

One-sample t-test: Do heights differ from μ=170?

Data: 165, 172, 168, 175, 162, 170, 178, 165, 173, 169
n=10, x̄=168.7, s=4.47, SE=1.414
t = (168.7 − 170) / 1.414 = −0.919
df = 9, p (two-tailed) = 0.382
→ Fail to reject H₀ (p > 0.05)

Two-sample: Group A (78,82,74,79,81) vs Group B (70,75,72,68,74)

x̄₁=78.8, s₁=3.03 | x̄₂=71.8, s₂=2.77
SE = √(9.18/5 + 7.68/5) = 1.86
t = (78.8 − 71.8) / 1.86 = 3.76, df = 7
p = 0.007 → Reject H₀ (significant difference)

p-value vs Significance Level

In hypothesis testing, the p-value is the probability of observing a result at least as extreme as yours, assuming the null hypothesis (H₀) is true. It is NOT the probability that H₀ is true. A small p-value (e.g., p = 0.007) means your result is rare under H₀. Statistical significance (p < α) does not imply practical importance, always check Cohen's d for effect size.

Understanding T-Test | One-Sample

t-Test Quick Reference

Test TypeFormuladfUse When
One-Samplet = (x̄−μ₀)/(s/√n)n−1Compare mean to known value
Two-Sample (Welch)t = (x̄₁−x̄₂)/SE_welchWelch-Satt.Compare two independent groups
Pairedt = d̄/(s_d/√n)n−1Before/after same subjects
Cohen's d (small)d < 0.2Negligible practical effect
Cohen's d (medium)0.5 ≤ d < 0.8Moderate practical effect
Cohen's d (large)d ≥ 0.8Substantial practical effect

Frequently Asked Questions

When should I use a one-sample vs two-sample t-test?

  • One-sample: Is this batch's mean weight = 500g (manufacturer specification)?
  • Two-sample: Do male and female students score differently on the same test?
  • Paired: Does blood pressure decrease after this drug (measured on same patients)?
  • Key distinction: paired removes between-subject variability, increasing power

Why use Welch's t-test instead of Student's t-test?

  • Welch's df formula: (s₁²/n₁+s₂²/n₂)² / [(s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1)]
  • If variances are equal, Welch gives nearly the same result as Student's t
  • If variances differ (e.g., ratio 4:1), Student's t can be badly miscalibrated
  • Modern recommendation: always use Welch's for two-sample tests

What is a p-value and how do I interpret it?

Common misconceptions about the p-value: it is NOT the probability the null hypothesis is true. It is NOT the probability of a false positive. It is NOT a measure of effect size.

  • p < 0.05: conventional threshold (arbitrary; Neyman-Pearson framework)
  • p < 0.01: "highly significant" in many fields
  • Small sample + large p: may lack statistical power, not necessarily "no effect"
  • Large sample: even trivial effects reach p < 0.05; check effect size

What is Cohen's d and how do I interpret it?

  • d = 0.2: small effect (like the height difference between 15- and 16-year-olds)
  • d = 0.5: medium effect (IQ difference between professional and non-professional occupations)
  • d = 0.8: large effect (IQ gap between college and non-college graduates)
  • A study can be statistically significant (low p) but practically unimportant (small d)

What assumptions does the t-test require?

  • Normality: t-test is robust for n ≥ 30 by Central Limit Theorem
  • Independence: each observation must be independent of the others
  • Outliers can strongly distort the mean and t-statistic for small n
  • Non-normal data with small n: consider Wilcoxon signed-rank (non-parametric alternative)

What is the 95% confidence interval for the mean difference?

  • CI does not contain 0 ↔ two-tailed p < 0.05 (they are mathematically equivalent)
  • Wider CI = more uncertainty (small n or high variability)
  • Narrower CI = greater precision (large n or low variability)
  • Report CIs rather than just p-values, they convey much more information

Is this t-test calculator free?

Yes, completely free with no registration required. All calculations run locally in your browser.

Related Calculators