Upper Tail Test of Population Proportion
The null hypothesis of the upper tail test about population proportion can be expressed as follows:
where p0 is a hypothesized upper bound of the true population proportion p.
Let us define the test statistic z in terms of the sample proportion and the sample size:
Then the null hypothesis of the upper tail test is to be rejected if z ≥ zα , where zα is the 100(1 − α) percentile of the standard normal distribution.
Problem
Suppose that 12% of apples harvested in an orchard last year was rotten. 30 out of 214 apples in a harvest sample this year turns out to be rotten. At .05 significance level, can we reject the null hypothesis that the proportion of rotten apples in harvest stays below 12% this year?
Solution
The null hypothesis is that p ≤ 0.12. We begin with computing the test statistic.
> p0 = .12 # hypothesized value
> n = 214 # sample size
> z = (pbar−p0)/sqrt(p0∗(1−p0)/n)
> z # test statistic
[1] 0.90875
We then compute the critical value at .05 significance level.
Answer
The test statistic 0.90875 is not greater than the critical value of 1.6449. Hence, at .05 significance level, we do not reject the null hypothesis that the proportion of rotten apples in harvest stays below 12% this year.
Alternative Solution 1
Instead of using the critical value, we apply the pnorm function to compute the upper tail p-value of the test statistic. As it turns out to be greater than the .05 significance level, we do not reject the null hypothesis that p ≤ 0.12.
Alternative Solution 2
We apply the prop.test function to compute the p-value directly. The Yates continuity correction is disabled for pedagogical reasons.
1−sample proportions test without continuity
correction
data: 30 out of 214, null probability 0.12
X−squared = 0.8258, df = 1, p−value = 0.1817
alternative hypothesis: true p is greater than 0.12
95 percent confidence interval:
0.10563 1.00000
sample estimates:
p
0.14019