Description Usage Arguments Details Value Author(s) References Examples
Calculate mid-p confidence interval for the the binomial proportion based on one observation from the binomial distribution
1 | binom.midp(x, n, conf.level=0.95)
|
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 |
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.
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
M. H<f6>hle
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
1 2 | binom.midp(x=0:10,n=10)
binom.midp(x=0:5,n=5,conf.level=0.9)
|
Loading required package: binom
method x n mean lower upper
1 midp 0 10 0.0 0.000000000 0.2588620
2 midp 1 10 0.1 0.005001757 0.4034747
3 midp 2 10 0.2 0.034982476 0.5194848
4 midp 3 10 0.3 0.082626119 0.6199217
5 midp 4 10 0.4 0.142291370 0.7088382
6 midp 5 10 0.5 0.212008566 0.7879914
7 midp 6 10 0.6 0.291161788 0.8577086
8 midp 7 10 0.7 0.380078280 0.9173739
9 midp 8 10 0.8 0.480515200 0.9650175
10 midp 9 10 0.9 0.596525278 0.9949982
11 midp 10 10 1.0 0.741137963 1.0000000
method x n mean lower upper
1 midp 0 5 0.0 0.00000000 0.3690451
2 midp 1 5 0.2 0.02001793 0.5969908
3 midp 2 5 0.4 0.10573077 0.7656125
4 midp 3 5 0.6 0.23438755 0.8942692
5 midp 4 5 0.8 0.40300920 0.9799821
6 midp 5 5 1.0 0.63095487 1.0000000
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.