Z Table

T Test Calculator

A t test compares a sample mean with a value, or two sample means with each other, when the population standard deviation is unknown. The one-sample statistic is t = (x̄ − μ₀) ÷ (s ÷ √n) with n − 1 degrees of freedom. For x̄ = 52, μ₀ = 50, s = 10 and n = 25, t = 1.0 and the two-tailed p-value is 0.3273, so you do not reject the null hypothesis at 0.05.

t statistic

1

p-value

0.3273

Degrees of freedom

24

At α = 0.05

Fail to reject

Working

  1. SE = 10 ÷ √25 = 2
  2. t = (52 − 50) ÷ 2 = 1
  3. df = n − 1 = 24
  4. p-value (two-tailed) = 0.3273

Example: one-sample, x̄ = 52, μ₀ = 50, s = 10, n = 25

  • SE = 10 ÷ √25 = 2
  • t = (52 − 50) ÷ 2 = 1
  • df = n − 1 = 24
  • p-value (two-tailed) = 0.3273
  • Welch (52 vs 48): SE = √(10² ÷ 25 + 12² ÷ 30) = 2.9665
  • Welch (52 vs 48): t = (52 − 48) ÷ 2.9665 = 1.3484
  • Welch (52 vs 48): Welch df = 53
  • Welch (52 vs 48): p-value (two-tailed) = 0.1833

One-sample and two-sample tests

The one-sample test asks whether a mean differs from a hypothesised value μ₀. The two-sample test here is Welch’s test, which does not assume equal variances: t = (x̄₁ − x̄₂) ÷ √(s₁²/n₁ + s₂²/n₂), with the Welch–Satterthwaite degrees of freedom, usually not a whole number. For 52 (s = 10, n = 25) against 48 (s = 12, n = 30), t = 1.348 and the two-tailed p-value is 0.1833.

For a paired test (before and after on the same subjects), compute the differences and run the one-sample test on them with μ₀ = 0. Pick the alternative hypothesis before looking at the data: two-tailed for "different", right-tailed for "greater", left-tailed for "less".

Assumptions and reading the result

The data should be independent observations, and for small samples roughly normal or without strong outliers. Reject H₀ when the p-value is below α, or when |t| exceeds the critical value in the t table. A small p-value shows the difference is unlikely under H₀; it does not show the difference is large, so report the mean difference or a confidence interval as well.

Frequently asked questions

What is the formula for the t statistic?
For one sample, t = (x̄ − μ₀) ÷ (s ÷ √n). For two samples with Welch’s method, t = (x̄₁ − x̄₂) ÷ √(s₁²/n₁ + s₂²/n₂).
Should I use one-tailed or two-tailed?
Use two-tailed unless your alternative hypothesis names a direction in advance.
What are the degrees of freedom?
n − 1 for one sample. For Welch’s two-sample test, a formula based on both variances and sample sizes.
When should I use z instead?
When the population standard deviation is known. The p-value calculator handles z statistics.

Sources and references