Confidence Interval and t-Test Calculator for a Mean: Margin of Error, t Value and p-Value
Estimate a population mean with a confidence interval and test it against a claimed value.
Engineering student calculators
Free textbook calculators with every step shown, so you can check your own working. Pick one, type in your numbers and see the formulas worked out. Or switch to Ask a question for an explained answer. No account needed.
Calculated from standard textbook formulas, with every step shown. The formulas are fixed, so the working does not need checking: what matters is the numbers you type in. Use these calculators only if you are competent to choose the inputs (loads, material strength, dimensions, supports) and check your units and assumptions. For learning and checking your own working: design and sign-off are for a qualified engineer. Drafting Central does not store the numbers you type.
How this calculator works
Enter the sample mean, the sample standard deviation and the sample size.
Choose the confidence level, usually 95 percent, and the value of the mean to test against.
The calculator gives the standard error, the t value, the margin of error, the interval, the test statistic and the two-tailed p-value.
Formulas used
- SE = \frac{s}{\sqrt{n}}
- \bar{x}\pm t^*\,SE
- t = \frac{\bar{x} - \mu_0}{SE},\quad df = n - 1
Worked example
With the default numbers in the calculator above:
- Standard error of the mean: 1.58
- Degrees of freedom: 9
- Critical t value for the confidence level (two-sided): 2.26
- Margin of error: 3.58
- Confidence interval for the mean: 46.42 to 53.58 (95.00 percent confident)
- For comparison, the z value for the same level (used if the population standard deviation is known, or n is large): 1.96, giving a margin of 3.10
- Test statistic for the null hypothesis that the mean is 47: 1.90
- Two-tailed p-value: 0.0903
Change the numbers in the calculator to see the full working, every step, for your own case.
Common questions
When do I use t instead of z?
Use t when the population standard deviation is not known and is estimated from the sample, which is nearly always.
What does a 95 percent confidence interval mean?
If you repeated the sampling many times, about 95 percent of the intervals would contain the true mean.
What is a p-value?
The chance of a result at least as far from the claim as yours if the claim were true. A small p-value is evidence against the claim.
How big a sample do I need?
A bigger sample gives a smaller margin of error: it shrinks with the square root of the sample size.
Related calculators
Got a question about this? Ask an engineering question and get a plain-language answer with references.
Further reading: Any first-year statistics text (inference for a mean, Student's t distribution).
Need a calculator we do not have?
Embed this calculator on your own page
Copy this code into your page. The calculator runs inside the frame and links back to Drafting Central.
Need this drawn, designed or checked?
Drafting Central is a mechanical engineering and drafting business working with customers across Australia and around the world. A calculator gives you the numbers; we can turn them into drawings and designs.
Need help with a real project?
Talk to Drafting Central →