Tutorials › AP Statistics › The Test Statistic z for One Proportion

One-proportion hypothesis tests · Tutorial 465 of 1000

The Test Statistic z for One Proportion

Derive the one-proportion z statistic by standardizing the sample proportion under the null hypothesis, then identify what each part measures.

Intermediate 10 min read

What You'll Learn

  • Derive the standard error of the sample proportion when the null hypothesis is assumed true.
  • Identify the roles of the sample proportion, null proportion, sample size, and standard error in the z statistic.
  • Explain why a one-proportion z test uses the null proportion in its standard error.
  • Calculate a z statistic and describe its direction and size in context.
  • Distinguish a test statistic from a confidence-interval standard error and from a final test decision.

Why the Test Statistic Uses the Null Proportion

In Defining the Parameter in Hypothesis Statements, you learned to define \(p\) as a population proportion and to keep it distinct from the sample proportion, \(\hat{p}\). In a one-proportion hypothesis test, the null hypothesis supplies a specific reference value, \(p_0\), for \(p\). The test statistic measures how far the observed \(\hat{p}\) is from that reference value, relative to the amount of sample-to-sample variation predicted by the null model.

That comparison is what the \(z\) statistic expresses. A positive \(z\) means the sample proportion is above the null value; a negative \(z\) means it is below. Its magnitude tells us how many estimated standard errors separate the observed sample proportion from the null value. The statistic itself is not a probability and does not, by itself, decide whether to reject the null hypothesis.

Definition: For a one-proportion \(z\)-test of \(H_0:p=p_0\), the test statistic \(z\) is the difference between the observed sample proportion and the null proportion, divided by the standard error of the sample proportion calculated under the null model.

Deriving the Formula

Suppose a sample has size \(n\), and let \(X\) be the random variable counting the number of successes. Under the null hypothesis \(H_0:p=p_0\), the expected number of successes is \(np_0\), and the variance of \(X\) is \(np_0(1-p_0)\). The sample proportion is \(\hat{p}=X/n\), so its expected value and variance under the null model are:

$$ \mu_{\hat{p}}=p_0 \qquad \operatorname{Var}(\hat{p})=\frac{p_0(1-p_0)}{n} $$

The standard deviation of \(\hat{p}\) under this model is therefore \(\sqrt{p_0(1-p_0)/n}\). This is the standard error used for the test statistic: it describes the typical sample-to-sample distance between \(\hat{p}\) and \(p_0\) when the null hypothesis is true. As in the earlier tutorials on test conditions, the Normal approximation for this sampling distribution is appropriate when the null-model expected success and failure counts are both large enough.

A \(z\) score standardizes a value by subtracting its model mean and dividing by its model standard deviation. Here, the value is the observed \(\hat{p}\), the null-model mean is \(p_0\), and the null-model standard deviation is \(\sqrt{p_0(1-p_0)/n}\). Substituting those quantities gives the one-proportion test statistic:

$$ z=\frac{\hat{p}-p_0}{\sqrt{\dfrac{p_0(1-p_0)}{n}}} $$
Formula: \(z=(\hat{p}-p_0)/\sqrt{p_0(1-p_0)/n}\). The numerator is the observed difference from the null proportion. The denominator is the standard error of \(\hat{p}\) assuming \(H_0\) is true. The result is a standardized, unit-free distance.

Each term has a specific job:

  • \(\hat{p}\): The observed sample proportion, calculated as \(x/n\), where \(x\) is the number of successes.
  • \(p_0\): The proportion stated in the null hypothesis \(H_0:p=p_0\). It is the reference value, not an estimate from the sample.
  • \(n\): The sample size. A larger sample gives a smaller standard error, all else equal.
  • \(\sqrt{p_0(1-p_0)/n}\): The null-model standard error of the sample proportion. It estimates how much \(\hat{p}\) typically varies around \(p_0\) if the null hypothesis is true.
  • \(z\): The number of null-model standard errors by which \(\hat{p}\) is above or below \(p_0\).

Notice that the test’s standard error uses \(p_0\), not \(\hat{p}\). The test asks how unusual the observed sample would be if the null hypothesis were true, so the variation must be calculated from the null model. This differs from the one-proportion \(z\)-interval in Constructing a One-Proportion \(z\)-Interval by Hand, where the estimated standard error uses \(\hat{p}\). Those procedures use different standard errors because they address different questions.

