Course contentsShow
← Data Science
Lesson 402 of 2,14511. Hypothesis Tests for Proportions and CategoriesFree lesson

Calculating the Test Statistic for Proportions

Computing the z-statistic using sample proportion, hypothesized proportion, and standard error formula.

Calculating the Test Statistic for Proportions

You'll learn how to compute the z-statistic that measures how far your sample proportion deviates from what you'd expect under the null hypothesis.

The Core Formula

When testing a hypothesis about a population proportion, you need a single number that captures "how unusual" your sample proportion is if the null hypothesis were true. That number is the z-statistic for proportions.

The formula looks like this:

z = (p̂ - p₀) / SE

Where:

  • p̂ (p-hat) is your observed sample proportion
  • p₀ is the hypothesized population proportion from your null hypothesis
  • SE is the standard error, calculated as √[p₀(1 - p₀) / n]

Understanding Each Piece

Think of the z-statistic like a standardized distance measurement. The numerator (p̂ - p₀) tells you how far your sample proportion is from the hypothesized value. The denominator (standard error) tells you how much variation you'd typically expect due to random sampling.

Dividing one by the other gives you a standardized score: "My sample proportion is ___ standard errors away from what I expected."

Simple Example

Suppose you hypothesize that 50% of voters support a candidate (p₀ = 0.50). You survey 100 people and find 58% support (p̂ = 0.58).

SE = √[0.50 × 0.50 / 100] = √0.0025 = 0.05
z = (0.58 - 0.50) / 0.05 = 0.08 / 0.05 = 1.6

Your sample proportion is 1.6 standard errors above the hypothesized value.

Key Takeaway: The z-statistic for proportions standardizes the difference between your sample proportion and hypothesized proportion by dividing by the standard error, creating a value you can compare against the standard normal distribution.