T-Test Calculator

A t-test checks whether a difference between means is bigger than chance would explain: t = difference ÷ standard error, and a small p-value means it probably isn’t chance. Pick one sample, two samples or paired, type your means, standard deviations and sample sizes, and see t, the p-value and the working.

T statistic
−3.1424 p = 0.0054

t = −3.1424 with 18.8466 degrees of freedom gives a two-tailed p-value of 0.0054. That is less than α = 0.05, so the test rejects the null hypothesis: the difference is statistically significant.

Degrees of freedom 18.8466
P-value 0.0054
Standard error 0.3819

What is a t-test?

A t-test compares means using the t distribution, for when the standard deviation comes from your sample. A one-sample test checks a mean against a set value, a two-sample test compares two separate groups, and a paired test compares two measurements on the same people or things (before and after), by testing their differences.

For two samples, Welch’s test doesn’t assume the two groups have equal variances, and its degrees of freedom need not be a whole number. The pooled test assumes equal variances and uses n₁ + n₂ − 2 degrees of freedom.

Source NIST/SEMATECH e-Handbook · 1.3.5.3 Two-Sample t-Test for Equal Means ↗OpenStax Introductory Statistics 2e · 10.1 Two Population Means with Unknown Standard Deviations ↗OpenStax Introductory Statistics 2e · 10.4 Matched or Paired Samples ↗

How to calculate a t-test

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

Here it is with your numbers:

  1. Standard error: √(s₁²/n₁ + s₂²/n₂) = 0.381875
  2. t statistic: −1.2 ÷ 0.381875 = −3.1424
  3. Degrees of freedom (Welch): 18.8466
  4. Two-tailed p-value: 2 × the area beyond 3.1424, which is 0.0054

It means that if the null hypothesis were true, a t this far out in either direction would turn up with a probability of 0.0054.

Source NIST/SEMATECH e-Handbook · 7.2.2 Are the data consistent with the assumed process mean? ↗

T-test examples

Worked examples from NIST’s handbook and OpenStax’s statistics textbook. Tap one to load it.

Exampletdfp-value
Wafer particle counts vs 50 (one sample)1.781790.1085
Girls vs boys, hours of sport (Welch)−3.142418.84660.0054
US vs Japanese cars, mpg (pooled)−12.62063265.2732 × 10⁻³⁰
Pain before and after hypnotism (paired, left)−3.042370.0094

FAQs

How to do the t-test step by step?

State the null hypothesis (for example, the mean is 50). Work out t = (x̄ − μ₀) ÷ (s ÷ √n) with n − 1 degrees of freedom, find the p-value (or the critical value) from the t distribution, and reject the null hypothesis if the p-value is below your significance level.

Source NIST/SEMATECH e-Handbook · 7.2.2 Are the data consistent with the assumed process mean? ↗

What is the t-test formula?

For one sample, t = (x̄ − μ₀) ÷ (s ÷ √n). For two samples, t = (x̄₁ − x̄₂) ÷ √(s₁²/n₁ + s₂²/n₂), or with the pooled standard deviation when the variances are assumed equal.

Source NIST/SEMATECH e-Handbook · 1.3.5.3 Two-Sample t-Test for Equal Means ↗

How do I calculate t *?

t* is the critical value of the t distribution for your degrees of freedom and significance level. For a two-sided test at α = 0.05 with 9 degrees of freedom, it is 2.262: reject the null hypothesis if |t| is bigger than that.

Source NIST/SEMATECH e-Handbook · 7.2.2 Are the data consistent with the assumed process mean? ↗

Sources

Related calculators