Skip to main content

sharp-q-values

Tests PyPI version Python versions License: MIT

Python implementation of the sharpened q-values described in Anderson 2008 [1] and BKY 2006 [2], based on Anderson's STATA code [3].

The Benjamini–Hochberg procedure controls the false discovery rate in multiple hypothesis testing. BKY created a more powerful "adaptive" version by estimating the number of true nulls in a first stage [2]. See [1] and [2] for details.

Installation

pip install sharp-q-values

Usage

The package has one function: Call compute_q with a list or array of p-values and returns an array of sharpened q-values in the same order as the input. The default step size is 0.001 to match Anderson's STATA code.

import numpy as np
from sharp_q_values import compute_q

p_values = np.array([0.01, 0.04, 0.03, 0.20, 0.15])
q_values = compute_q(p_values)
# returns the corresponding sharpened q-values for the input p-values

# optionally change the step size
q_values2 = compute_q(pvals=p_values, step=0.0001)

Tests

Validated against Anderson's STATA implementation [3] across multiple p-value sets, with results within a floating-point tolerance of 1e-10 (Python 3.13, NumPy 2.3.1, STATA 14).

pytest tests/

References

[1] Anderson, M. L. (2008). Multiple inference and gender differences in the effects of early intervention: A reevaluation of the Abecedarian, Perry Preschool, and Early Training Projects. Journal of the American Statistical Association, 103(484), 1481–1495.

[2] Benjamini, Y., Krieger, A. M., & Yekutieli, D. (2006). Adaptive linear step-up procedures that control the false discovery rate. Biometrika, 93(3), 491–507.

[3] https://github.com/BITSS/IDBMarch2018/blob/master/4-MultipleTesting/fdr_sharpened_qvalues.do

Metadata

Release files for sharp-q-values 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sharp-q-values 0.1.1
File Size Uploaded
sharp_q_values-0.1.1.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sharp-q-values 0.1.1
File Interpreter ABI Platform
sharp_q_values-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 kB

Release files / sharp_q_values-0.1.1.tar.gz

Download URL sharp_q_values-0.1.1.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5419156fdb72dc55d6c4bf9d4c268b1f0d57145039754ab62dce0c1f09413e94
BLAKE2b-256 checksum
How to use checksums
da7bec86c6691d09ab8450670af446bd8275b09237df1154b72ccf0d9c20dfd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / sharp_q_values-0.1.1-py3-none-any.whl

Download URL sharp_q_values-0.1.1-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
24167848426dc7b2d67058a03082554a699d0e61fbd90392946125fcb57d536f
BLAKE2b-256 checksum
How to use checksums
9c7139ad2ed3763efb48ea2692c8fdc7499619075e46fb0bb2ab5d9dbd95ade5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page