Hypothesis Test Calculator
Choose a test, enter your sample data or summary values, and Calvo gives the test statistic, exact p-value, critical value, decision at your significance level and the working, step by step.
Hypothesis test calculator
Which test should I use?
| Situation | Test |
|---|---|
| One sample mean vs a known value, population SD σ is known (or n is large and σ is given) | z-test |
| One sample mean vs a known value, only the sample SD s is available | One-sample t-test |
| Compare the means of two separate groups | Two-sample t-test (Welch if variances differ) |
| Same subjects measured twice (before / after) | Paired t-test |
| Do observed counts fit a claimed distribution? | Chi-square goodness of fit |
| Are two categorical variables related? | Chi-square test of independence |
| Compare means of three or more groups | One-way ANOVA |
Formulas
| Test | Statistic | Degrees of freedom |
|---|---|---|
| z-test | z = (x̄ − μ₀) / (σ/√n) | — |
| One-sample t | t = (x̄ − μ₀) / (s/√n) | n − 1 |
| Two-sample t (pooled) | t = (x̄₁ − x̄₂) / √[sp²(1/n₁ + 1/n₂)] | n₁ + n₂ − 2 |
| Two-sample t (Welch) | t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂) | Welch–Satterthwaite |
| Paired t | t = d̄ / (sd/√n) | n − 1 |
| Chi-square | χ² = Σ (O − E)² / E | k − 1 (fit) or (r − 1)(c − 1) |
The pooled variance is sp² = [(n₁−1)s₁² + (n₂−1)s₂²] / (n₁ + n₂ − 2). For a chi-square independence test the expected count of a cell is (row total × column total) / grand total.
How to read the p-value
The p-value is the probability of getting a result at least as extreme as yours if the null hypothesis H₀ were true. Compare it with your significance level α: if p ≤ α reject H₀; if p > α fail to reject H₀. A small p-value is evidence against H₀. It is not the probability that H₀ is true.
Worked example (one-sample t-test)
A teacher claims the class average is 50. A sample of n = 16 students has x̄ = 53.5 and s = 8. Test H₀: μ = 50 against H₁: μ ≠ 50 at α = 0.05.
SE = 8/√16 = 2, so t = (53.5 − 50)/2 = 1.75 with df = 15. The two-tailed p-value is 0.1005 and the critical value is ±2.131. Since p > 0.05 (and |t| < 2.131), we fail to reject H₀: the sample does not give enough evidence that the mean differs from 50.
Worked example (chi-square independence)
Observed table [[30, 20], [20, 30]]. Every expected count is 50×50/100 = 25, so χ² = 4 × (5²/25) = 4.0, df = 1, p = 0.0455. At α = 0.05 we reject H₀: the two variables are associated.
FAQ
What is the difference between a z-test and a t-test?
Use a z-test when the population standard deviation is known. Use a t-test when you only have the sample standard deviation, which is the usual case. For large samples the two give almost the same answer.
How does Calvo calculate the p-value?
It evaluates the exact cumulative distribution of the normal, Student t or chi-square distribution in your browser, so you get the exact p-value rather than a range from a table.
Should I use a one-tailed or two-tailed test?
Use a two-tailed test unless your hypothesis states a direction before you collect data. A right-tailed test checks for an increase, a left-tailed test for a decrease.
When should I use Welch's t-test instead of the pooled version?
Welch's test is the safer default because it does not assume equal variances. Use the pooled test only when you have good reason to believe the two groups have equal variance.
What if an expected count in a chi-square test is below 5?
The chi-square approximation becomes unreliable. Calvo warns you when any expected count is under 5; combine categories or collect more data.
Does 'fail to reject' mean H0 is true?
No. It only means the data do not provide enough evidence against H0. Absence of evidence is not evidence of absence.