Welcome to DBCI’s documentation!#

A package for computing confidence intervals for binomial proportions, and confidence intervals for the difference of binomial proportions.

Installation instructions#

The package can be installed via PyPI using

python -m pip install diff-binom-confint

or one can install the latest version on GitHub using

python -m pip install git+https://github.com/DeepPSP/DBCI.git

or clone this repository and install locally via

git clone https://github.com/DeepPSP/DBCI.git
cd DBCI
python -m pip install .

Numba accelerated version#

One can install the Numba accelerated version of the package using

python -m pip install diff-binom-confint[acc]

Streamlit app#

One can also use the Streamlit app to compute confidence intervals for binomial proportions, and even upload a categorized table of data to obtain a report of risk report for binomial confidence intervals.

Usage examples#

The following example shows how to compute the confidence interval for the difference of two binomial proportions using the Wilson method.

from diff_binom_confint import compute_difference_confidence_interval

n_positive, n_total = 84, 101
ref_positive, ref_total = 89, 105

confint = compute_difference_confidence_interval(
    n_positive,
    n_total,
    ref_positive,
    ref_total,
    conf_level=0.95,
    method="wilson",
)

Implemented methods#

Confidence intervals for binomial proportions#

We list the implemented methods for confidence intervals for binomial proportions in the following table.

Method (type)

Implemented

wilson

✔️

wilson-cc

✔️

wald

✔️

wald-cc

✔️

agresti-coull

✔️

jeffreys

✔️

clopper-pearson

✔️

arcsine

✔️

logit

✔️

pratt

✔️

witting

✔️

mid-p

✔️

lik

✔️

blaker

✔️

modified-wilson

✔️

modified-jeffreys

✔️

Confidence intervals for difference of binomial proportions#

The following is the table of implemented methods for computing confidence intervals for the difference of binomial proportions.

Method (type)

Implemented

wilson

✔️

wilson-cc

✔️

wald

✔️

wald-cc

✔️

haldane

✔️

jeffreys-perks

✔️

mee

✔️

miettinen-nurminen

✔️

true-profile

✔️

hauck-anderson

✔️

agresti-caffo

✔️

carlin-louis

✔️

brown-li

✔️

brown-li-jeffrey

✔️

miettinen-nurminen-brown-li

✔️

exact

mid-p

santner-snell

chan-zhang

agresti-min

wang

pradhan-banerjee

API reference

References#

  1. SAS

  2. PASS

  3. statsmodels.stats.proportion

  4. scipy.stats._binomtest

  5. corplingstats

  6. DescTools.StatsAndCIs

Indices and tables#