A Python package for statistical p-value corrections
Project description
P-value Corrections
A Python package for statistical p-value corrections including Bonferroni and Benjamini-Hochberg corrections.
Features
- Bonferroni Correction: Controls family-wise error rate (FWER)
- Benjamini-Hochberg Correction: Controls false discovery rate (FDR)
- Python API: Simple programmatic interface
Installation
From Source
git clone https://github.com/Chris-R030307/Pvalue_correction.git
cd pval-corrections
pip install -e .
Development Installation
git clone https://github.com/Chris-R030307/Pvalue_correction.git
cd pval-corrections
pip install -e ".[dev]"
Usage
Python API
from pval_corrections import correction
# Example p-values
p_values = [0.01, 0.02, 0.03, 0.04, 0.05]
# Bonferroni correction
bonferroni_result = correction(p_values, 'bonferroni')
print("Bonferroni adjusted p-values:", bonferroni_result['padj'])
# Benjamini-Hochberg correction
bh_result = correction(p_values, 'benjamini_hochberg')
print("BH adjusted p-values:", bh_result['padj'])
Methods
Bonferroni Correction
The Bonferroni correction controls the family-wise error rate (FWER) by multiplying each p-value by the number of tests:
p_adj = p * m
Where m is the number of tests.
Benjamini-Hochberg Correction
The Benjamini-Hochberg correction controls the false discovery rate (FDR) using a step-up procedure:
p_adj = p * m / i
Where m is the number of tests and i is the rank of the p-value.
Requirements
- Python >= 3.8
- pandas >= 2.1.3
- numpy >= 2.1.3
- matplotlib >= 3.10.0
- seaborn >= 0.13.2
- scipy >= 1.13.0
- scikit-learn >= 1.3.0
- statsmodels >= 0.14.0
Development
Running Tests
pytest
Code Formatting
black pval_corrections/
Type Checking
mypy pval_corrections/
License
MIT License - see LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
Citation
If you use this package in your research, please cite:
@software{pval_corrections,
title={P-value Corrections},
author={Chris-R030307},
year={2024},
url={https://github.com/Chris-R030307/Pvalue_correction}
}
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pval_corrections-0.1.0.tar.gz.
File metadata
- Download URL: pval_corrections-0.1.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
057e12f085e98f415e4bc8dc8fbc6071e57ca9ef42b4a5f55f69076d1ac9cd6a
|
|
| MD5 |
77eb9325b034ffa97a77cc0b9e84eb3a
|
|
| BLAKE2b-256 |
cd097dbc1988eeb75d25ca6f47ef101e8fe94f85fd73b590196f8fd6e3c65043
|
File details
Details for the file pval_corrections-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pval_corrections-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d3e6d9489f0e549358fc3c05426628c091924f00d15505ef2f138ba584ed921
|
|
| MD5 |
c9e2e2c5b700e0601247c17b76e863d9
|
|
| BLAKE2b-256 |
738aa3acdd39e8bc1b4552072166352b3bf5c135f72782a2c8a3f472f11c0703
|