Z-Test for Proportion

Z-Test for Proportion

In this tutorial we will discuss about the step by step procedure of one sample $Z$-test for testing population proportion.

Let $X$ be the observed number of individuals possessing certain attributes (say, number of successes) in a random sample of size $n$ from a large population, then $\hat{p}=\frac{X}{n}$ be the observed proportion of successes.

Let $p$ be the population proportion of successes and $q = 1- p$ be the population proportion of failures.

Assumptions

Assumptions for testing a proportion are as follows:

a. The sample is a random sample.

b. The conditions for binomial experiments are satisfied.

c. $n$ is sufficiently large ($n>20$), $np\geq 5$ and $nq\geq 5$.

Step by step procedure

We wish to test the null hypothesis $H_0 : p = p_0$, where $p_0$ is the specified value of the population proportion.

The standard error of $p$ is
\begin{aligned} SE(\hat{p}) &= \sqrt{\frac{p(1-p)}{n}} \end{aligned}
The test statistic for testing $H_0$ is

 \begin{aligned} Z & = \frac{\hat{p}-p}{SE(\hat{p})} \end{aligned}

which follows standard normal distribution $N(0,1)$.

Step 1 State the hypothesis testing problem

The hypothesis testing problem can be structured in any one of the three situations as follows:

Situation Hypothesis Testing Problem
Situation A : $H_0: p=p_0$ against $H_a : p < p_0$ (Left-tailed)
Situation B : $H_0: p=p_0$ against $H_a : p > p_0$ (Right-tailed)
Situation C : $H_0: p=p_0$ against $H_a : p \neq p_0$ (Two-tailed)

Step 2 Define the test statistic

The test statistic for testing above hypothesis is

 $$\begin{eqnarray*} Z & = & \frac{\hat{p}-p}{SE(\hat{p})}\\ & = &\frac{\hat{p}-p}{\sqrt{\frac{p*(1-p)}{n}}} \end{eqnarray*}$$

The test statistic $Z$ follows standard normal distribution $N(0,1)$.

Step 4 Determine the critical values

For the specified value of $\alpha$ determine the critical region depending upon the alternative hypothesis.

• For left-tailed alternative hypothesis: Find the $Z$-critical value using

 \begin{aligned} P(Z<-Z_\alpha) &= \alpha. \end{aligned}

• For right-tailed alternative hypothesis: $Z_\alpha$.

 \begin{aligned} P(Z>Z_\alpha) &= \alpha. \end{aligned}

• For two-tailed alternative hypothesis: $Z_{\alpha/2}$.

 \begin{aligned} P(|Z|> Z_{\alpha/2}) &= \alpha. \end{aligned}

Step 5 Computation

Compute the test statistic under the null hypothesis $H_0$ using equation

 \begin{aligned} Z_{obs} &= \frac{\hat{p}-p_0}{\sqrt{\frac{p_0*(1-p_0)}{n}}} \end{aligned}

Traditional approach is based on the critical value(s).

• For left-tailed alternative hypothesis: Reject $H_0$ if $Z_{obs}\leq -Z_\alpha$.
• For right-tailed alternative hypothesis: Reject $H_0$ if $Z_{obs}\geq Z_\alpha$.
• For two-tailed alternative hypothesis: Reject $H_0$ if $|Z_{obs}|\geq Z_{\alpha/2}$.

OR

Step 6 Decision ($p$-value Approach)

$p$-value approach is based on the $p$-value of the test.

Alternative Hypothesis Type of Hypothesis $p$-value
$H_a: p < p_0$ Left-tailed $p$-value $= P(Z\leq Z_{obs})$
$H_a: p > p_0$ Right-tailed $p$-value $= P(Z\geq Z_{obs})$
$H_a: p \neq p_0$ Two-tailed $p$-value $= 2P(Z\geq abs(Z_{obs}))$

If $p$-value is less than $\alpha$, then reject the null hypothesis $H_0$ at $\alpha$ level of significance, otherwise fail to reject $H_0$ at $\alpha$ level of significance.

Endnote

In this tutorial, you learned the $Z$-test for testing single proportion and the assumptions for $Z$-test for testing population proportion. You also learned about the step by step procedure to apply $Z$-test for testing single proportion.

Let me know in the comments if you have any questions on $Z$-test for population proportion and your thought on this article.