clopper.pearson.ci: Clopper-Pearson Confidence Interval

View source: R/clopper.pearson.ci.R

clopper.pearson.ciR Documentation

Clopper-Pearson Confidence Interval

Description

Computing upper, lower or two-sided Clopper-Pearson confidence limits for a given confidence level.

Usage

clopper.pearson.ci(k, n, alpha = 0.1, CI = "upper")

Arguments

k

number of failures/successes.

n

number of trials.

alpha

significance level for the (1-\alpha)\cdot 100% confidence level (default \alpha=0.1).

CI

indicates the kind of the confidence interval, options: "upper" (default), "lower", "two.sided".

Details

Computes the confidence limits for the p of a binomial distribution. Confidence intervals are obtained by the definition of Clopper and Pearson. The two-sided interval for k=0 is (0,1-(\alpha/2)^{1/n}), for k=n it is ((\alpha/2)^{1/n},1).

Value

A data frame containing the kind of the confidence interval, upper and lower limits and the used significance level alpha.

References

D.Kurz, H.Lewitschnig, J.Pilz, Decision-Theoretical Model for Failures which are Tackled by Countermeasures, IEEE Transactions on Reliability, Vol. 63, No. 2, June 2014.

Thulin, Mans, The cost of using exact confidence intervals for a binomial proportion, Electronic Journal of Statistics, vol. 8, pp. 817-840, 2014.

C.J.Clopper and E.S. Pearson, The use of confidence or fiducial limits illustrated in the case of the binomial, Biometrika, vol. 26, pp. 404-413, 1934.

Examples

clopper.pearson.ci(5,100000,alpha=0.05)
# Confidence.Interval = upper
# Lower.limit = 0
# Upper.limit = 0.0001051275
# alpha = 0.05

clopper.pearson.ci(5,100000,CI="two.sided")
# Confidence.Interval =  two.sided
# Lower.limit = 1.97017e-05
# Upper.limit = 0.0001051275
# alpha = 0.1

GenBinomApps documentation built on May 29, 2024, 9:35 a.m.