College Statistics • Hypothesis Testing

z-Test for a Proportion — Hypothesis Test for a Proportion (z-test)

A principled framework for deciding whether sample evidence contradicts a claimed population proportion.

College Statistics subject emblem with a scatter plot, summation notation, and frequency columns.
Inside this lesson 10 sections 5 questions 8 figures

SECTION 1

Historical Context & Motivation

Long before modern statistics formalized the machinery of hypothesis testing, scientists and philosophers grappled with a fundamental epistemological question: how much evidence is required before we should abandon a prior belief? The z-test for a proportion descends directly from this intellectual tradition, giving us a rigorous procedure to evaluate whether an observed sample proportion is consistent with a hypothesized population proportion, or whether the discrepancy is too large to attribute to random sampling variability alone. The development of this test was not the work of a single mind but rather the convergence of probability theory, the normal approximation to the binomial, and the formalization of hypothesis testing in the early twentieth century.

1733 • De Moivre's Normal Approximation

Abraham de Moivre demonstrated that the binomial distribution could be approximated by a continuous bell-shaped curve — the normal distribution — laying the mathematical foundation for using z-scores to evaluate proportions drawn from large samples.

1812 • Laplace's Central Limit Theorem

Pierre-Simon Laplace proved the first general version of the central limit theorem, establishing that the sum (and therefore the mean or proportion) of a large number of independent random variables tends toward a normal distribution regardless of the underlying population shape.

1925 • Fisher Formalizes Significance Testing

Ronald A. Fisher introduced the concept of the p-value and formalized significance testing in his landmark work, providing a systematic framework for measuring evidence against a null hypothesis.

1933 • Neyman–Pearson Framework

Jerzy Neyman and Egon Pearson introduced the concepts of null and alternative hypotheses, Type I and Type II errors, and power — creating the decision-theoretic framework that underpins the modern z-test procedure taught in introductory statistics courses.

These developments converge in a practical question that arises constantly in research, quality control, and policy analysis: a manufacturer claims that 5% of its products are defective, a politician asserts that 60% of voters support a new law, or a pharmaceutical company reports a 30% side-effect rate. In each case, we collect a sample, observe a proportion, and must decide — with quantifiable confidence — whether the data contradict the claim. The z-test for a proportion is the standard tool for making that decision.

SECTION 2

Core Principles & Definitions

Before executing a z-test for a proportion, you need to understand several interconnected concepts that govern its logic, validity, and interpretation. The test rests on a simple but powerful idea: if the null hypothesis is true, we know how much the sample proportion should vary from sample to sample, and we can measure how extreme our particular observation is relative to that expected variability.

1

Null Hypothesis (H₀)

A statement asserting that the population proportion p equals a specific claimed value p0. This is the "status quo" assumption that we attempt to disprove with evidence.
2

Alternative Hypothesis (H₁ or Hₐ)

The competing claim — that the true proportion differs from p0. It may be two-tailed (p ≠ p₀), left-tailed (p < p₀), or right-tailed (p > p₀), depending on the research question.
3

Test Statistic (z)

A standardized measure of how many standard errors the observed sample proportion p̂ lies from the hypothesized value p₀. Larger absolute values of z indicate stronger evidence against H₀.
4

p-Value

The probability of observing a test statistic at least as extreme as the one computed, assuming H₀ is true. A small p-value (typically < α) indicates that such an extreme result would be unlikely under H₀, leading us to reject it.
5

Significance Level (α)

The pre-set threshold for rejecting H₀, representing the maximum tolerable probability of a Type I error (rejecting a true null). Common choices are α = 0.05, 0.01, and 0.10.
✦

KEY TAKEAWAY

Think of the z-test like a courtroom trial. The null hypothesis is the presumption of innocence — we start by assuming the claimed proportion is correct. The sample data is the evidence presented by the prosecution. The z-statistic quantifies how damning that evidence is, and the p-value tells the jury how likely it would be to see such evidence if the defendant were truly innocent. Only when the evidence is sufficiently compelling (p-value < α) do we reject the null — that is, deliver a "guilty" verdict. Just as the legal system is designed to avoid convicting the innocent (Type I error), hypothesis testing is calibrated to avoid rejecting a true null hypothesis.

SECTION 3

Visual Explanation — The Sampling Distribution Under H₀

