Open In App

Performing Binomial Test in R programming – binom.test() Method

With the help of binom.test() method, we can get the binomial test for some hypothesis of binomial distribution in R Programming.

Syntax: binom.test(x, n, p-value)



Return: Returns the value of binomial test.

Example 1:






# Using binom.test() method
  
gfg <- binom.test(58, 100)
  
print(gfg)

Output:

Exact binomial test

data:  58 and 100
number of successes = 58, number of trials = 100, p-value = 0.1332
alternative hypothesis: true probability of success is not equal to 0.5
95 percent confidence interval:
 0.4771192 0.6780145
sample estimates:
probability of success 
                  0.58 

Example 2:




# Using binom.test() method
  
gfg <- binom.test(1, 36, 0.6)
  
print(gfg)

Output:

Exact binomial test

data:  1 and 36
number of successes = 1, number of trials = 36, p-value = 2.597e-13
alternative hypothesis: true probability of success is not equal to 0.6
95 percent confidence interval:
 0.0007030252 0.1452892647
sample estimates:
probability of success 
            0.02777778 

Article Tags :