There are two ways to perform a test of proportion;- Critical value Approach
There are two ways to perform a test of proportion;-
Critical value Approach
-
- State the null hypothesis H0 and the alternative hypothesis HA.
- Calculate the test statistic:
-
- where p0 is the null hypothesized proportion i.e. when H0:p=p0
- Determine the critical region.
- And lastly, determine if the test statistic falls in the critical region. As, If it does fall in it, reject the null hypothesis. If it does not, do not reject the null hypothesis.
p-value Approach
-
- State the null hypothesis H0 and the alternative hypothesis HA.
- Set the level of significance α
- Calculate the test statistic:
- Calculate the p-value.
- Decide by checking whether to reject the null hypothesis by comparing p-value to α. Also, If the p-value < α then reject H0; otherwise do not reject.
What is a one-proportion Z-test?
This test is performed to compare an observed proportion to a theoretical one when there are only two categories. Based on the sample size, normal approximation or binomial enumeration is done. If the sample size is large, the normal approximation provides an accurate result. If the sample size is less, then binomial enumeration gives the correct results. The binomial enumeration and normal approximation can be approximated when both mean (np) and variance( n(1-p)) values are greater than 10.
Compute one proportion z-test in R
R functions: binom.test() & prop.test()
- The R functions binom.test() and prop.test() can be used to perform one-proportion test:
- binom.test(): compute exact binomial test. Recommended when the sample size is small
- prop.test(): can be used when the sample size is large ( N > 30). It uses a normal approximation to binomial
The syntax of the two functions are the same. The simplified format is as follow:
binom.test(x, n, p = 0.5, alternative = “two.sided”)
prop.test(x, n, p = NULL, alternative = “two.sided”,
correct = TRUE)
-
- x: the number of successes
- n: the total number of trials
- p: the probability to test against.
- correct: a logical indicating whether Yates’ continuity correction should be applied where possible.