The conceptual heart of the z-test for a proportion lies in the sampling distribution of p̂ under the null hypothesis. When we assume H₀: p = p₀ is true and draw a random sample of size n, the sample proportion p̂ follows an approximately normal distribution centered at p₀ with a standard error of √(p₀(1 − p₀)/n). The z-test statistic simply measures where our observed p̂ falls on this distribution, expressed in standard-error units. The following diagram illustrates a two-tailed test scenario.

Sampling Distribution of p̂ Under H₀ (Two-Tailed Test)z-scoreDensity0(p₀)−zα/2+zα/2Reject H₀(α/2)Reject H₀(α/2)Fail to Reject H₀(1 − α)z_obsObservedtest statistic
The bell curve represents the sampling distribution of p̂ assuming H₀ is true, centered at p₀ (z = 0). The red shaded regions in both tails represent the rejection regions, each containing α/2 of the total area. The gold marker shows a hypothetical observed z-statistic (z_obs). If z_obs falls in a rejection region, we reject H₀.

Notice that the diagram partitions the horizontal axis into three decision zones. The central, unshaded region corresponds to z-values for which the observed sample proportion is "close enough" to p₀ that we cannot distinguish sampling noise from a genuine departure — in such cases we fail to reject H₀. The two tail regions capture extreme outcomes — values of p̂ so far from p₀ that they would occur with probability less than α under the null, prompting us to reject H₀. For a one-tailed test, the entire α area would be concentrated in a single tail.

SECTION 4

Mathematical Framework

The z-test for a proportion exploits the normal approximation to the binomial distribution. When the sample size is sufficiently large, the sampling distribution of the sample proportion p̂ is approximately normal. The test statistic standardizes the distance between p̂ and the hypothesized proportion p₀, dividing by the standard error computed under the null hypothesis.

Hypotheses

NULL AND ALTERNATIVE HYPOTHESES

H0:p=p0versusHa:p≠p0(two−tailed)Ha:p<p0(left−tailed)Ha:p>p0(right−tailed)H₀: p = p₀ versus Hₐ: p ≠ p₀ (two-tailed) Hₐ: p < p₀ (left-tailed) Hₐ: p > p₀ (right-tailed)

Here p is the true (unknown) population proportion, and p0 is the claimed value specified in the null hypothesis.

SAMPLE PROPORTION

p^=x/np̂ = x / n

where x = number of successes in the sample, and n = sample size.

TEST STATISTIC

z=(p^−p0)/√(p0(1−p0)/n)z = (p̂ − p₀) / √(p₀(1 − p₀) / n)

The numerator measures the discrepancy between the observed and hypothesized proportions. The denominator is the standard error of p̂ under H₀, quantifying the expected sampling variability. The ratio tells us how many standard errors p̂ lies from p₀.

Conditions for Validity

  • ✓ Random sampling: The data must come from a simple random sample (or a process that can be modeled as random).
  • ✓ Independence: Individual observations must be independent. When sampling without replacement, the sample should be no more than 10% of the population (the 10% condition).
  • ✓ Success–failure condition: np₀ ≥ 10 and n(1 − p₀) ≥ 10. This ensures the normal approximation to the binomial is adequate.

P-VALUE COMPUTATION

Two−tailed:p−value=2×P(Z>∣zobs∣)Left−tailed:p−value=P(Z<zobs)Right−tailed:p−value=P(Z>zobs)Two-tailed: p-value = 2 × P(Z > |z_obs|) Left-tailed: p-value = P(Z < z_obs) Right-tailed: p-value = P(Z > z_obs)

where Z denotes a standard normal random variable and zobs is the computed test statistic. Compare the p-value to the significance level α to make the decision: reject H₀ if p-value < α.

SECTION 5

Step-by-Step Testing Procedure

Executing a z-test for a proportion follows a structured sequence that ensures logical rigor and reproducibility. The procedure below breaks the test into discrete, auditable steps — a discipline that prevents common errors such as choosing the alternative hypothesis after seeing the data or computing the standard error with p̂ instead of p₀.

