Hypothesis Test Calculator

Perform z-tests, t-tests, and two-sample tests with step-by-step solutions and p-values

Drag & drop or click to add images or PDF

Math Input
One-sample t-test: n=25, x_bar=52, sample sd=8, mu_0=50, alpha=0.05
One-sample z-test: n=100, x_bar=48, sigma=10, mu_0=50, alpha=0.05
Two-sample t-test: n1=30, x1=75, s1=6, n2=35, x2=71, s2=7
Test whether proportion p=0.48 differs from p_0=0.5, n=200, alpha=0.05

What is Hypothesis Testing?

Hypothesis testing is a formal statistical procedure for deciding whether sample data provide sufficient evidence to reject a claim about a population parameter.

The Two Hypotheses

  • Null hypothesis H0H_0: the default claim — assumes no effect, no difference, or a specific parameter value (e.g., μ=50\mu = 50).
  • Alternative hypothesis HaH_a (or H1H_1): the claim you want to support — can be two-sided (\neq), left-tailed (<<), or right-tailed (>>).

The Logic

Assume H0H_0 is true. Compute how extreme the sample result is if H0H_0 were true — this probability is the p-value. A very small p-value means the data would be highly unlikely under H0H_0, so we reject H0H_0 in favor of HaH_a.

Significance Level α\alpha

α\alpha is the threshold for rejection. The most common choices are α=0.05\alpha = 0.05 (5%) and α=0.01\alpha = 0.01 (1%). If p-value<αp\text{-value} < \alpha, you reject H0H_0.

Type I and Type II Errors

DecisionH0H_0 is trueH0H_0 is false
Reject H0H_0Type I error (false positive), prob. =α= \alphaCorrect (power =1β= 1 - \beta)
Fail to reject H0H_0Correct (prob. =1α= 1 - \alpha)Type II error (false negative), prob. =β= \beta

Common Hypothesis Tests

One-Sample Z-Test (known σ\sigma)

Tests whether the population mean equals a specified value when the population standard deviation σ\sigma is known:

z=xˉμ0σ/nz = \frac{\bar{x} - \mu_0}{\sigma / \sqrt{n}}

Compare zz to a standard normal critical value zz^* (e.g., ±1.96\pm 1.96 for two-sided α=0.05\alpha = 0.05).

One-Sample T-Test (unknown σ\sigma)

The most common test in practice — uses the sample standard deviation ss:

t=xˉμ0s/n,df=n1t = \frac{\bar{x} - \mu_0}{s / \sqrt{n}}, \quad df = n - 1

Compare tt to a t-distribution critical value. For large nn, the t-distribution approaches the standard normal.

Two-Sample T-Test

Tests whether two independent population means are equal:

t=xˉ1xˉ2s12n1+s22n2t = \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{\dfrac{s_1^2}{n_1} + \dfrac{s_2^2}{n_2}}}

Degrees of freedom are estimated with the Welch–Satterthwaite approximation when σ1σ2\sigma_1 \neq \sigma_2 is not assumed.

Z-Test for a Proportion

Tests whether a population proportion equals a specified value p0p_0:

z=p^p0p0(1p0)/nz = \frac{\hat{p} - p_0}{\sqrt{p_0(1 - p_0)/n}}

Valid when np010np_0 \geq 10 and n(1p0)10n(1 - p_0) \geq 10.

Critical Values Quick Reference

Test typeα=0.05\alpha = 0.05α=0.01\alpha = 0.01
Two-sided z±1.96\pm 1.96±2.576\pm 2.576
Right-tailed z1.6451.6452.3262.326
Left-tailed z1.645-1.6452.326-2.326

Step-by-Step Hypothesis Testing Procedure

Follow these five steps for any hypothesis test:

  1. State the hypotheses: Write H0H_0 and HaH_a in terms of the population parameter. Identify the tail direction (two-sided, left, or right).

  2. Choose the test and check conditions: Pick the appropriate test statistic (z or t). Verify sample size conditions (normality, independence).

  3. Compute the test statistic: Plug in the sample values.

  4. Find the p-value: Using the test statistic and the sampling distribution, compute the probability of observing a result at least as extreme as yours under H0H_0. For two-sided tests, double the one-tail area.

  5. State the conclusion: If p-value<αp\text{-value} < \alpha, reject H0H_0 — the data provide statistically significant evidence for HaH_a. Otherwise, fail to reject H0H_0 (this is NOT the same as accepting H0H_0).

