Proportion test in R
How to do a proportion test in R and what are the conditions that need to meet for the proportion test?
- The sampling method for each population is simple random sampling.
- The samples are independent.
- Each sample includes at least 10 successes and 10 failures.
- Each population is at least 20 times as big as its sample.
The proportions test is used to compare two observed proportions or single sample observations. This article describes the basics of proportions analysis in R.
KNN Algorithm Machine Learning » Classification & Regression »
Hypothesis:
In statistics, we can define the corresponding null hypothesis (H0) as follow:
- H0:pA=pB
- H0:pA≤pB
- H0:pA≥pB
The corresponding alternative hypotheses (Ha) are as follow:
- Ha:pA≠pB (different)
- Ha:pA>pB (greater)
- Ha:pA<pB (lesser)
1 is the two-tailed test and 2 & 3 are the one-tailed test.
R functions prop.test() can be used for calculating proportion significance.
The One-Sample Proportion Test is used to assess whether a population proportion (P1) is significantly different
from a hypothesized value (P0). This is called the hypothesis of inequality. The hypotheses may be stated in terms
of the proportions, their difference, their ratio, or their odds ratio, but all four hypotheses result in the same test statistics.
Decision Trees in R » Classification & Regression » finnstats
prop.test(x,n,p=NULL, alternative = "two.sided", correct = TRUE)
two-sided test
prop.test(x = c(490, 400), n = c(500, 500))
one-sided test
prop.test(x = c(400, 350), n = c(500, 500), alternative = "less")
or
prop.test(x = c(400, 350), n = c(500, 500), alternative = "greater")
Conclusion:
The p-value of the test is less than the significance level alpha = 0.05.
We can conclude that the proportion of samples is significantly different in the two groups with a p-value = 0.0001728.
Enjoyed this tutorial? Don’t forget to show your love, Please Subscribe the Newsletter and COMMENT below!
Naive Bayes Classification in R » Prediction Model »
Very nice