Use the binconf() function

binconf() function is available in the Hmisc package. To install this package run the following commands:

install.packages("Hmisc")

Syntax of binconf(): 

Syntax: binconf(x, n, alpha)

where

  • x is the input variable
  • n is the sample size
  • alpha is the binomial confidence level

R




# load the library
library(Hmisc)
 
# calculate for 34 with 95%confidence level
print(binconf(x=34, n=100,
              alpha=.05))


Output:

 PointEst     Lower     Upper
     0.34 0.2546152 0.4372227

How to Calculate a Binomial Confidence Interval in R?

In this article, we will discuss how to calculate a Binomial Confidence interval in R Programming Language. We can calculate Binomial Confidence Interval by using the below formulae:

p  +/-  z*(√p(1-p) / n)

where,

  • p is for the  proportion of successes
  • z is  the chosen value
  • n is the  sample size

We can calculate by using the below methods

Similar Reads

Method 1: Use the prop.test() function

This function is used to calculate the 95% binomial confidence interval....

Method 2: Use the binconf() function

...

Method 3: Calculate the Confidence Interval with Formulae

binconf() function is available in the Hmisc package. To install this package run the following commands:...