Statistical Test Calculator

Choose the right test for your data, then compute the test statistic, critical value, and decision
One-sample t-test: n = 20, x-bar = 52.4, s = 6.1, H0: mu = 50
One-proportion z-test: 118 successes out of 200, H0: p = 0.5
Two-sample t-test: n1=12, mean1=78.5, s1=5.2 vs n2=15, mean2=74.1, s2=6.0
Which test should I use for paired before-and-after measurements?

Which Test Does Your Data Need?

Choosing the test is the part that gets marked wrong. Work down three questions: what type is the response, how many groups, and are the groups paired?

SituationTestStatistic
One mean, σ\sigma knownone-sample zz-testz=xˉμ0σ/nz = \dfrac{\bar{x} - \mu_0}{\sigma/\sqrt{n}}
One mean, σ\sigma unknownone-sample tt-test, df=n1df = n-1t=xˉμ0s/nt = \dfrac{\bar{x} - \mu_0}{s/\sqrt{n}}
One proportionone-proportion zz-testz=p^p0p0(1p0)/nz = \dfrac{\hat{p} - p_0}{\sqrt{p_0(1-p_0)/n}}
Two independent meanstwo-sample (Welch) tt-testt=xˉ1xˉ2s12/n1+s22/n2t = \dfrac{\bar{x}_1 - \bar{x}_2}{\sqrt{s_1^2/n_1 + s_2^2/n_2}}
Paired measurementspaired tt-test on the differencest=dˉsd/nt = \dfrac{\bar{d}}{s_d/\sqrt{n}}
Counts in categorieschi-square testχ2=(OE)2E\chi^2 = \sum \dfrac{(O-E)^2}{E}

Note the proportion test uses p0p_0, the null value, in the standard error — not p^\hat{p}. That differs from the interval formula, which uses p^\hat{p}.

Running the Test and Reading the Result

The five steps

  1. State H0H_0 and HaH_a, and whether HaH_a is one- or two-sided.
  2. Check conditions (below) and fix α\alpha, usually 0.050.05.
  3. Compute the test statistic from the table above.
  4. Compare it to the critical value, or compare the pp-value to α\alpha.
  5. Conclude in context — "reject H0H_0", never "prove HaH_a".

Critical values you will reuse

Two-sided α\alphazz^*t19t^*_{19}t24t^*_{24}
0.101.6451.7291.711
0.051.962.0932.064
0.012.5762.8612.797

The matching interval

Every two-sided test has a companion interval: estimate ±\pm (critical value) ×\times (standard error). A two-sided test at α\alpha rejects H0H_0 exactly when the (1α)(1-\alpha) interval excludes μ0\mu_0, so the two approaches never disagree. The interval's endpoints are the confidence limits.

Conditions and Common Mistakes

Every test above assumes:

  • Random sampling or random assignment. Without it the sampling distribution is undefined and no pp-value means anything.
  • Independent observations, with n10%n \le 10\% of the population when sampling without replacement. Paired data violate independence between groups on purpose — that is why the paired test analyses the differences.
  • Approximate normality: the population is roughly normal, or n30n \ge 30 so the Central Limit Theorem applies. For a proportion, check np010np_0 \ge 10 and n(1p0)10n(1-p_0) \ge 10. Chi-square needs every expected count 5\ge 5.

Frequent errors

  • Using zz because nn "feels" big while σ\sigma is estimated by ss — the tt-test is the correct choice regardless of nn.
  • Running a two-sample test on paired data, which throws away the pairing and inflates the standard error.
  • Halving or doubling the pp-value in the wrong direction between one- and two-sided tests.
  • Reporting "fail to reject" as "H0H_0 is true". It only means the evidence was insufficient.

Examples

