ci_p_mid_p | R Documentation |
This function calculates the mid-p confidence interval for a Binomial proportion. It is vectorized, allowing the evaluation of single values or vectors.
ci_p_mid_p(x, n, conf.level = 0.95)
x |
A number or a vector with the number of successes. |
n |
A number or a vector with the number of trials. |
conf.level |
confidence level for the returned confidence interval. By default is 0.95. |
The mid-p confidence interval adjusts the exact binomial interval by averaging the tail probabilities of the observed value. The limits are found by solving the following equations:
\sum_{j=0}^{x-1} P(X = j) + 0.5 \cdot P(X = x) = \alpha / 2
\sum_{j=x+1}^{n} P(X = j) + 0.5 \cdot P(X = x) = \alpha / 2
where P(X = j)
is the binomial probability.
A vector with the lower and upper limits of the confidence interval.
Rusvelt Jose Meza San MartÃn, rmezas@unal.edu.co
Berry, G., & Armitage, P. (1995). Mid-P confidence intervals: a brief review. Journal of the Royal Statistical Society Series D: The Statistician, 44(4), 417-423.
ci_p.
# Example with a single value
ci_p_mid_p(x = 5, n = 20, conf.level = 0.95)
# Example with vectors
x_values <- c(5, 10, 15)
n_values <- c(20, 30, 40)
ci_p_mid_p(x = x_values, n = n_values, conf.level = 0.95)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.