z-Test for a Proportion — Decision Flowchart1. State H₀ and Hₐ2. Choose α (e.g., 0.05)3. Verify conditions (np₀ ≥ 10, etc.)4. Compute z = (p̂ − p₀) / SE5. Find the p-valuep-value < α → Reject H₀p-value ≥ α → Fail to RejectSufficient evidence against H₀Insufficient evidence against H₀6. State conclusion in context of the problem
The flowchart traces the six canonical steps of a z-test for a proportion — from formulating hypotheses through making a contextual conclusion. Note the branching at Step 5: the comparison between the p-value and α determines the outcome.
⚠

Common Pitfall

When computing the standard error for a hypothesis test, always use the null hypothesis value p₀ — not the sample proportion p̂. This is because the test asks "assuming H₀ is true, how unusual is our observation?" Using p̂ in the denominator is appropriate for confidence intervals, but it invalidates the hypothesis test's logic.

SECTION 6

Worked Example

A university administrator claims that 40% of students at a large public university use the campus library at least once per week. A student researcher suspects that the true proportion is lower. She surveys a random sample of 250 students and finds that 85 report using the library at least once per week. At the α = 0.05 significance level, is there sufficient evidence to conclude that the proportion is less than 40%?

Hypothesis Test: Library Usage Proportion

  1. 1

    Step 1 — State the Hypotheses

    The administrator's claim provides the null hypothesis value. Because the researcher suspects the proportion is lower than claimed, this is a left-tailed test.
    H₀: p = 0.40 Hₐ: p < 0.40 α = 0.05
  2. 2

    Step 2 — Verify Conditions

    Random sample: stated as random. Independence: 250 is certainly less than 10% of a large university's enrollment. Success–failure: np₀ = 250 × 0.40 = 100 ≥ 10 and n(1 − p₀) = 250 × 0.60 = 150 ≥ 10. All conditions are satisfied.
    All three conditions met ✓
  3. 3

    Step 3 — Compute the Sample Proportion

    The sample proportion is p̂ = x / n = 85 / 250.
    p̂ = 0.34
  4. 4

    Step 4 — Compute the Standard Error and z-Statistic

    SE = √(p₀(1 − p₀) / n) = √(0.40 × 0.60 / 250) = √(0.24 / 250) = √(0.00096) ≈ 0.03098. Then z = (p̂ − p₀) / SE = (0.34 − 0.40) / 0.03098 = (−0.06) / 0.03098 ≈ −1.937.
    z ≈ −1.937
  5. 5

    Step 5 — Find the p-Value

    Because this is a left-tailed test, the p-value is P(Z < −1.937). Using a standard normal table or software, P(Z < −1.937) ≈ 0.0264.
    p-value ≈ 0.0264
  6. 6

    Step 6 — Make a Decision and State the Conclusion

    Since the p-value (0.0264) is less than α (0.05), we reject H₀. There is statistically significant evidence at the 5% level to conclude that fewer than 40% of students at this university use the campus library at least once per week.
    Reject H₀. Evidence supports p < 0.40.

SECTION 7

Strengths, Limitations & Common Misconceptions

StrengthsLimitations
Computationally straightforward — requires only basic arithmetic and a z-table or software.Relies on the normal approximation, which fails when np₀ or n(1 − p₀) is below 10. In such cases, an exact binomial test is preferred.
Well-understood theoretical properties — Type I error rate is controlled at exactly α when conditions are met.A statistically significant result does not imply practical significance. A very large sample can detect trivially small differences from p₀.
Naturally extends to confidence intervals — the same standard error formula underlies both the test and the CI.Assumes simple random sampling; results are unreliable with convenience, cluster, or stratified samples without design-based corrections.
Directly interpretable — the z-statistic has a clear meaning as a number of standard errors from the null value.Failing to reject H₀ is not evidence that p = p₀; it only means there is insufficient evidence to rule out p₀. Absence of evidence ≠ evidence of absence.

Strengths and limitations of the z-test for a proportion

⚠

MISCONCEPTION ALERT

Students frequently misinterpret the p-value as "the probability that H₀ is true." This is incorrect. The p-value is the probability of obtaining a test statistic as extreme as the observed one given that H₀ is true. It is a measure of the compatibility of the data with the null hypothesis — not a posterior probability of the hypothesis itself. To compute P(H₀ is true | data), you would need Bayesian methods and a prior distribution on p.

SECTION 8

Connection to Advanced Theory

