Hypothesis Testing: Steps p-Values and Examples

#Hypothesis Testing
TL;DR
Hypothesis testing uses sample data to decide whether evidence against a claim about a population is strong enough. This guide covers the five steps, p-values, tails, errors, and six examples.
Madhukar V·reviewed by
PK
Prabhjot KaurLast updated on November 26, 20269 min read

Key Points

  • Hypothesis testing starts from a null hypothesis, H₀, that there is no effect, and asks whether the data give strong evidence against it.
  • The p-value is the probability of results at least as extreme as those observed, assuming H₀ is true.
  • If the p-value is at most the significance level α, usually 0.05, H₀ is rejected; otherwise it is not rejected.
  • A test can be one-tailed or two-tailed, depending on whether the alternative hypothesis specifies a direction.
  • Rejecting a true H₀ is a Type I error, and failing to reject a false H₀ is a Type II error.

Is the Difference Real or Just Chance?

A cereal company claims 500 g per box, and a sample averaging 497 g raises a question.

Is the 3 g gap a sign that boxes are underfilled, or the ordinary variation of a small sample? Hypothesis testing answers questions like this with a clear rule, and it is the main tool of inferential statistics.

the steps of hypothesis testing.
Five numbered steps of a hypothesis test: state the null hypothesis and the alternative, choose the significance level, often 0.05, collect data and compute the test statistic, find the p-value or compare with the critical value, and decide whether to reject the null hypothesis.

What Is Hypothesis Testing?

Hypothesis testing is a method for judging a claim about a population using a sample. It has two competing statements.

The null hypothesis, H0H_0, says there is no effect or no difference, such as μ=500\mu = 500. The alternative, H1H_1, says there is, such as μ≠500\mu \ne 500. The test assumes H0H_0 and asks how surprising the data would be if it were true.

Try It Yourself

Use the hypothesis test explorer to see Hypothesis Testing at work: drag, change the numbers and watch what happens.

What Is a p-Value?

The p-value is the probability, assuming H0H_0 is true, of getting a result at least as extreme as the one observed.

the p-value in hypothesis testing.
Standard normal curve for a right-tailed test with the area beyond the observed z of 2.1 shaded as the p-value, about 0.018, and a dashed line at the critical value 1.645.

A small p-value means the data would be unusual under H0H_0. If p≤αp \le \alpha, the result is called statistically significant and H0H_0 is rejected. A large p-value means the data are consistent with H0H_0, so it is not rejected.

What Are One-Tailed and Two-Tailed Tests?

The alternative hypothesis decides where the evidence is looked for.

one-tailed and two-tailed hypothesis testing.
Three normal curves showing rejection regions at alpha equal to 0.05: a left-tailed test shades the area below minus 1.645 for H1 mu less than mu0; a two-tailed test shades both tails beyond plus and minus 1.96 for H1 mu not equal to mu0; a right-tailed test shades the area above 1.645 for H1 mu greater than mu0.

If H1H_1 says "different", the test is two-tailed and the significance level is split between both tails. If H1H_1 says "greater" or "less", the test is one-tailed. The direction must be chosen before looking at the data.

What Errors Can a Hypothesis Test Make?

Two kinds.

Type I and Type II errors in hypothesis testing.
Two-by-two table of decisions against the truth: rejecting a true null hypothesis is a Type I error with probability alpha; failing to reject a false null hypothesis is a Type II error with probability beta; the other two combinations are correct decisions.

A Type I error rejects a true H0H_0; its probability is α\alpha. A Type II error fails to reject a false H0H_0. Lowering α\alpha reduces Type I errors but makes Type II errors more likely, unless the sample size grows.

Examples of Hypothesis Testing

Example 1

Boxes are claimed to hold 500 g, with σ=6\sigma = 6 g. A sample of 16 averages 497 g. Test H0:μ=500H_0: \mu = 500 against H1:μ≠500H_1: \mu \ne 500 at α=0.05\alpha = 0.05.

Standard error 616=1.5\frac{6}{\sqrt{16}} = 1.5, so z=497−5001.5=−2z = \frac{497 - 500}{1.5} = -2. The two-tailed p-value is 2×P(Z<−2)≈0.0462 \times P(Z < -2) \approx 0.046. Since 0.046≤0.050.046 \le 0.05, reject H0H_0: the evidence suggests the mean differs from 500 g.

Example 2

A test gives p=0.30p = 0.30. A student concludes that H0H_0 is true. Is that right?

A large p-value seems to confirm the null hypothesis.

It does not prove it. A p-value of 0.30 means the data are not unusual if H0H_0 is true, so there is not enough evidence against it. The correct conclusion is "fail to reject H0H_0". The effect might exist but be too small for this sample to detect.

Example 3

In Example 1, would the decision change at α=0.01\alpha = 0.01?

Yes. 0.046>0.010.046 > 0.01, so H0H_0 would not be rejected at the stricter level.

Example 4

A right-tailed test gives z=2.1z = 2.1. Find the p-value and decide at α=0.05\alpha = 0.05.

p=P(Z≥2.1)≈0.018p = P(Z \ge 2.1) \approx 0.018. Since 0.018≤0.050.018 \le 0.05, reject H0H_0.

Example 5

A drug trial tests whether a drug lowers blood pressure. Write H0H_0 and H1H_1.

With μd\mu_d the mean change, H0:μd=0H_0: \mu_d = 0 and H1:μd<0H_1: \mu_d < 0, a left-tailed test.

