Skip to main content
Statistics LibreTexts

11.1: z-Test for Comparing Proportions

  • Page ID
    52006
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\dsum}{\displaystyle\sum\limits} \)

    \( \newcommand{\dint}{\displaystyle\int\limits} \)

    \( \newcommand{\dlim}{\displaystyle\lim\limits} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \(\newcommand{\longvect}{\overrightarrow}\)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    In Section 9.4 we covered a one-sample test for proportions using the \(z\) approximation to the binomial distribution. Here we want to compare a proportion \(p_{1}\) in one population with \(p_{2}\) in another population, a two-sample test for proportions, also using the \(z\) approximation to the binomial distribution. Define

    \[\hat{p}_{1} = \frac{x_{1}}{n_{1}} \mbox{\ \ \ \ and\ \ \ \ } \hat{p}_{2} = \frac{x_{2}}{n_{2}}\]

    where \(x_{1}\) and \(x_{2}\) are the number of items of interest in the samples from the two populations and \(n_{1}\) and \(n_{2}\) are their sample sizes. Also define the corresponding \(q_{1} = 1 - p_{1}\), \(q_{2} = 1 - p_{2}\), \(\hat{q}_{1} = 1 - \hat{p}_{1}\) and \(\hat{q}_{2} = 1 -\hat{ }p_{2}\). The hypotheses we want to test is

    \[ H_{0}: p_{1} = p_{2} \hspace*{3em} H_{1}: p_{1} \neq p_{2} \]

    which is equivalent to

    \[ H_{0}: p_{1} - p_{2} = 0 \hspace*{3em} H_{1}: p_{1} - p_{2} \neq 0 \]

    If \(n_{1}p_{1}, n_{1}q_{1}, n_{2}p_{2}\), and \(n_{2}q_{2}\) are all \(> 5\) then the appropriate normal distribution will provide a good approximation to the relevant binomial distribution and we can use the following test statistic to test the hypotheses

    \[ z_{\rm test} = \frac{\hat{p}_{1} - \hat{p}_{2}}{\sqrt{\bar{p}\bar{q} \left( \frac{1}{n_{1}} + \frac{1}{n_{2}} \right)}} \]

    where

    \[ \bar{p} = \frac{x_{1}+x_{2}}{n_{1}+n_{2}} \hspace*{3em} \bar{q} = 1 -\bar{p} \]

    are the proportions of items of interest and not of interest in the two samples combined.

    Example 11.1 : In a nursing home study we are interested in the proportions of nursing homes that have vaccination rates of less than 80\(\%\). The two populations we want to compare are small nursing homes and large nursing homes. In a sample of 34 small nursing homes, 12 were found to have a vaccination rate of less than 80\(\%\). In a sample of 24 large nursing homes, 17 were found to have a vaccination rate of less than 80\(\%\). At \(\alpha = 0.05\) is there a difference in the proportions of small and large nursing homes with vaccination rates of less than 80\(\%\)?

    Solution :

    0. Data reduction.

    First define: population 1 = small nursing homes and population 2 = large nursing homes. Then compute the proportions:

    \[ \hat{p}_{1} = \frac{x_{1}}{n_{1}} = \frac{12}{34} = 0.35 \hspace{4em} \hat{p}_{2} = \frac{x_{2}}{n_{2}} = \frac{17}{24} = 0.71 \] \[ \bar{p} = \frac{x_{1} + x_{2}}{n_{1} + n_{2}} = \frac{12+17}{34+24} = \frac{29}{58} = 0.5 \hspace{4em} \bar{q} = 1 - \bar{p} = 1 - 0.5 = 0.5 \]

    1. Hypotheses.

    \[H_{0}: p_{1} = p_{2} \hspace*{3em} H_{1}: p_{1} \neq p_{2}\]

    2. Critical statistic.

    Use Table F, the last (\(z\)) line in the column for a two-tailed test at \(\alpha = 0.05\): \(z_{\rm crit} = \pm 1.96\)

    3. Test statistic.

    \[\begin{eqnarray*} z_{\rm test} & = & \frac{\hat{p}_{1} - \hat{p}_{2}}{\sqrt{\bar{p}\bar{q} \left( \frac{1}{n_{1}} + \frac{1}{n_{2}} \right)}} \\ z_{\rm test} & = & \frac{0.35 - 0.71}{\sqrt{(0.5)(0.5) \left( \frac{1}{34} + \frac{1}{24} \right)}} \\ z_{\rm test} & = & \frac{-0.36}{0.1333} \\ z_{\rm test} & = & -2.7 \end{eqnarray*}\]

    4. Decision.

    fig89apng-300x150.jpg

    Reject \(H_{0}\).

    5. Interpretation.

    There is enough evidence, from a \(z\) proportions test at \(\alpha = 0.05\) to support the observation that large nursing homes have worse vaccination rates than small nursing homes. Make sure your parents end up in a small nursing home. (Note that rejection of \(H_{0}\) in a one-tail test allows us to believe the direction of difference given by the sample data.)


    This page titled 11.1: z-Test for Comparing Proportions is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Gordon E. Sarty via source content that was edited to the style and standards of the LibreTexts platform.