The one-sample z-test for a proportion is the entry point into a family of proportion-based inference methods. Understanding its structure prepares you for more complex settings — comparing two proportions, testing associations in contingency tables, and eventually logistic regression. The table below highlights how this foundational test relates to its generalizations.

FeatureOne-Sample z-Test (This Lesson)Two-Sample z-Test for ProportionsChi-Square Goodness-of-Fit
PurposeTest whether a single population proportion equals a specified value p₀.Test whether two independent populations have the same proportion (p₁ = p₂).Test whether an entire categorical distribution matches a hypothesized distribution.
# of Groups121 or more (k categories)
Test Statisticz (standard normal)z (standard normal)χ² (chi-square with k − 1 df)
RelationshipFoundational caseExtension to comparative studies; uses pooled proportion for SEGeneralizes to k > 2 categories; for k = 2, z² = χ²

How the one-sample z-test for a proportion relates to more advanced tests

An elegant connection worth noting: when you have a binary categorical variable (only two outcomes) and apply a chi-square goodness-of-fit test with 1 degree of freedom, the chi-square statistic is exactly the square of the z-statistic from a two-tailed z-test for a proportion (χ² = z²). This duality underscores the fact that these are not unrelated procedures but members of a unified inferential family. As you progress to courses in generalized linear models, you will see proportions modeled via logistic regression, where the z-test for individual regression coefficients is structurally identical to the test introduced here, extended to a multivariate setting.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

A researcher conducts a z-test for a proportion and obtains a p-value of 0.08 using a significance level of α = 0.05. She concludes: "The null hypothesis is true." Explain why this conclusion is incorrect and state what the proper conclusion should be.
Show answer
Failing to reject H₀ does not prove that H₀ is true. A p-value of 0.08 means that if the null hypothesis were true, there is about an 8% probability of observing a result as extreme as the one obtained. Because 0.08 > 0.05, the data do not provide sufficient evidence to reject H₀ at the 5% significance level. The correct conclusion is: "At α = 0.05, there is insufficient evidence to reject the null hypothesis." This is a statement about the evidence, not a definitive claim about the truth of H₀. A Type II error (failing to detect a false null) remains possible, especially if the sample size is small or the true proportion is close to p₀.

Question 2: BASIC CALCULATION

A company claims that 70% of its customers are satisfied with their service. A random sample of 200 customers finds that 126 are satisfied. Compute the z-test statistic for a two-tailed test of H₀: p = 0.70.
Show answer
First compute the sample proportion: p̂ = 126/200 = 0.63. Then compute the standard error under H₀: SE = √(0.70 × 0.30 / 200) = √(0.21/200) = √0.00105 ≈ 0.03240. The z-statistic is z = (0.63 − 0.70) / 0.03240 = (−0.07) / 0.03240 ≈ −2.160. This value indicates that the sample proportion is about 2.16 standard errors below the hypothesized proportion, suggesting a statistically meaningful departure from p₀ = 0.70. The corresponding two-tailed p-value is 2 × P(Z > 2.16) ≈ 2 × 0.0154 = 0.0308, which would lead to rejection of H₀ at α = 0.05.

Question 3: INTERMEDIATE

A health official claims that at most 15% of adults in a city are unvaccinated against influenza. A random sample of 500 adults reveals that 95 are unvaccinated. Conduct a complete hypothesis test at the α = 0.01 level. State hypotheses, verify conditions, compute the test statistic and p-value, and write a conclusion in context.
Show answer
Hypotheses: H₀: p = 0.15, Hₐ: p > 0.15 (right-tailed, since we want to test whether the unvaccinated rate exceeds 15%). Conditions: np₀ = 500 × 0.15 = 75 ≥ 10 ✓, n(1 − p₀) = 500 × 0.85 = 425 ≥ 10 ✓, random sample stated, 500 < 10% of a city's adult population ✓. Sample proportion: p̂ = 95/500 = 0.19. Standard error: SE = √(0.15 × 0.85 / 500) = √(0.1275/500) = √0.000255 ≈ 0.01597. Test statistic: z = (0.19 − 0.15) / 0.01597 = 0.04 / 0.01597 ≈ 2.505. P-value (right-tailed): P(Z > 2.505) ≈ 0.0061. Since 0.0061 < 0.01, we reject H₀. At the 1% significance level, there is sufficient evidence to conclude that more than 15% of adults in this city are unvaccinated against influenza.

