Hypothesis Test Calculator

Z & t tests ยท proportions ยท p-value ยท distribution plot

Null hypothesis value

Result

๐Ÿงช

Enter parameters and click Perform Test

Run hypothesis tests for means, proportions, or group comparisons.

Distribution Visualization

Python Compiler

What Is Hypothesis Testing?

Hypothesis testing is a statistical procedure used to determine whether sample data provides sufficient evidence to reject a claim (the null hypothesis) about a population parameter. It is fundamental to scientific research, quality control, and data-driven decision making.

1. State Hโ‚€ & Hโ‚ 2. Choose ฮฑ level 3. Compute Test stat 4. Find p-value 5. Decide Reject?
๐Ÿ“

State Hypotheses

Define Hโ‚€ (null โ€” no effect) and Hโ‚ (alternative โ€” the claim you want to test). Hโ‚€ always contains the equality.

๐Ÿ“Š

Calculate Evidence

Compute a test statistic that measures how far the sample result is from the null hypothesis value in standard-error units.

โš–๏ธ

Make Decision

Compare the p-value to ฮฑ. If p โ‰ค ฮฑ, reject Hโ‚€. Otherwise, fail to reject Hโ‚€. Never โ€œacceptโ€ Hโ‚€.

Test Formulas

Z-test for mean (ฯƒ known):  z = (xฬ„ โˆ’ ฮผโ‚€) / (ฯƒ / โˆšn)
Use when the population standard deviation is known or n is very large.
T-test for mean (ฯƒ unknown):  t = (xฬ„ โˆ’ ฮผโ‚€) / (s / โˆšn),  df = n โˆ’ 1
Use when the population SD is unknown. Uses sample SD s with t-distribution.
One-proportion Z-test:  z = (pฬ‚ โˆ’ pโ‚€) / โˆš(pโ‚€(1โˆ’pโ‚€) / n)
Tests a sample proportion against a claimed population proportion.
Two-proportion Z-test:  z = (pฬ‚โ‚ โˆ’ pฬ‚โ‚‚) / โˆš(pฬ‚(1โˆ’pฬ‚)(1/nโ‚ + 1/nโ‚‚))
Pooled pฬ‚ = (xโ‚ + xโ‚‚) / (nโ‚ + nโ‚‚). Tests if two population proportions are equal.

Decision Making

If p-value โ‰ค ฮฑ

Reject Hโ‚€. The result is statistically significant. There is sufficient evidence to support Hโ‚.

If p-value > ฮฑ

Fail to reject Hโ‚€. The result is not statistically significant. Insufficient evidence to support Hโ‚.

Common Significance Levels

ฮฑConfidencez* (two-tailed)Use Case
0.1090%ยฑ1.645Exploratory analysis, social science
0.0595%ยฑ1.960Standard for most research
0.0199%ยฑ2.576High-stakes, medical trials

Type I and Type II Errors

โŒ Type I Error (ฮฑ)

False positive. Rejecting Hโ‚€ when it is actually true. The probability is controlled by ฮฑ (significance level).

Example: Concluding a drug works when it does not.

โš ๏ธ Type II Error (ฮฒ)

False negative. Failing to reject Hโ‚€ when it is actually false. Related to sample size and effect size.

Example: Missing a real drug effect due to small sample.

โœ… Correct: Reject true Hโ‚

Hโ‚€ is false and we correctly reject it. This is the desired outcome of a well-powered test.

โœ… Correct: Fail to reject true Hโ‚€

Hโ‚€ is true and we correctly fail to reject it. No false alarm.

Statistical Power = 1 โˆ’ ฮฒ โ€” the probability of correctly rejecting a false Hโ‚€. Increase power by increasing sample size, using a larger ฮฑ, or when the true effect size is large.

When to Use Each Test

TestData TypeWhen to Use
Z-test (mean)Continuousฯƒ is known, or n > 30 with known population SD
T-test (mean)Continuousฯƒ is unknown (use sample s). Works for any n with normal population
One-proportion ZCategoricalCompare sample proportion to a claimed value. Need npโ‚€ โ‰ฅ 5 and n(1โˆ’pโ‚€) โ‰ฅ 5
Two-proportion ZCategoricalCompare proportions from two independent groups. Uses pooled proportion under Hโ‚€

Tip: In practice, the population ฯƒ is almost never known, so the T-test is the most commonly used test for means. The Z-test is primarily used for proportions and in textbook problems.

Frequently Asked Questions

Use the Z-test when the population standard deviation (ฯƒ) is known or the sample size is very large. Use the T-test when ฯƒ is unknown and you rely on the sample standard deviation (s). The T-distribution has heavier tails, especially for small samples, giving more conservative results.
Choose a one-tailed test if you predict a specific direction (e.g., the new treatment is better). Choose a two-tailed test if you are testing for any difference in either direction. This decision must be made before collecting data to avoid bias.
Rejecting Hโ‚€ means the data provides sufficient evidence that the null hypothesis is unlikely. It does not prove Hโ‚ is true. It means that if Hโ‚€ were true, the probability of seeing results this extreme is less than ฮฑ.
Type I error (ฮฑ) is rejecting Hโ‚€ when it is actually true (false positive). Type II error (ฮฒ) is failing to reject Hโ‚€ when it is actually false (false negative). Alpha is controlled by the significance level you choose.
Use a proportion test when your data is categorical (yes/no, pass/fail). A one-proportion test compares a sample proportion to a claimed value. A two-proportion test compares proportions from two independent groups, such as treatment vs. control conversion rates.
Z-test assumes known ฯƒ and a normal population (or large n). T-test assumes a normal population (or large n). Proportion tests need npโ‚€ and n(1โˆ’pโ‚€) both at least 5. All tests assume random, independent samples.

Support This Free Tool

Every coffee helps keep the servers running. Every book sale funds the next tool I'm dreaming up. You're not just supporting a site โ€” you're helping me build what developers actually need.

500K+ users
200+ tools
100% private
Privacy Guarantee: Private keys you enter or generate are never stored on our servers. All tools are served over HTTPS.