# Hypothesis Tests for Proportion

This is also called the “p test”

When comparing proportions that are from a population with a fixed number of independent trials and each trial has a constant probability of one or another outcome (Bernoulli experiments) then we can use a p test. p is the probability of success, and 1-p is the probability of failure. Caution: stay consistent once you define success otherwise, like me, you’ll have a bit of confusion. n is the number of trials.

The exact way to solve these problems is with the Binomial distribution, yet when np and n(1-p) is greater than 5, then the normal distribution provides similar results. The use of the Binomial distribution is calculation intensive thus when possible we tend to use the normal distribution for the calculations.

Let’s say we want to compare a proportion, p, to a fixed value, p_{o}. Like other hypothesis tests we have three comparisons possible. The null hypothesis, H_{o}, could be equal to, greater than, or less than the fixed value, p_{o}. The alternative hypothesis H_{a}, defines the contrary conditions.

The three cases then are:

The population proportion of successes is equal to a fixed (given) value.

$$ \large\displaystyle \begin{array}{l}{{H}_{o}}:p={{p}_{o}}\\{{H}_{a}}:p\ne {{p}_{o}}\end{array}$$

The population proportion of successes is less then or equal to a fixed value.

$$ \large\displaystyle \begin{array}{l}{{H}_{o}}:p\le {{p}_{o}}\\{{H}_{o}}:p>{{p}_{o}}\end{array}$$

The population proportion of successes is greater than or equal to a fixed value.

$$ \large\displaystyle \begin{array}{l}{{H}_{o}}:p\ge {{p}_{o}}\\{{H}_{o}}:p<{{p}_{o}}\end{array}$$

The test statistic is given by

$$ \large\displaystyle z=\frac{x-n{{p}_{o}}}{\sqrt{n{{p}_{o}}\left( 1-{{p}_{o}} \right)}}$$

Where

x is the number of successes out of the

n trials

p_{o} is the fixed proportion being compared to the data.

A great way to remember the formula for the test statistic is the number of success in the sample is compared to the mean value, np_{o }, and divided by the standard deviation, which is the square root of np_{o }(1- p_{o }).

Example Problem

Let’s consider an example. Let’s say we’re inspecting corn from a test field. If the inspection accepts 30% of the sample or better, we conclude the field produces corn that is as good as or better than an average field of corn. We sample 150 ears of corn and find that 60 of the sample of 150 failed the inspection. Is there convincing evidence the test field has a higher failure rate than an average field? Use alpha = 0.05.

Solution

The null and alternative hypothesis are

$$ \large\displaystyle \begin{array}{l}{{H}_{o}}:p\le 0.30\\{{H}_{o}}:p>0.30\end{array}$$

The test statistic is

$$ \large\displaystyle z=\frac{x-n{{p}_{o}}}{\sqrt{n{{p}_{o}}\left( 1-{{p}_{o}} \right)}}$$

The rejection region for α = 0.05 means we will reject H_{o} if

$$ \large\displaystyle z>1.645$$

Using the sample data, first determine the number of successes, x = 60, (those that fail the test as we defined above).

To be certain we can use the normal approximation, check that np_{o} = 45, and np_{o}(1-p_{o}) = 105. Both are greater than 5, so we may proceed with the normal approximation.

The test statistic is then

$$ \large\displaystyle z=\frac{0.4-0.3}{\sqrt{150\times 0.3\times 0.7}}=2.67$$

Since the observed z value is greater than the test statistic it is in the rejection region and we reject the null hypothesis. We conclude that there is convincing evidence that the test field has a lower yield (higher inspection failures) then the expected average result.

Related:

Two Proportions Hypothesis Testing (article)

Binomial Probability Density Function (article)

Hypothesis Test Selection (article)

*
Also published on Medium. *

## Leave a Reply