Reading the Sign and Size of \(z\)

The sign follows directly from the numerator. If \(\hat{p}>p_0\), then \(z\) is positive; if \(\hat{p}<p_0\), then \(z\) is negative. If the sample proportion equals the null value, \(z=0\). The sign describes the direction of the sample’s departure from the null value, not whether that departure is statistically significant.

For example, \(z=1.8\) means the observed sample proportion is 1.8 null-model standard errors above \(p_0\). It does not mean that the sample proportion is 1.8 percentage points above \(p_0\), or that the null hypothesis has a particular probability of being true. The \(z\) statistic is a standardized distance; a p-value, considered in the next stages of a test, translates that distance into a probability under the null model.

Key distinction: A test statistic compares the sample result with a null value using the null-model standard error. It is not the sample proportion, not a probability, and not a final decision about \(H_0\).

Worked Examples

Worked Example: A Sample Proportion Above the Null Value

A random sample of 200 customers is asked whether they used a store’s self-checkout during their most recent visit. Suppose 124 answer yes. A test will examine \(H_0:p=0.55\), where \(p\) is the true proportion of the store’s customers who used self-checkout on their most recent visit. Calculate and interpret the test statistic.

State: The parameter is the true proportion of the store’s customers who used self-checkout on their most recent visit. The null value is \(p_0=0.55\). The sample has \(x=124\) successes and \(n=200\), so \(\hat{p}=124/200=0.62\).

Plan and check conditions: The sample is described as random, so the Random condition is met. If it was sampled without replacement from the store’s 5,000 customers, the 10% condition is met because \(200\leq0.10(5000)=500\). Under the null, the expected success count is \(np_0=200(0.55)=110\), and the expected failure count is \(n(1-p_0)=200(0.45)=90\). Both are at least 10, so the Large Counts condition for the test is met.

Do: Calculate the standard error using \(p_0\), then substitute into the formula:

$$ SE_0=\sqrt{\frac{0.55(1-0.55)}{200}} =\sqrt{\frac{0.2475}{200}} =\sqrt{0.0012375} \approx0.03518 $$
$$ z=\frac{0.62-0.55}{0.03518} =\frac{0.07}{0.03518} \approx1.990 $$

Conclude about the statistic: The observed sample proportion is about 1.990 null-model standard errors above 0.55. This describes the location of the sample result relative to the null model; a test decision would also require a p-value and a significance level.

Worked Example: A Sample Proportion Below the Null Value

A randomly selected group of 120 members of a recreation program is asked whether they attended at least one class last month. Of those selected, 42 say yes. Calculate the \(z\) statistic for testing \(H_0:p=0.40\), where \(p\) is the true proportion of program members who attended at least one class last month.

First, \(\hat{p}=42/120=0.35\). The sample proportion is below the null value, so the numerator and the resulting statistic should be negative. The null-model expected counts are \(120(0.40)=48\) successes and \(120(0.60)=72\) failures, both at least 10. The sample was randomly selected; if it was drawn without replacement from 2,400 members, the 10% condition holds because \(120\leq240\).

The standard error and statistic are:

$$ SE_0=\sqrt{\frac{0.40(0.60)}{120}} =\sqrt{0.002} \approx0.04472 $$
$$ z=\frac{0.35-0.40}{0.04472} =\frac{-0.05}{0.04472} \approx-1.118 $$

The sample proportion is about 1.118 null-model standard errors below 0.40. The negative sign indicates the direction of the difference. It does not, on its own, establish convincing evidence against the null hypothesis.

Worked Example: Checking the Null Counts Before Calculating

A random sample of 50 households is asked whether they compost food scraps. Eighteen households answer yes. Consider a test of \(H_0:p=0.30\), where \(p\) is the true proportion of households in the neighborhood that compost food scraps. Calculate the test statistic and explain why the null proportion determines the standard error.

The sample proportion is \(\hat{p}=18/50=0.36\). The sample was randomly selected. If the sample was taken without replacement from 800 neighborhood households, the 10% condition is met because \(50\leq80\). Under \(H_0\), the expected number of successes is \(50(0.30)=15\), and the expected number of failures is \(50(0.70)=35\). Both expected counts meet the Large Counts condition.