Question 4: APPLIED

A quality assurance engineer at a semiconductor factory monitors the defect rate. Historical data indicate a 3% defect rate (p₀ = 0.03). After a machine recalibration, the engineer inspects a random sample of 800 chips and finds 32 defective ones. At α = 0.05, should the engineer conclude that the defect rate has changed? Additionally, determine the minimum number of defective chips (out of 800) that would lead to rejection of H₀ in a two-tailed test.
Show answer
Hypotheses: H₀: p = 0.03, Hₐ: p ≠ 0.03 (two-tailed). Conditions: np₀ = 800 × 0.03 = 24 ≥ 10 ✓, n(1 − p₀) = 800 × 0.97 = 776 ≥ 10 ✓. Sample proportion: p̂ = 32/800 = 0.04. SE = √(0.03 × 0.97 / 800) = √(0.0291/800) = √0.000036375 ≈ 0.006031. z = (0.04 − 0.03) / 0.006031 ≈ 1.658. Two-tailed p-value: 2 × P(Z > 1.658) ≈ 2 × 0.0487 = 0.0974. Since 0.0974 > 0.05, we fail to reject H₀. There is insufficient evidence that the defect rate has changed. For the second part, the critical z-value is ±1.96. Setting (p̂ − 0.03)/0.006031 = 1.96 gives p̂ = 0.03 + 1.96 × 0.006031 = 0.04182, so x = 0.04182 × 800 ≈ 33.46. Rounding up, at least 34 defective chips (or equivalently, 12 or fewer for the lower tail: p̂ = 0.03 − 0.01182 = 0.01818, x = 14.54, so ≤ 14) would be needed to reject H₀.

Question 5: CRITICAL THINKING

Suppose you test H₀: p = 0.50 versus Hₐ: p ≠ 0.50 and the true population proportion is p = 0.52. (a) Explain qualitatively how the power of the test changes as the sample size n increases from 100 to 10,000. (b) If n = 10,000 and you obtain p̂ = 0.52, compute the z-statistic and p-value. (c) Discuss whether statistical significance in this scenario implies practical significance, and suggest what additional analysis you would perform.
Show answer
(a) As n increases, the standard error SE = √(p₀(1 − p₀)/n) shrinks, so even small departures from p₀ produce large z-statistics. The power of the test — the probability of correctly rejecting H₀ when p = 0.52 — increases toward 1 as n grows. At n = 100, the difference of 0.02 is well within sampling noise; at n = 10,000, it becomes highly detectable. (b) SE = √(0.50 × 0.50 / 10000) = √(0.000025) = 0.005. z = (0.52 − 0.50)/0.005 = 4.00. The two-tailed p-value is 2 × P(Z > 4.00) ≈ 2 × 0.0000317 ≈ 0.0000634, which is extremely small. We would reject H₀ with overwhelming statistical significance. (c) However, a population proportion of 0.52 versus 0.50 is a practically negligible difference of 2 percentage points. Statistical significance here is driven entirely by the enormous sample size, not by a meaningful departure. One should supplement the test with a confidence interval — here approximately (0.52 ± 1.96 × 0.005) = (0.510, 0.530) — and assess whether this range represents a difference that matters in context. An effect size measure and a discussion of practical implications should always accompany large-sample tests.

SUMMARY

Lesson Summary

Summary

The z-test for a proportion provides a rigorous method for deciding whether an observed sample proportion (p̂) is consistent with a hypothesized population proportion (p₀). Built on the normal approximation to the binomial, the test converts the gap between p̂ and p₀ into a z-statistic by dividing by the standard error under H₀. The resulting p-value is then compared to the pre-set significance level (α) to make a reject-or-fail-to-reject decision.

Before applying the test, always verify the conditions: random sampling, independence (10% rule), and the success–failure criterion (np₀ ≥ 10 and n(1 − p₀) ≥ 10). Remember that failing to reject H₀ is not proof that H₀ is true, and that statistical significance does not automatically imply practical significance. This foundational test extends naturally to two-sample proportion tests, chi-square tests, and ultimately logistic regression in more advanced coursework.

Varsity Tutors • College Statistics • z-Test for a Proportion — Hypothesis Test for a Proportion (z-test)