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?

  1. The sampling method for each population is simple random sampling.
  2. The samples are independent.
  3. Each sample includes at least 10 successes and 10 failures.
  4. 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:

  1. H0:pA=pB
  2. H0:pA≤pB
  3. H0:pA≥pB

The corresponding alternative hypotheses (Ha) are as follow:

  1. Ha:pA≠pB  (different)
  2. Ha:pA>pB  (greater)
  3. 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 »

You may also like...

1 Response

Leave a Reply

Your email address will not be published.

error

Subscribe Now