binom.midp {binomSamSize}R Documentation

Calculate mid-p confidence interval for binomial proportion

Description

Calculate mid-p confidence interval for the the binomial proportion based on one observation from the binomial distribution

Usage

binom.midp(x, n, conf.level=0.95)

Arguments

x

Vector of number of successes in the binomial experiment.

n

Vector of number of independent trials in the binomial experiment.

conf.level

The level of confidence to be used in the confidence interval

Details

The function uses uniroot to determine the upper and lower bounds of the mid-p confidence interval.

The lower bound p_l is found as the solution to the equation

\frac{1}{2} f(x;n,p_l) + (1-F(x;m,p_l)) = \frac{α}{2}

where f(x;n,p) denotes the probability mass function (pmf) and F(x;n,p) the (cumulative) distribution function of the binomial distribution with size n and proportion p evaluated at x. In case x=0 then the lower bound is zero.

The upper bound p_u is found as the solution to the equation

\frac{1}{2} f(x;n,p_u) + F(x-1;m,p_u) = \frac{α}{2}

In case x=n then the upper bound is 1.

Value

A data.frame containing the observed proportions and the lower and upper bounds of the confidence interval. The style is similar to the binom.confint function of the binom package

Author(s)

M. Höhle

References

S. E. Vollset (1993), Confidence intervals for a binomial proportion, Statistics in Medicine, 12, 809–824

Fosage, G.T. (2005) Modified exact sample size for a binomial proportion with special emphasis on diagnostic test parameter estimation, Statistics in Medicine 24(18):2857-66.

A. Agresti and A. Gottard (2005), Comment: Randomized Confidence Intervals and the Mid-P Approach, Statistical Science, 20(4):367–371

Examples

binom.midp(x=0:10,n=10)
binom.midp(x=0:5,n=5,conf.level=0.9)

[Package binomSamSize version 0.1-5 Index]