Computation of confidence intervals for binomial proportions and for difference of binomial proportions.
Reason this release was yanked:
computation of 1-sided confidence intervals of binomial proportions has bugs
Project description
Confidence Intervals for Difference of Binomial Proportions
Computation of confidence intervals for binomial proportions and for difference of binomial proportions.
Installation
Run
python -m pip install diff-binom-confint
or install the latest version in GitHub using
python -m pip install git+https://github.com/DeepPSP/DBCI.git
or git clone this repository and install locally via
cd DBCI
python -m pip install .
Usage examples
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
Click to view!
Method (type) | Implemented |
---|---|
wilson | :heavy_check_mark: |
wilson-cc | :heavy_check_mark: |
wald | :heavy_check_mark: |
wald-cc | :heavy_check_mark: |
agresti-coull | :heavy_check_mark: |
jeffreys | :heavy_check_mark: |
clopper-pearson | :heavy_check_mark: |
arcsine | :heavy_check_mark: |
logit | :heavy_check_mark: |
pratt | :heavy_check_mark: |
witting | :heavy_check_mark: |
mid-p | :heavy_check_mark: |
lik | :heavy_check_mark: |
blaker | :heavy_check_mark: |
modified-wilson | :heavy_check_mark: |
modified-jeffreys | :heavy_check_mark: |
Confidence intervals for difference of binomial proportions
Click to view!
Method (type) | Implemented |
---|---|
wilson | :heavy_check_mark: |
wilson-cc | :heavy_check_mark: |
wald | :heavy_check_mark: |
wald-cc | :heavy_check_mark: |
haldane | :heavy_check_mark: |
jeffreys-perks | :heavy_check_mark: |
mee | :heavy_check_mark: |
miettinen-nurminen | :heavy_check_mark: |
true-profile | :heavy_check_mark: |
hauck-anderson | :heavy_check_mark: |
agresti-caffo | :heavy_check_mark: |
brown-li | :heavy_check_mark: |
brown-li-jeffrey | :heavy_check_mark: |
miettinen-nurminen-brown-li | :heavy_check_mark: |
exact | :x: |
mid-p | :x: |
santner-snell | :x: |
chan-zhang | :x: |
agresti-min | :x: |
wang | :x: |
pradhan-banerjee | :x: |
References
NOTE
Reference 1 has errors in the description of the methods Wilson CC
, Mee
, Miettinen-Nurminen
.
The correct computation of Wilson CC
is given in Reference 5.
The correct computation of Mee
, Miettinen-Nurminen
are given in the code blocks in Reference 1
Test data
Test data are
-
taken from Reference 1 for automatic test of the correctness of the implementation of the algorithms.
-
generated using DescTools.StatsAndCIs via
library("DescTools") library("data.table") results = data.table() for (m in c("wilson", "wald", "waldcc", "agresti-coull", "jeffreys", "modified wilson", "wilsoncc","modified jeffreys", "clopper-pearson", "arcsine", "logit", "witting", "pratt", "midp", "lik", "blaker")){ ci = BinomCI(84,101,method = m) new_row = data.table("method" = m, "ratio"=ci[1], "lower_bound" = ci[2], "upper_bound" = ci[3]) results = rbindlist(list(results, new_row)) } fwrite(results, "./test/test-data/example-84-101.csv") # with manual slight adjustment of method names
The filenames has the following pattern:
# for computing confidence interval for difference of binomial proportions
"example-(?P<n_positive>[\\d]+)-(?P<n_total>[\\d]+)-vs-(?P<ref_positive>[\\d]+)-(?P<ref_total>[\\d]+)\\.csv"
# for computing confidence interval for binomial proportions
"example-(?P<n_positive>[\\d]+)-(?P<n_total>[\\d]+)\\.csv"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for diff_binom_confint-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d5a4ddf227fd5a7d3cf4913eef20e8023bc8daa3c0ee81f9418e600532b3667 |
|
MD5 | 1abe2198b9238c60f89d554360309f2e |
|
BLAKE2b-256 | a5e6c61a718f05445ba541185e6b94c91e2552e99d868a1c5c5571016fccd787 |