Step 1: σ\sigma is unknown and estimated by ss, so use a one-sample tt-test with df=19df = 19
Step 2: Standard error: s/n=6.1/20=6.1/4.4721=1.3640s/\sqrt{n} = 6.1/\sqrt{20} = 6.1/4.4721 = 1.3640
Step 3: t=(52.450)/1.3640=2.4/1.3640=1.760t = (52.4 - 50)/1.3640 = 2.4/1.3640 = 1.760
Step 4: Critical value: t19=2.093t^*_{19} = 2.093 for a two-sided test at α=0.05\alpha = 0.05
Step 5: 1.760<2.093|1.760| < 2.093, and the two-sided pp-value is about 0.094>0.050.094 > 0.05
Answer: Fail to reject H0H_0: t=1.76t = 1.76, p0.094p \approx 0.094 — not enough evidence that μ50\mu \ne 50

Step 1: p^=118/200=0.59\hat{p} = 118/200 = 0.59; conditions: np0=10010np_0 = 100 \ge 10 and n(1p0)=10010n(1-p_0) = 100 \ge 10
Step 2: Standard error under H0H_0: 0.5×0.5/200=0.00125=0.035355\sqrt{0.5 \times 0.5/200} = \sqrt{0.00125} = 0.035355
Step 3: z=(0.590.50)/0.035355=0.09/0.035355=2.546z = (0.59 - 0.50)/0.035355 = 0.09/0.035355 = 2.546
Step 4: Two-sided p=2(1Φ(2.546))=2(0.00545)=0.0109p = 2\big(1 - \Phi(2.546)\big) = 2(0.00545) = 0.0109
Step 5: 0.0109<0.050.0109 < 0.05, and 2.546>1.96|2.546| > 1.96
Answer: Reject H0H_0: z=2.55z = 2.55, p0.011p \approx 0.011 — the true proportion differs from 0.5

Step 1: Independent groups with unknown, unequal variances \Rightarrow Welch two-sample tt-test
Step 2: s12/n1=27.04/12=2.2533s_1^2/n_1 = 27.04/12 = 2.2533 and s22/n2=36/15=2.4s_2^2/n_2 = 36/15 = 2.4
Step 3: Standard error: 2.2533+2.4=4.6533=2.1572\sqrt{2.2533 + 2.4} = \sqrt{4.6533} = 2.1572
Step 4: t=(78.574.1)/2.1572=4.4/2.1572=2.040t = (78.5 - 74.1)/2.1572 = 4.4/2.1572 = 2.040
Step 5: Welch df=4.653322.25332/11+2.42/14=21.6540.8730=24.8df = \dfrac{4.6533^2}{2.2533^2/11 + 2.4^2/14} = \dfrac{21.654}{0.8730} = 24.8, use df=24df = 24
Step 6: Critical value t24=2.064t^*_{24} = 2.064, and 2.040<2.064|2.040| < 2.064
Answer: Fail to reject H0H_0t=2.04t = 2.04 just misses the cutoff of 2.0642.064 (p0.052p \approx 0.052)

Frequently Asked Questions

It depends on the standard deviation, not the sample size. Use z only when the population σ is genuinely known, which is rare outside textbook problems. Whenever you compute s from the sample, use t with df = n − 1; for large n the two give nearly identical results anyway.

The confidence limits are the two endpoints of a confidence interval — the lower limit and the upper limit. For a mean they are x̄ − t*·s/√n and x̄ + t*·s/√n. The interval is the range between them, so "95% confidence limits" and "95% confidence interval" describe the same result.

Not for a two-sided test built from the same standard error. A test at level α rejects H₀ precisely when the (1 − α) interval excludes the null value, so they are two views of one calculation. Disagreement usually signals a mismatch — a one-sided test, or a proportion test that uses p₀ in the standard error while the interval uses p̂.

A paired t-test. Compute the difference for each subject, then run a one-sample t-test on those differences against a null of zero, with df = n − 1. Treating the two columns as independent samples discards the pairing and usually inflates the standard error enough to hide a real effect.

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