Introduction

In this section, we consider a hypothesis test of the population proportion \(p\). This procedure is based on a random sample of \(n\) observations from a population with unknown population proportion \(p\). We require that the sample size is large enough so that \(np \ge 10\) and \(n(1-p) \ge 10\).

Upper Tailed Test

We want to test the null hypothesis \(H_0: p = p_0\) versus \(H_a: p > p_0\)

The test statistic is

\[z = \frac{\hat p - p_0}{\sqrt{\frac{p_0(1-p_0)}{n}}}\]

which has a standard normal distribution under the assumption that the null hypothesis is true.

The p-value is

\[P(Z > z) = 1-\text{pnorm}(z,0,1)\]

If the p-value is less than or equal to \(\alpha\) then we reject the null hypothesis and there is sufficient evidence to conclude the alternative hypothesis.

Otherwise we fail to reject the null hypothesis and there is insufficient evidence to conclude the alternative hypothesis.

Example 1: In a group of 371 students, 27 chose the number seven when picking a number between one and twenty “at random”. Does this provide convincing statistical evidence of bias in favor of the number seven, in that the proportion of students picking seven is significantly higher than 1/20 = .05? Test the appropriate hypothesis at \(\alpha = 0.05\)

We are interested in testing \(H_0:p=0.05\) versus \(H_a:p>0.05\) where \(p =\) true population proportion of students picking seven. To find the test statistic and p-value, we can use R.

n <- 371
x <- 27
phat <- x/n
p0 <- 0.05
z <- (phat-p0)/sqrt(p0*(1-p0)/n)
z
[1] 2.012903
pval <- 1-pnorm(z,0,1)
pval
[1] 0.02206239

The p-value tells us that we only have a 2% chance of seeing a sample result that large or larger if the null hypothesis is really true. Since the p-value is less than \(\alpha\), we reject the null hypothesis and conclude that there is bias in picking the number seven.

It is required that the \(np_0 \ge 10\) and \(n(1-p_0) \ge 10\) which we can check in R that this requirement is satisfied.

n <- 371
p0 <- 0.05
n*p0
[1] 18.55
n*(1-p0)
[1] 352.45

Lower Tailed Test

We want to test the null hypothesis \(H_0: p = p_0\) versus \(H_a: p < p_0\)

The test statistic is

\[z = \frac{\hat p - p_0}{\sqrt{\frac{p_0(1-p_0)}{n}}}\]

which has a standard normal distribution under the assumption that the null hypothesis is true.

The p-value is

\[P(Z < z) = \text{pnorm}(z,0,1)\]

If the p-value is less than or equal to \(\alpha\) then we reject the null hypothesis and there is sufficient evidence to conclude the alternative hypothesis.

Otherwise we fail to reject the null hypothesis and there is insufficient evidence to conclude the alternative hypothesis.

Example 2: In a group of 371 college students, 42 were left-handed. Is this significantly lower than the proportion of all Americans who are left-handed, which is .12? Test at \(\alpha = 0.10.\)

We are interested in testing \(H_0:p=0.12\) versus \(H_a:p<0.12\) where \(p =\) true proportion of college students who are left-handed. To find the test statistic and p-value, we can use R.

n <- 371
x <- 42
phat <- x/n
p0 <- 0.12
z <- (phat-p0)/sqrt(p0*(1-p0)/n)
z
[1] -0.4026073
pval <- pnorm(z,0,1)
pval
[1] 0.3436186

The p-value tells us that we have 34% chance of seeing a sample result that small or smaller if the null hypothesis is really true. Since the p-value is greater than \(\alpha\), we fail to reject the null hypothesis and conclude that there is insufficient evidence that the proportion of college students who are left-handed is significantly less than 0.12.

It is required that the \(np_0 \ge 10\) and \(n(1-p_0) \ge 10\) which we can check in R that this requirement is satisfied.

n <- 371
p0 <- 0.12
n*p0
[1] 44.52
n*(1-p0)
[1] 326.48

Two Tailed Test

We want to test the null hypothesis \(H_0: p = p_0\) versus \(H_a: p \ne p_0\)

The test statistic is

\[z = \frac{\hat p - p_0}{\sqrt{\frac{p_0(1-p_0)}{n}}}\]

which has a standard distribution under the assumption that the null hypothesis is true.

The p-value is

\[2P(Z > |z|) = 2*(1-\text{pnorm(abs}(z),0,1))\]

If the p-value is less than or equal to \(\alpha\) then we reject the null hypothesis and there is sufficient evidence to conclude the alternative hypothesis.

Otherwise we fail to reject the null hypothesis and there is insufficient evidence to conclude the alternative hypothesis.

Example 3: A university has found over the years that out of all the students who are offered admission, the proportion who accept is 0.70. After a new director of admissions is hired, the university wants to check if the proportion of students accepting has changed significantly. Suppose they offer admission to 1200 students and 888 accept. Is this evidence of a change from the status quo? Test at \(\alpha = 0.01\)

We are interested in testing \(H_0:p=0.70\) versus \(H_a:p \ne 0.70\) where \(p =\) true population proportion of students who accept admission. To find the test statistic and p-value, we can use R.

n <- 1200
x <- 888
phat <- x/n
p0 <- 0.70
z <- (phat-p0)/sqrt(p0*(1-p0)/n)
z
[1] 3.023716
pval <- 2*(1 - pnorm(abs(z),0,1))
pval
[1] 0.002496909

The p-value tells us that we have a 0.2% chance of seeing a sample result that is that extreme in either direction if the null hypothesis is really true. Since the p-value is less than \(\alpha\), we reject the null hypothesis and conclude that there is sufficient evidence that there has been a change in the status quo.

It is required that the \(np_0 \ge 10\) and \(n(1-p_0) \ge 10\) which we can check in R that this requirement is satisfied.

n <- 1200
p0 <- 0.70
n*p0
[1] 840
n*(1-p0)
[1] 360