Skip to contents

Calculates the Clopper-Pearson interval by calling stats::binom.test(). Also referred to as the exact method.

Usage

ci_prop_clopper_pearson(x, conf.level = 0.95, data = NULL)

Arguments

x

(binary/numeric/logical)
vector of a binary values, i.e. a logical vector, or numeric with values c(0, 1)

conf.level

(scalar numeric)
a scalar in (0,1) indicating the confidence level. Default is 0.95

data

(data.frame)
Optional data frame containing the variables specified in x and by.

Details

$$ \left( \frac{k}{n} \pm z_{\alpha/2} \sqrt{\frac{\frac{k}{n}(1-\frac{k}{n})}{n} + \frac{z^2_{\alpha/2}}{4n^2}} \right) / \left( 1 + \frac{z^2_{\alpha/2}}{n} \right)$$