Skip to main content

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

Project description

sharp-q-values

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.0.tar.gz (6.5 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.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sharp_q_values-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 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.0.tar.gz
Algorithm Hash digest
SHA256 46d410a9fe72b0e4c9889912f8479a3ac7156cfcfc226ec766b287dc86e2b925
MD5 14405751314e0fc7d9e926526ec2b823
BLAKE2b-256 54762b77b0bf302d1c2fb9c5239ff4820fe5609f10fb79a34a22dceba4233b86

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sharp_q_values-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 887819a08ee7197500313c631603a63511af4bdfb3bc6d00e9f955847cc0045d
MD5 46ba802f88d9cb1a90115b137d1a14ec
BLAKE2b-256 a687a30acdc725d1481bf23c1945c33281f93e2186edad36b2c43b90162fe292

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