Search code examples
pythonrstatisticsrpy2

Coverage of the 99% Confidence Interval of a Binomial Proportion


I have an rpy2 script that gives me the coverage of the 95% confidence interval:

from rpy2.robjects.packages import importr
binom = importr('binom')
from rpy2 import robjects

robjects.r('''library(binom)
p = seq(0,1,.01)
coverage = binom.coverage(p, 10, method="bayes", type = "central")$coverage
''')

I'd like to get the coverage of the 99% confidence interval please


Solution

  • Maybe this way?

    robjects.r('''library(binom)
    p = seq(0,1,.01)
    coverage = binom.coverage(p, 10, conf.level = 0.99, 
    method="bayes", type = "central")$coverage
    ''')
    

    See documentation.