Examples

Step 1: Hypotheses: H0:μ=50H_0: \mu = 50, Ha:μ>50H_a: \mu > 50 (right-tailed), α=0.05\alpha = 0.05
Step 2: Test statistic: t=52508/25=21.6=1.25t = \dfrac{52 - 50}{8/\sqrt{25}} = \dfrac{2}{1.6} = 1.25, df=24df = 24
Step 3: Critical value: t24=1.711t^*_{24} = 1.711 (one-tailed, α=0.05\alpha = 0.05)
Step 4: p-value: P(T24>1.25)0.112P(T_{24} > 1.25) \approx 0.112
Step 5: Decision: 0.112>0.050.112 > 0.05 — fail to reject H0H_0
Answer: Fail to reject H0H_0. Insufficient evidence to conclude μ>50\mu > 50 at the 5% significance level (p0.112p \approx 0.112).

Step 1: Conditions: np0=200(0.5)=10010np_0 = 200(0.5) = 100 \geq 10
Step 2: Test statistic: z=0.480.50.50.5/200=0.020.03540.566z = \dfrac{0.48 - 0.5}{\sqrt{0.5 \cdot 0.5 / 200}} = \dfrac{-0.02}{0.0354} \approx -0.566
Step 3: Two-sided p-value: p=2×P(Z<0.566)2(0.2858)=0.572p = 2 \times P(Z < -0.566) \approx 2(0.2858) = 0.572
Step 4: Critical value: ±1.96\pm 1.96; 0.566<1.96|{-0.566}| < 1.96
Step 5: Decision: 0.572>0.050.572 > 0.05 — fail to reject H0H_0
Answer: Fail to reject H0H_0. The data do not provide significant evidence that the true proportion differs from 0.5 (p0.572p \approx 0.572).

Step 1: Hypotheses: H0:μ1=μ2H_0: \mu_1 = \mu_2, Ha:μ1μ2H_a: \mu_1 \neq \mu_2 (two-sided)
Step 2: Standard error: 62/30+72/35=1.2+1.4=2.61.612\sqrt{6^2/30 + 7^2/35} = \sqrt{1.2 + 1.4} = \sqrt{2.6} \approx 1.612
Step 3: Test statistic: t=(7571)/1.6122.481t = (75 - 71)/1.612 \approx 2.481
Step 4: Degrees of freedom (Welch): df62df \approx 62
Step 5: p-value (two-sided): p2×P(T62>2.481)0.016p \approx 2 \times P(T_{62} > 2.481) \approx 0.016
Step 6: Decision: 0.016<0.050.016 < 0.05 — reject H0H_0
Answer: Reject H0H_0. There is significant evidence that the two group means differ (p0.016p \approx 0.016).

Frequently Asked Questions

A result is statistically significant when the p-value is below the chosen significance level α. It means the observed result would be unlikely to occur by chance alone if the null hypothesis were true — it does NOT measure the practical importance or size of the effect.

A two-tailed test checks for differences in either direction (H_a: μ ≠ μ_0) and splits α across both tails. A one-tailed test is directional (H_a: μ > μ_0 or H_a: μ < μ_0) and puts all of α in one tail. Use a one-tailed test only when you have a strong a priori reason to expect a particular direction.

The p-value is the probability of observing a test statistic at least as extreme as the one computed, assuming H_0 is true. A small p-value means the observed data are inconsistent with H_0. It is NOT the probability that H_0 is true.

Use a z-test when the population standard deviation σ is known. Use a t-test (far more common) when σ is unknown and you estimate it with the sample standard deviation s. For large samples (n ≥ 30), the distinction matters less because the t-distribution closely approximates the normal.

Related Solvers

Related Guides

Try AI-Math for Free

Get step-by-step solutions to any math problem. Upload a photo or type your question.

Start Solving