Skip to content

Unit 3: Inference for Categorical Data: Proportions

AP Stats cheatsheet

Open ↗

Loading…

Statistical inference uses sample data to make conclusions about a population parameter. For proportions, the parameter is usually:

  • pp: one population proportion.
  • p1−p2p_1-p_2: difference between two population proportions.

A confidence interval estimates a plausible range of values for a parameter. A hypothesis test evaluates whether sample data provide convincing evidence against a null hypothesis.


An estimator is a statistic used to estimate a population parameter. For categorical data, the most common estimators are:

  • p^\hat{p} for a population proportion pp.
  • p^1−p^2\hat{p}_1-\hat{p}_2 for a difference in population proportions p1−p2p_1-p_2.

A good estimator is usually unbiased and has low variability. For one sample proportion,

μp^=p\mu_{\hat{p}}=p

and

σp^=p(1−p)n.\sigma_{\hat{p}}=\sqrt{\frac{p(1-p)}{n}}.

The normal approximation is appropriate when the large-counts condition is met:

np≥10andn(1−p)≥10.np\ge 10 \quad \text{and} \quad n(1-p)\ge 10.

For two independent sample proportions,

μp^1−p^2=p1−p2\mu_{\hat{p}_1-\hat{p}_2}=p_1-p_2

and

σp^1−p^2=p1(1−p1)n1+p2(1−p2)n2.\sigma_{\hat{p}_1-\hat{p}_2} =\sqrt{\frac{p_1(1-p_1)}{n_1}+\frac{p_2(1-p_2)}{n_2}}.

A confidence interval has the form

statistic±critical value⋅standard error.\text{statistic} \pm \text{critical value}\cdot \text{standard error}.

The confidence level describes the long-run capture rate of the method. A 95% confidence interval does not mean there is a 95% probability that the fixed parameter is in this particular interval. It means that if we repeatedly sampled and built intervals the same way, about 95% of those intervals would contain the true parameter.

parameterscaletrueparametermostcon¯denceintervalscapturethetruevalue

Use a one-proportion z-interval to estimate one population proportion pp:

p^±z∗p^(1−p^)n.\hat{p} \pm z^*\sqrt{\frac{\hat{p}(1-\hat{p})}{n}}.

Common critical values:

Confidence levelz∗z^*
90%1.645
95%1.960
99%2.576

The margin of error for a one-proportion interval is

ME=z∗p^(1−p^)n.ME = z^*\sqrt{\frac{\hat{p}(1-\hat{p})}{n}}.

For planning sample size, use

n=(z∗)2p∗(1−p∗)ME2,n = \frac{(z^*)^2p^*(1-p^*)}{ME^2},

where p∗p^* is a planning estimate. If no estimate is given, use p∗=0.5p^*=0.5 because it gives the most conservative, largest required sample size.

Always round required sample size up.


A hypothesis test begins with:

  • Null hypothesis H0H_0: the default claim, usually “no difference” or “equals a stated value.”
  • Alternative hypothesis HaH_a: the claim we seek evidence for.

For one proportion:

H0:p=p0.H_0: p=p_0.

The alternative may be

Ha:p>p0,Ha:p<p0,orHa:p≠p0.H_a:p>p_0,\qquad H_a:p<p_0,\qquad \text{or}\qquad H_a:p\ne p_0.

The p-value is the probability, assuming H0H_0 is true, of getting a test statistic as extreme as or more extreme than the observed result in the direction of HaH_a.

Decision rule:

  • If p-value <α< \alpha, reject H0H_0.
  • If p-value ≥α\ge \alpha, fail to reject H0H_0.

Use a one-proportion z-test for a claim about one population proportion:

z=p^−p0p0(1−p0)/n.z = \frac{\hat{p}-p_0}{\sqrt{p_0(1-p_0)/n}}.

Use p0p_0 in the standard error because the test assumes the null hypothesis is true.

p-valueteststatisticdensity

Use a two-proportion z-interval to estimate p1−p2p_1-p_2:

(p^1−p^2)±z∗p^1(1−p^1)n1+p^2(1−p^2)n2.(\hat{p}_1-\hat{p}_2) \pm z^* \sqrt{\frac{\hat{p}_1(1-\hat{p}_1)}{n_1}+\frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}.

Interpret the interval in context: “We are ___% confident that the true difference in population proportions p1−p2p_1-p_2 is between ___ and ___.”


For a test of

H0:p1−p2=0,H_0:p_1-p_2=0,

we pool the sample proportions because the null says the two population proportions are equal:

p^c=x1+x2n1+n2.\hat{p}_c = \frac{x_1+x_2}{n_1+n_2}.

The test statistic is

z=(p^1−p^2)−0p^c(1−p^c)(1n1+1n2).z = \frac{(\hat{p}_1-\hat{p}_2)-0} {\sqrt{\hat{p}_c(1-\hat{p}_c)\left(\frac{1}{n_1}+\frac{1}{n_2}\right)}}.

Use the pooled proportion only for the hypothesis test, not for the confidence interval.


A Type I error occurs when we reject a true null hypothesis. Its probability is α\alpha, the significance level.

A Type II error occurs when we fail to reject a false null hypothesis. Its probability is β\beta.

Power is the probability of correctly rejecting a false null hypothesis:

Power=1−β.\text{Power} = 1-\beta.

Power increases when:

  • The true parameter is farther from the null value.
  • Sample size increases.
  • Significance level α\alpha increases.
  • Variability decreases.

Chi-Square Tests for Homogeneity and Independence

Section titled “Chi-Square Tests for Homogeneity and Independence”

Chi-square procedures compare observed counts to expected counts. The test statistic is

χ2=∑(O−E)2E.\chi^2=\sum \frac{(O-E)^2}{E}.

Here OO is an observed count and EE is an expected count. Large values of χ2\chi^2 indicate that the observed counts are far from what the null hypothesis predicts, so chi-square tests are right-tailed.

The chi-square distribution is right-skewed and indexed by degrees of freedom. Chi-square values are always nonnegative because the statistic is built from squared differences. As degrees of freedom increase, the distribution becomes less skewed.

A chi-square test for homogeneity compares the distribution of one categorical variable across two or more populations or treatment groups.

  • H0H_0: The category distribution is the same for all populations or treatments.
  • HaH_a: At least one population or treatment has a different category distribution.

A chi-square test of independence checks whether two categorical variables are associated in one population.

  • H0H_0: The two variables are independent in the population.
  • HaH_a: The two variables are associated in the population.

For both homogeneity and independence, the expected count for a cell is

E=(row total)(column total)grand total.E=\frac{(\text{row total})(\text{column total})}{\text{grand total}}.

The degrees of freedom are

df=(r−1)(c−1),df=(r-1)(c-1),

where rr is the number of rows and cc is the number of columns.

Each cell’s contribution is

(O−E)2E.\frac{(O-E)^2}{E}.

The largest contributions show which cells are most responsible for the overall chi-square statistic. A cell with O>EO>E occurred more often than expected under the null; a cell with O<EO<E occurred less often than expected.


Common calculator tools:

  • 1-PropZInt: one-proportion confidence interval.
  • 1-PropZTest: one-proportion hypothesis test.
  • 2-PropZInt: two-proportion confidence interval.
  • 2-PropZTest: two-proportion hypothesis test.
  • X2-Test: chi-square test for homogeneity or independence using a matrix of observed counts.

Calculator output does not replace communication. You still need hypotheses, conditions, p-value or interval, and a conclusion in context.