### 7. Hypothesis Testing: Hypothesis Test for a Population Proportion

### Small-sample Proportion Test: Test Statistic and p-value

Binomial Test for a Population Proportion: Test Statistic

When the sample size is small (#n\lt 30#), the *Central Limit Theorem *no longer applies.

In such cases, however, the number of successes #X# can be used as the test statistic.

Under the assumption that the null hypothesis #H_0# is true, #X# has the *binomial distribution *with parameters #n# and #\pi_0#. That is, #X \sim B(n, \pi_0)#.

Calculating the p-value of a Binomial Test for a Population Proportion with Statistical Software

Suppose you observe #X=k#.

The calculation of the #p#-value of a *binomial *test for #\pi# is dependent on the *direction *of the test and can be performed using either Excel or R.

To calculate the #p#-value of a *binomial *test for #\pi# in **Excel**, make use of one of the following commands:

\[\begin{array}{llll}

\phantom{0}\text{Direction}&\phantom{0000}H_0&\phantom{0000}H_a&\phantom{0000000000}\text{Excel Command}\\

\hline

\text{Left-tailed}&H_0:\pi \geq \pi_0&H_a:\pi \lt \pi_0&=\text{BINOM.DIST}(k, n, \pi_0,1)\\

\text{Right-tailed}&H_0:\pi \leq \pi_0&H_a:\pi \gt \pi_0&=1\text{ - }\text{BINOM.DIST}(k \text{ - }1,n,\pi_0 ,1)\\

\text{Two-tailed}&H_0:\pi = \pi_0&H_a:\pi \neq \pi_0&\text{twice the smallest of the two probabilities above}\\

\end{array}\]

To calculate the #p#-value of a *binomial *test for #\pi# in **R**, make use of one of the following commands:

\[\begin{array}{llll}

\phantom{0}\text{Direction}&\phantom{0000}H_0&\phantom{0000}H_a&\phantom{000000}\text{R Command}\\

\hline

\text{Left-tailed}&H_0:\pi \geq \pi_0&H_a:\pi \lt \pi_0&\text{pbinom}(k, n, \pi_0, \text{TRUE})\\

\text{Right-tailed}&H_0:\pi \leq \pi_0&H_a:\pi \gt \pi_0&\text{pbinom}(k \text{ - }1,n,\pi_0 , \text{FALSE})\\

\text{Two-tailed}&H_0:\pi = \pi_0&H_a:\pi \neq \pi_0&\text{twice the smallest of the two probabilities above}\\

\end{array}\]

If #p \lt \alpha#, reject #H_0# and conclude #H_a#. Otherwise, do not reject #H_0#.

This small-sample approach can also be used for large samples, as the #p#-values will be approximately the same for either approach.

A gambling commissioner is suspicious of this claim and thinks the true chances of winning are

*lower*than #17\%#. The commissioner plans on using a statistical test to test her suspicion.

In #20# independent trials, the commissioner wins #4# times.

Calculate the #p#-value of the test and make a decision regarding #H_0: \pi \geq 0.17#. Round your answer to #4# decimal places. Use the significance level #\alpha = 0.02#.

On the basis of this #p#-value, #H_0# should not be rejected, because #\,p# #\gt# #\alpha#.

There are a number of different ways we can calculate the #p#-value of the test. Click on one of the panels to toggle a specific solution.

Let #X# denote the number of observed wins out of #20#, then #X=4#.

A sample size of #20# is not considered large enough for the *Central Limit Theorem *to apply. This means that we will need to use #X# as the test statistic.

Under the null hypothesis #H_0#, #X# is *binomially *distributed with parameters #n# and #\pi_0#. That is:

\[X \sim B(20, 0.17)\]

Assuming #X \sim B(20, 0.17)#, the #p#-value of a *left-tailed binomial *test for #\pi# can be computed with the following Excel command:

\[\begin{array}{c}

= \text{BINOM.DIST}(X,n,\pi_0 ,1)\\

\downarrow\\

= \text{BINOM.DIST}(4, 20, 0.17 ,1)

\end{array}\]

This gives:

\[p =0.7557\]

Since #\,p# #\gt# #\alpha#, #H_0: \pi = 0.17# should not be rejected.

Let #X# denote the number of observed wins out of #20#, then #X=4#.

A sample size of #20# is not considered large enough for the *Central Limit Theorem *to apply. This means that we will need to use #X# as the test statistic.

Under the null hypothesis #H_0#, #X# is *binomially *distributed with parameters #n# and #\pi_0#. That is:

\[X \sim B(20, 0.17)\]

Assuming #X \sim B(20, 0.17)#, the #p#-value of a *left-tailed binomial *test for #\pi# can be computed with the following R command:

\[\begin{array}{c}

\text{pbinom}(X,n,\pi_0 ,\text{TRUE})\\

\downarrow\\

\text{pbinom}(4, 20, 0.17 ,\text{TRUE})

\end{array}\]

This gives:

\[p =0.7557\]

Since #\,p# #\gt# #\alpha#, #H_0: \pi = 0.17# should not be rejected.