Multiple comparison correction methods.
Used to control family-wise error rate (FWER) or false discovery rate (FDR) when performing multiple statistical tests.
Functions
bonferroni_correction(p_values: np.ndarray, alpha: float=0.05) -> Tuple[np.ndarray, np.ndarray]
Bonferroni correction for multiple comparisons.
Most conservative method. Controls FWER.
Parameters
p_values
ndarray
Array of p-values from multiple tests.
alpha
float
Significance level.
Returns
adjusted_p
ndarray
Adjusted p-values.
reject
ndarray
Boolean array indicating which hypotheses to reject.
python
>>> from tuiml.evaluation.statistics import bonferroni_correction
>>> import numpy as np
>>> p_values = np.array([0.01, 0.04, 0.03, 0.005])
>>> adjusted, reject = bonferroni_correction(p_values, alpha=0.05)
holm_correction(p_values: np.ndarray, alpha: float=0.05) -> Tuple[np.ndarray, np.ndarray]
Holm-Bonferroni step-down correction.
Less conservative than Bonferroni while still controlling FWER.
Parameters
p_values
ndarray
Array of p-values.
alpha
float
Significance level.
Returns
adjusted_p
ndarray
Adjusted p-values.
reject
ndarray
Boolean array indicating which hypotheses to reject.
python
>>> from tuiml.evaluation.statistics import holm_correction
>>> import numpy as np
>>> p_values = np.array([0.01, 0.04, 0.03, 0.005])
>>> adjusted, reject = holm_correction(p_values, alpha=0.05)
hochberg_correction(p_values: np.ndarray, alpha: float=0.05) -> Tuple[np.ndarray, np.ndarray]
Hochberg step-up correction.
More powerful than Holm but requires independence assumption.
Parameters
p_values
ndarray
Array of p-values.
alpha
float
Significance level.
Returns
adjusted_p
ndarray
Adjusted p-values.
reject
ndarray
Boolean array indicating which hypotheses to reject.
hommel_correction(p_values: np.ndarray, alpha: float=0.05) -> Tuple[np.ndarray, np.ndarray]
Hommel correction.
Most powerful step-wise method that controls FWER.
Parameters
p_values
ndarray
Array of p-values.
alpha
float
Significance level.
Returns
adjusted_p
ndarray
Adjusted p-values.
reject
ndarray
Boolean array indicating which hypotheses to reject.
benjamini_hochberg(p_values: np.ndarray, alpha: float=0.05) -> Tuple[np.ndarray, np.ndarray]
Benjamini-Hochberg procedure for controlling False Discovery Rate (FDR).
Less conservative than FWER-controlling methods. Controls the expected proportion of false discoveries among rejected hypotheses.
Parameters
p_values
ndarray
Array of p-values.
alpha
float
Significance level (FDR level).
Returns
adjusted_p
ndarray
Adjusted p-values (q-values).
reject
ndarray
Boolean array indicating which hypotheses to reject.
python
>>> from tuiml.evaluation.statistics import benjamini_hochberg
>>> import numpy as np
>>> p_values = np.array([0.01, 0.04, 0.03, 0.005])
>>> adjusted, reject = benjamini_hochberg(p_values, alpha=0.05)