E-Value Methods¶
Procedures¶
online_fdr.e_values.batch.EBH ¶
Bases: StatefulMethodMixin
Batch FDR control with e-values via e-Benjamini-Hochberg.
References
Wang, R. and Ramdas, A. (2022). False discovery rate control with e-values. Journal of the Royal Statistical Society: Series B. Author code: https://github.com/ruoduwang/e-BH
Source code in online_fdr/e_values/batch.py
Functions¶
test_batch(e_values) ¶
test_batch_detail(e_values) ¶
Test one batch of e-values and return immutable decision details.
Source code in online_fdr/e_values/batch.py
online_fdr.e_values.batch.e_bh(e_values, alpha) ¶
Apply the base e-BH procedure to a fixed batch of e-values.
The procedure rejects the largest k e-values, where k is the largest index satisfying e_(k) >= m / (alpha * k) after sorting descending. Ties are broken stably by original input order.
This is the base e-BH procedure of Wang and Ramdas (2022), which controls FDR under arbitrary dependence for valid e-values.
Source code in online_fdr/e_values/batch.py
online_fdr.e_values.sequential.ELond ¶
Bases: StatefulMethodMixin
Online FDR control for e-values with e-LOND.
e-LOND uses the same test levels as p-value LOND but rejects when the incoming e-value exceeds the reciprocal test level. Valid e-values give FDR control under arbitrary dependence.
References
Xu, Z. and Ramdas, A. (2024). Online multiple testing with e-values. Proceedings of AISTATS 2024. Author code: https://github.com/neilzxu/evalue-omt
Source code in online_fdr/e_values/sequential.py
Functions¶
test_one(e_value) ¶
test_one_detail(e_value) ¶
Test a single e-value and return immutable decision details.
Source code in online_fdr/e_values/sequential.py
Toolbox¶
online_fdr.e_values.toolbox.e_to_p(e_value) ¶
Convert an e-value to the conservative p-value min(1, 1 / e).
Source code in online_fdr/e_values/toolbox.py
online_fdr.e_values.toolbox.p_to_e_power(p_value, exponent) ¶
Calibrate a p-value into an e-value with k * p ** (k - 1).
The exponent must be in (0, 1). The calibrator integrates to one on [0, 1] and is decreasing, so applying it to a valid p-value yields an e-value. This is the power calibrator from Vovk and Wang (2021).
Source code in online_fdr/e_values/toolbox.py
online_fdr.e_values.toolbox.make_power_calibrator(exponent) ¶
Return the power p-to-e calibrator for a fixed exponent.
Source code in online_fdr/e_values/toolbox.py
online_fdr.e_values.toolbox.weighted_arithmetic_mean(e_values, weights=None) ¶
Merge e-values by weighted arithmetic mean.
This is valid for arbitrary dependence when all inputs are valid e-values and weights are fixed independently of the null evidence, as in the averaging rule of Vovk and Wang (2021).
Source code in online_fdr/e_values/toolbox.py
online_fdr.e_values.toolbox.mixture_e_value(e_values, weights=None) ¶
Alias for weighted arithmetic e-value merging.
online_fdr.e_values.toolbox.log_product_e_values(e_values) ¶
Return the log product of e-values.
Products are valid under independence or suitable conditional/sequential validity assumptions supplied by the caller.
Source code in online_fdr/e_values/toolbox.py
online_fdr.e_values.toolbox.product_e_values(e_values) ¶
Return the product of e-values in ordinary scale.
Source code in online_fdr/e_values/toolbox.py
online_fdr.e_values.toolbox.max_e_value(e_values) ¶
Conservative max merge, max(e_values) / len(e_values).
The scaling is deliberate: the raw maximum is not generally an e-value under arbitrary dependence.
Source code in online_fdr/e_values/toolbox.py
online_fdr.e_values.toolbox.check_e_value(e_value) ¶
Validate that an e-value is numeric and nonnegative.
Infinite e-values are allowed because they can arise from exact-zero calibrated p-values or likelihood ratios with zero null density.
Source code in online_fdr/core/utils/validity.py
online_fdr.e_values.toolbox.check_e_values(e_values) ¶
Validate a sequence of e-values.
Source code in online_fdr/core/utils/validity.py
online_fdr.e_values.toolbox.check_calibrator(calibrator, *, grid_size=10000, tolerance=0.001) ¶
Numerically check basic p-to-e calibrator conditions.
This helper cannot prove validity for arbitrary functions. It checks the practical conditions used by this package: nonnegative, nonincreasing values on a midpoint grid and approximate integral at most one.
Source code in online_fdr/core/utils/validity.py
online_fdr.e_values.toolbox.check_nonnegative_weights(weights) ¶
Validate that weights are finite, nonnegative, and not all zero.
Source code in online_fdr/core/utils/validity.py
E-Processes¶
online_fdr.e_values.processes.EProcess ¶
Bases: Protocol
Protocol for anytime-valid e-processes.
Source code in online_fdr/e_values/processes.py
online_fdr.e_values.processes.LikelihoodRatioEProcess ¶
Log-space likelihood-ratio e-process.
log_likelihood_ratio must return log f_alt(x) / f_null(x) for each observation. The caller is responsible for the model assumptions that make this an e-process under the null.
Source code in online_fdr/e_values/processes.py
online_fdr.e_values.processes.MixtureLikelihoodRatioEProcess ¶
Fixed-prior mixture of likelihood-ratio e-processes.
Each component accumulates its own likelihood-ratio process over time. The reported value is the weighted arithmetic mixture of those cumulative component processes, not a product of per-observation mixture likelihoods. The caller is responsible for the null and alternative model assumptions.
Source code in online_fdr/e_values/processes.py
online_fdr.e_values.processes.BettingEProcess ¶
Simple betting e-process from multiplicative betting factors.
For each score, the factor is 1 + stake * score. The caller is responsible for using scores and predictable stakes that make the factor conditionally expectation-bounded by one under the null.
Source code in online_fdr/e_values/processes.py
online_fdr.e_values.processes.value_at_stop(process) ¶
online_fdr.e_values.processes.stop(process) ¶
Generation¶
online_fdr.e_values.generation.GaussianEValueGenerator ¶
Generate labeled Gaussian likelihood-ratio e-values.
Source code in online_fdr/e_values/generation.py
Attributes¶
remaining property ¶
Number of samples remaining.
Functions¶
sample_one() ¶
Sample one (e_value, is_alternative) pair.
Source code in online_fdr/e_values/generation.py
sample_batch(size=None) ¶
Sample a batch of e-values and labels.
Source code in online_fdr/e_values/generation.py
online_fdr.e_values.generation.gaussian_likelihood_ratio_e_value(sample, alt_mean, *, null_mean=0.0, std=1.0) ¶
Likelihood-ratio e-value for normal means with known common variance.
Source code in online_fdr/e_values/generation.py
online_fdr.e_values.generation.gaussian_likelihood_ratio_e_values(samples, alt_mean, *, null_mean=0.0, std=1.0) ¶
Vectorized Gaussian likelihood-ratio e-values.
Source code in online_fdr/e_values/generation.py
online_fdr.e_values.generation.calibrated_p_value_stream(p_values, exponent) ¶
Convert p-values to e-values with the power calibrator.