Skip to main content

Sharpened two-stage FDR q-values (BKY 2006 / Anderson 2008)

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sharp_q_values-0.1.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sharp_q_values-0.1.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file sharp_q_values-0.1.1.tar.gz.

File metadata

  • Download URL: sharp_q_values-0.1.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sharp_q_values-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5419156fdb72dc55d6c4bf9d4c268b1f0d57145039754ab62dce0c1f09413e94
MD5 cc43d0c0f44109ba7253f9fdbb905cb7
BLAKE2b-256 da7bec86c6691d09ab8450670af446bd8275b09237df1154b72ccf0d9c20dfd1

See more details on using hashes here.

File details

Details for the file sharp_q_values-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sharp_q_values-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sharp_q_values-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 24167848426dc7b2d67058a03082554a699d0e61fbd90392946125fcb57d536f
MD5 ac73762a19c4907895c96bc683e25995
BLAKE2b-256 9c7139ad2ed3763efb48ea2692c8fdc7499619075e46fb0bb2ab5d9dbd95ade5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page