Use \(p_0=0.30\) in the standard error, because the question is how much the sample proportion would vary if that null value were true:

$$ SE_0=\sqrt{\frac{0.30(0.70)}{50}} =\sqrt{0.0042} \approx0.06481 $$
$$ z=\frac{0.36-0.30}{0.06481} =\frac{0.06}{0.06481} \approx0.926 $$

The observed proportion is about 0.926 null-model standard errors above 0.30. Using \(\hat{p}=0.36\) in the denominator would answer a different calculation: it would estimate variation using the observed sample proportion rather than the null model being tested.

Worked Example: How Sample Size Changes the Standardized Distance

Two independent random samples from the same large population both have a sample proportion of 0.60. Compare their test statistics for \(H_0:p=0.50\): the first sample has \(n=100\), and the second has \(n=200\). Assume each sample satisfies the Random condition and the 10% condition. For both samples, the null expected success and failure counts are at least 10.

For \(n=100\), the null standard error is \(\sqrt{0.50(0.50)/100}=0.05\). Thus:

$$ z=\frac{0.60-0.50}{0.05}=2.000 $$

For \(n=200\), the null standard error is \(\sqrt{0.50(0.50)/200}=\sqrt{0.00125}\approx0.03536\). Thus:

$$ z=\frac{0.60-0.50}{0.03536}\approx2.828 $$

The sample proportions have the same difference from the null value, but the larger sample has the smaller standard error and the larger \(z\) statistic. A given difference is more standardized—that is, farther from the null in standard-error units—when it is measured with less sampling variability.

Common Mistakes and What Full Credit Says

  • Putting \(\hat{p}\) in the test standard error. For a one-proportion \(z\)-test, use \(\sqrt{p_0(1-p_0)/n}\). The null hypothesis supplies the assumed proportion. The interval standard error from an earlier tutorial uses \(\hat{p}\), but that is not the test formula.
  • Using the wrong numerator order. The formula is \(\hat{p}-p_0\). Reversing the subtraction changes the sign and misstates whether the observed proportion is above or below the null value.
  • Calling \(z\) a probability or a percentage-point difference. It is a standardized distance, measured in standard errors. A full-credit interpretation says how many standard errors the sample proportion is above or below the null value.
  • Skipping the null-model Large Counts check. For a test, check \(np_0\geq10\) and \(n(1-p_0)\geq10\), not the observed success and failure counts. As emphasized in Checking the Success-Failure Condition for Tests, the condition is based on expected counts under \(H_0\).
  • Treating the statistic as a decision. A positive or large-looking \(z\) does not itself mean “reject.” A test decision requires considering the p-value and significance level. A statistic alone describes the sample’s standardized distance from the null value.
AP Exam Tip: Show the sample proportion, the null-based standard error, and the substitution into the formula. Then interpret the sign and magnitude in context. Keep the test statistic separate from the p-value and the final conclusion about \(H_0\).

Key Takeaway

The one-proportion \(z\) statistic is a standardized comparison between the observed sample proportion and the proportion named in the null hypothesis. Its denominator comes from the sampling variation predicted by the null model, which is why it uses \(p_0\).

Key takeaway: Calculate \(z\) as \((\hat{p}-p_0)/\sqrt{p_0(1-p_0)/n}\). The numerator gives the direction and size of the observed difference; the denominator expresses typical variation under \(H_0\); and \(z\) reports that difference in standard-error units.

Check Your Understanding

Answer each question. When calculating, show the standard error and the substitution into the \(z\) formula.

  1. In \(H_0:p=0.25\), what does \(p_0\) represent, and why does it appear in the test standard error?
  2. A sample has \(n=160\) and \(x=72\), and the null proportion is \(p_0=0.40\). Calculate \(\hat{p}\), the null standard error, and \(z\). Interpret the sign of your result.
  3. A student calculates a one-proportion test statistic using \(\sqrt{\hat{p}(1-\hat{p})/n}\). Explain why this is not the standard error in the one-proportion \(z\)-test.
  4. For a test with \(n=90\) and \(p_0=0.10\), check the Large Counts condition for the test. Does the condition hold?
  5. Two samples have the same \(\hat{p}-p_0\), but one has a larger sample size. Explain how and why their \(z\) statistics may differ, assuming both samples meet the conditions.