Example 6

In a test with α=0.05\alpha = 0.05 and H0H_0 true, how often will the test wrongly reject H0H_0 in the long run?

About 5 percent of the time. That is what the significance level means.

Why Hypothesis Testing Matters

It turns "is this difference real?" into a decision with a known error rate.

  • It controls false alarms. The significance level fixes how often a true H0H_0 is wrongly rejected.
  • It is used everywhere. Medicine, manufacturing, psychology and economics all rely on it.
  • It separates signal from noise. Small samples vary, and the test asks whether a result goes beyond that variation.
  • It makes reasoning transparent. Stating H0H_0, α\alpha and the test in advance lets others check the logic.

The NIST/SEMATECH What are statistical tests? page describes testing in the same structure: a null hypothesis, an alternative, a test statistic and a critical region chosen to control the risk of a Type I error.

What Most Guides Get Wrong About Hypothesis Testing

Two misunderstandings are common.

The first is the meaning of the p-value. It is often described as "the probability that H0H_0 is true", which it is not. It is the probability of data this extreme if H0H_0 were true. The two can differ enormously, as Bayes' theorem shows.

The second is "accepting" the null hypothesis. Example 2 shows why a test only ever fails to reject. Absence of evidence against H0H_0 is not evidence for it, especially with small samples.

Where Students Trip Up on Hypothesis Testing

Mistake 1: Accepting H₀

Where it slips in: Conclusions with large p-values, as in Example 2.

Don't do this: Writing "H0H_0 is true" or "accept H0H_0".

The correct way: Write "fail to reject H0H_0; there is not enough evidence for H1H_1".

Students write "accept" because the test seems to have two outcomes, reject and its opposite, and accept sounds like the natural opposite.

Mistake 2: Choosing the tail after seeing the data

Where it slips in: One-tailed tests.

Don't do this: Switching to a one-tailed test because the two-tailed p-value was just above 0.05.

The correct way: Choose the alternative hypothesis, and so the tails, before collecting data.

Mistake 3: Confusing significance with importance

Where it slips in: Large samples.

Don't do this: Treating a tiny but significant difference as a big effect.

The correct way: Report the size of the difference alongside the p-value.

The cost of the third mistake shows up in published research. With very large samples, even trivial differences become statistically significant, which is why many journals now ask authors to report effect sizes and confidence intervals, not only p-values.

The Short Version

  • Hypothesis testing judges a claim about a population using a sample.
  • It assumes H0H_0 and rejects it only if the p-value is at most α\alpha.
  • Tails follow from the alternative hypothesis, chosen in advance.
  • Tests can make Type I and Type II errors, and a large p-value never proves H0H_0.
  • To work through statistics with a teacher, explore Bhanzu's high school math tutor sessions or online math tutoring.

A Practical Next Step

Toss a coin 50 times and test whether it is fair, with H0:p=0.5H_0: p = 0.5. Use the standard error 0.25/50≈0.071\sqrt{0.25/50} \approx 0.071, compute zz for your proportion of heads, and find the two-tailed p-value. Then decide whether you have evidence that the coin is biased.

Practice these to solidify your understanding. If a large p-value still looks like proof, return to Example 2. Want a live Bhanzu trainer to walk through more statistics problems? Book a free demo class, online globally, or in person at our McKinney, TX center.

Read More

Research Behind This Article

  1. OpenStax, Introductory Statistics 2e, 9.1 Null and Alternative Hypotheses (2023). openstax.org
  2. OpenStax, Introductory Statistics 2e, 9.2 Outcomes and the Type I and Type II Errors (2023). openstax.org
  3. OpenStax, Introductory Statistics 2e, 9.4 Rare Events, the Sample, and the Decision and Conclusion (2023). openstax.org
  4. NIST/SEMATECH, e-Handbook of Statistical Methods, 7.1.3.1 Critical values and p values (2022). itl.nist.gov
  5. OpenStax, Introductory Statistics 2e, 9.6 Hypothesis Testing of a Single Mean and Single Proportion (2023). openstax.org

Quick Quiz: Check Yourself

Three levels, fresh numbers every time, instant feedback with the working.

Was this article helpful?

Your feedback helps us write better content

Frequently Asked Questions

What is hypothesis testing?
A method of using sample data to decide whether there is enough evidence against a null hypothesis about a population.
What are the steps of hypothesis testing?
State H0H_0 and H1H_1, choose α\alpha, compute the test statistic, find the p-value or critical value, and decide.
What is a p-value in hypothesis testing?
The probability, assuming H0H_0 is true, of a result at least as extreme as the one observed.
What is the difference between one-tailed and two-tailed tests?
A one-tailed test looks for an effect in one direction. A two-tailed test looks for a difference in either direction.
What are Type I and Type II errors?
A Type I error rejects a true H0H_0. A Type II error fails to reject a false H0H_0.
✍️ Written By
Madhukar V
Madhukar V
Math Columnist & Analyst
I see mathematics as more than just numbers and formulas—it is a way of thinking, questioning, and understanding the world around us. I work at the intersection of mathematics, EdTech, technology, and AI-powered learning, I enjoy exploring how mathematical ideas can be made simple, meaningful, and relatable. Through my articles, I aim to present mathematics with curiosity and a practical perspective, helping readers see the beauty and relevance behind every concept in a Bhanzu way.
LinkedIn
🔬 Reviewed By
PK
Subject Matter Expert & Curriculum Developer
Book a FREE Demo ClassBook Now →