TwoSamplesBinomial: Two-sample testing for counts data
Usually in the context of a multiple testing approach to compare two or more frequency tables. Combine with multiple-hypothesis-testing to
obtain a global test for the significance of the difference between the
tables.
References:
- [1] D. L. Donoho and A. Kipnis. (2022) Higher criticism to compare two large frequency tables, with sensitivity to possible rare and weak differences. Annals of Statistics.
- [2] C. B. Dean. (1992) Testing for Overdispersion in Poisson and Binomial Regression Models. Journal of the American Statistical Association
Methods:
bin_allocation_test(the test from [1])bin_variance_test(test from [2])bin_variance_test_dfthe same asbin_variance_testplus additional information
Additional auxiliary function of independent interest:
poisson_testVectorized one-sided Poisson test with an option to do a randomized testbinom_testVectorized one-sided binomial test with an option to do a randomized testbinom_test_two_sidedVectorized Two-sided binomial test with an option to do a randomized testbinom_test_two_sided_slowVectorized two-sided binomial test using scipy.stats.binom_test
Example:
from twosample import bin_allocation_test, bin_variance_test
from multitest import MultiTest
import numpy as np
N = 100
n = 500
eps = 0.1
mu = 0.01
P = np.ones(N) / N
Q = P.copy()
Q[np.random.rand(N) < eps] += mu
Q = Q / Q.sum()
smp1 = np.random.multinomial(n, P) # sample form P
smp2 = np.random.multinomial(n, Q) # sample from Q
pvals_alloc = bin_allocation_test(smp1, smp2) # binomial P-values
pvals_var = bin_variance_test(smp1, smp2) # binomial P-values
mt_alloc = MultiTest(pvals_alloc)
mt_var = MultiTest(pvals_var)
print("HC(binomial_allocation) = ", mt_alloc.hc()[0])
print("HC(varaince) = ", mt_var.hc()[0])
Metadata
Release files for two-sample-binomial 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| two-sample-binomial-0.0.4.tar.gz | 5.3 kB | Without provenance | Details for two-sample-binomial-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| two_sample_binomial-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for two_sample_binomial-0.0.4-py3-none-any.whl |
Total release size: 10.9 kB
Release files / two-sample-binomial-0.0.4.tar.gz
| Download URL | two-sample-binomial-0.0.4.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3de158e7806cf5a7cd2cbb619bcdf8ae91781c3dfeb9796fcd901e20c12210f2
|
|
BLAKE2b-256 checksum How to use checksums |
f72f97bc0c770f57710d0c969da351c37557dfad4692921abb34b0a339463d7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|
Release files / two_sample_binomial-0.0.4-py3-none-any.whl
| Download URL | two_sample_binomial-0.0.4-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
703c023fcd78cb99753fb696a3157665de37863551e131ef6b123e2772e2f5dc
|
|
BLAKE2b-256 checksum How to use checksums |
6428f855f8d0163ad20a7b0a6cd28d2426a0aeaceeaeb41d1de28483eed9a505
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|
Security for two-sample-binomial 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.