probability calculators

Hypothesis Test Calculator

Run a one-sample z-test or t-test to determine whether a sample mean significantly differs from a hypothesized population mean. Essential for quality control, clinical trials, and academic research.

About this calculator

A one-sample hypothesis test assesses whether sample data provides enough evidence to reject a null hypothesis about a population mean (μ₀). The test statistic is computed as: t (or z) = (x̄ − μ₀) / (s / √n), where x̄ is the sample mean, μ₀ is the hypothesized mean, s is the sample standard deviation, and n is the sample size. The denominator s/√n is the standard error of the mean. For large samples (n ≥ 30), the z-distribution applies; for smaller samples, the t-distribution with n−1 degrees of freedom is used. The resulting test statistic is compared to a critical value at significance level α. If |t| exceeds the critical value, you reject H₀ and conclude the true mean likely differs from μ₀.

How to use

A manufacturer claims a bolt averages 50 mm. You sample 25 bolts and find x̄ = 51.2 mm, s = 3 mm. Enter Sample Mean = 51.2, Hypothesized Mean = 50, Sample Std Dev = 3, Sample Size = 25, α = 0.05. The calculator computes: t = (51.2 − 50) / (3 / √25) = 1.2 / 0.6 = 2.0. With df = 24 and a two-tailed test, the critical value is ≈ 2.064. Since 2.0 < 2.064, you fail to reject H₀ — insufficient evidence the mean differs from 50 mm.

Frequently asked questions

When should I use a z-test versus a t-test in a hypothesis test?

Use a z-test when the population standard deviation is known or when your sample size is large (typically n ≥ 30), because the central limit theorem ensures the sampling distribution is approximately normal. Use a t-test when the population standard deviation is unknown and the sample is small, since the t-distribution accounts for extra uncertainty with heavier tails. In practice, the t-test is almost always appropriate because the true population standard deviation is rarely known. The two tests converge as sample size grows.

What does the p-value mean in a hypothesis test?

The p-value is the probability of obtaining a test statistic at least as extreme as the one observed, assuming the null hypothesis is true. A small p-value (typically p ≤ 0.05) suggests the observed data would be unlikely under H₀, providing evidence to reject it. Crucially, the p-value does not measure the probability that the null hypothesis is true — that is a common misconception. It also does not measure effect size or practical significance, so always interpret it alongside context and confidence intervals.

What is the difference between a one-tailed and two-tailed hypothesis test?

A two-tailed test checks whether the population mean differs from μ₀ in either direction (higher or lower), splitting α across both tails of the distribution. A one-tailed test checks for a difference in only one direction — for example, testing whether a new drug increases recovery speed. One-tailed tests have more statistical power when the direction is known in advance but can be misleading if you choose the direction after seeing the data. Most scientific research defaults to two-tailed tests to avoid directional bias.