One-Sample t-Test Calculator
A one-sample t-test checks whether a sample mean differs from a hypothesised value. With x̄ = 52, s = 8, n = 25 and μ₀ = 50, t = 1.25 with 24 degrees of freedom and a two-tailed p-value of 0.2234, so you fail to reject H₀ at α = 0.05.
Last updated · By S. Dilshan · Runs in your browser, nothing is uploaded
Advanced options
Step-by-Step Solution
What Is a One-Sample t-Test?
A one-sample t-test compares the mean of a single sample with a specific value, called the hypothesised mean (μ₀). It answers the question: if the true mean really were μ₀, how surprising would a sample mean like mine be?
You use the t-distribution rather than the normal distribution because the population standard deviation is almost never known. The t-distribution has heavier tails to reflect the extra uncertainty of estimating spread from a small sample. As the sample grows, it approaches the normal distribution.
The Hypotheses
| Test type | Null hypothesis H₀ | Alternative H₁ | Use when |
|---|---|---|---|
| Two-tailed | μ = μ₀ | μ ≠ μ₀ | Any difference matters |
| Right-tailed | μ ≤ μ₀ | μ > μ₀ | Only an increase matters |
| Left-tailed | μ ≥ μ₀ | μ < μ₀ | Only a decrease matters |
t-Test Formula
x̄is the sample mean.μ₀is the value you are testing against.sis the sample standard deviation.nis the sample size.s ÷ √nis the standard error of the mean.
The t statistic measures how many standard errors the sample mean is from μ₀. The p-value is the probability of seeing a t at least that extreme if H₀ were true. If the p-value is below your significance level α (usually 0.05), you reject H₀.
Assumptions Behind the Test
- The observations are independent of one another.
- The data is continuous, or close to it.
- The data is roughly normal, or the sample is large enough (often n ≥ 30) for the sample mean to behave normally.
- There are no extreme outliers that dominate the mean.
Effect Size: How Big Is the Difference?
A p-value does not tell you how large a difference is. Cohen’s d does: d = (x̄ − μ₀) ÷ s. In the example, d = 2 ÷ 8 = 0.25. By the usual benchmarks, 0.2 is small, 0.5 is medium and 0.8 is large, so this is a small effect. Report it alongside the p-value.
Worked Example: One-Sample t-Test
A bottling line is supposed to fill bottles to a mean of 50 ml. A sample of 25 bottles has a mean of 52 and a standard deviation of 8. Test at α = 0.05.
- State the hypotheses: H₀: μ = 50; H₁: μ ≠ 50.
- Standard error: 8 ÷ √25 = 1.6.
- t statistic: (52 − 50) ÷ 1.6 = 1.25.
- Degrees of freedom: 24.
- p-value (two-tailed): 0.2234.
- Critical value: ±2.0639. Since 1.25 is inside that range and 0.2234 > 0.05, fail to reject H₀.
- 95% confidence interval: 48.70 to 55.30, which includes 50.
What Happens with More Data?
Keep the same mean and standard deviation but test 100 bottles. The standard error falls to 0.8, t rises to 2.5, the p-value drops to 0.0141 and the interval becomes 50.41 to 53.59. Now the same 2 ml difference is statistically significant. Bigger samples make the same difference easier to detect.
How to Use This t-Test Calculator
- Enter the sample mean, sample standard deviation and sample size.
- Enter the hypothesised mean μ₀ you are testing against.
- Choose the significance level α, normally 0.05.
- Read the t statistic, degrees of freedom, all three p-values, the critical value, the decision and the confidence interval.
Comparing two groups instead? Use the two-sample t-test calculator. If you only have raw data, get the mean and standard deviation from the standard deviation calculator.
Real-World Uses of the One-Sample t-Test
- Quality control: checking that the average weight, volume or strength of a batch meets the specification.
- Medicine: testing whether a group’s average blood pressure differs from a clinical target.
- Education: comparing a class’s average score with the national average.
- Business: testing whether average delivery time meets a promised service level.
- Science: comparing a measured value with a published reference constant.
What Are the Most Common Mistakes With the One-Sample t-Test Calculator?
- Reading “fail to reject” as “proved equal”. It only means the data did not give strong enough evidence of a difference.
- Misinterpreting the p-value. It is not the probability that H₀ is true.
- Ignoring assumptions. The test assumes independent observations and roughly normal data, or a reasonably large sample.
- Choosing the tail after seeing the data. Decide on one- or two-tailed before you look.
- Confusing statistical and practical significance. A very large sample can make a trivial difference “significant”.
- Repeated testing. Running many tests inflates the chance of a false positive.
Where Can You Verify These Formulas?
The definitions and formulas on this page follow standard references. Check them against these sources:
Built and maintained by S. Dilshan. Found a mistake? Email [email protected] with the page address.
Frequently Asked Questions
When should I use a one-sample t-test?
Use it when you have one sample of numerical data and want to know whether its mean differs from a specific value, and the population standard deviation is unknown.
What is a p-value in a t-test?
It is the probability of getting a t statistic at least as extreme as yours if the null hypothesis were true. A small p-value, typically below 0.05, is evidence against the null hypothesis.
What are degrees of freedom in a t-test?
For a one-sample t-test the degrees of freedom are n − 1. They determine the exact shape of the t-distribution used to find the p-value.
What is the difference between a t-test and a z-test?
A z-test needs a known population standard deviation, while a t-test uses the sample standard deviation and the t-distribution, which is more cautious for small samples.
Should I use a one-tailed or two-tailed test?
Use two-tailed unless you have a strong, prior reason to care about only one direction. A two-tailed test detects a difference in either direction.
What sample size do I need for a t-test?
There is no fixed minimum, but small samples have little power to detect modest differences. Power analysis can estimate the size you need.