Compute the t-statistic and p-values for hypothesis testing of a sample mean against a hypothesized population mean.
Last updated: March 2026
Mean of your sample
Null hypothesis value
Sample SD
Number of observations
The t-statistic measures how many standard errors the sample mean is away from the hypothesized population mean. Formula: t = (x̄ − μ₀) / SE, where SE = s / √n. The t-distribution accounts for uncertainty in estimating the population SD from a sample, making it appropriate for small samples (n < 30) where the normal distribution may not apply.
The t-statistic follows a t-distribution with (n − 1) degrees of freedom. The further the t-statistic is from zero, the stronger the evidence against the null hypothesis. P-values derived from the t-distribution tell us the probability of observing a t-statistic as extreme or more extreme if the null hypothesis is true.
T-tests are fundamental in hypothesis testing: compare a sample to a population value (one-sample t-test), compare two independent samples (two-sample t-test), or compare paired measurements (paired t-test).
Quality Control: Checking Machine Calibration
Use t-test when σ is unknown and you estimate it from sample (s). Use z-test when σ is known or n {'>'} 30 (where t-distribution ≈ normal). For small samples, always use t-test.
Degrees of freedom represent free variability in the data. With n observations and a constraint (knowing the mean), you have n − 1 independent pieces of information. df affects the shape of the t-distribution—smaller df means wider tails (more conservative).
Two-tailed: tests if μ ≠ μ₀ (difference in either direction). One-tailed: tests if μ {'>'} μ₀ or μ {'<'} μ₀ (specific direction). Two-tailed p-values are 2× one-tailed for the same |t|.
P-value is the probability of observing a t-statistic as extreme (or more) if H₀ is true. p {'<'} 0.05 usually means reject H₀. p ≥ 0.05 means fail to reject H₀. Low p-values indicate strong evidence against H₀.
Yes. If x̄ {'<'} μ₀, then t is negative. The sign indicates direction of deviation. For two-tailed tests, we use |t| or square it. For one-tailed tests, the sign matters for the hypothesis.
A 95% CI for μ = x̄ ± t* × SE, where t* is the critical value. If 0 is outside the CI, you reject H₀ at α=0.05. They're two ways of testing the same hypothesis.