OpenMS
Loading...
Searching...
No Matches
MultipleTesting Struct Reference

Statistical functions for multiple testing correction. More...

#include <OpenMS/MATH/STATISTICS/MultipleTesting.h>

Public Types

enum class  Pi0Method { Smoother , Bootstrap }
 Method for estimating proportion of true null hypotheses (pi0) More...
 
enum class  LfdrTransform { Probit , Logit }
 Transformation for local FDR estimation. More...
 

Static Public Member Functions

static std::string pi0MethodToString (Pi0Method m)
 Convert Pi0Method enum to string representation.
 
static Pi0Method toPi0Method (const std::string &s)
 Convert string to Pi0Method enum (throws if invalid)
 
static std::string lfdrTransformToString (LfdrTransform t)
 Convert LfdrTransform enum to string representation.
 
static LfdrTransform toLfdrTransform (const std::string &s)
 Convert string to LfdrTransform enum (throws if invalid)
 
static std::vector< double > qValue (const std::vector< double > &p_values, double pi0, bool pfdr=false)
 Calculate q-values (FDR-adjusted p-values) for multiple testing correction.
 
static Pi0Result pi0Est (const std::vector< double > &p_values, const std::vector< double > &lambda_=std::vector< double >(), Pi0Method method=Pi0Method::Smoother, int smooth_df=3, bool smooth_log_pi0=false)
 Estimate the proportion of true null hypotheses (pi0).
 
static std::vector< double > lfdr (const std::vector< double > &p_values, double pi0, bool trunc=true, bool monotone=true, LfdrTransform transf=LfdrTransform::Probit, double adj=1.5, double eps=1e-8, std::size_t gridsize=512, double cut=3.0)
 Estimate local false discovery rate (local FDR) from p-values.
 
static std::vector< double > pNorm (const std::vector< double > &stat, const std::vector< double > &stat0)
 Compute tail probabilities under a fitted normal distribution.
 
template<class T >
static std::vector< double > computeModelFDR (const std::vector< T > &data_in)
 Compute model-based FDR estimates from posterior error probabilities.
 
template<class T >
static std::vector< double > pEmp (const std::vector< T > &stat, const std::vector< T > &stat0)
 Compute empirical p-values from test statistics and null distribution.
 

Detailed Description

Statistical functions for multiple testing correction.

Provides FDR estimation, q-value calculation, and local FDR computation based on the Storey-Tibshirani method. This struct contains static methods and enum classes for the various multiple testing correction procedures.

References:

  • Storey JD and Tibshirani R. (2003) "Statistical significance for genome-wide experiments." PNAS 100: 9440-9445. doi: 10.1073/pnas.1530509100
  • Storey JD. (2002) "A direct approach to false discovery rates." J. R. Statist. Soc. B. 64(3): 479-498. doi: 10.1111/1467-9868.00346

Member Enumeration Documentation

◆ LfdrTransform

enum class LfdrTransform
strong

Transformation for local FDR estimation.

Enumerator
Probit 

Inverse normal (Gaussian) transformation (default)

Logit 

Log-odds transformation.

◆ Pi0Method

enum class Pi0Method
strong

Method for estimating proportion of true null hypotheses (pi0)

Enumerator
Smoother 

Spline smoothing method (default)

Bootstrap 

Bootstrap resampling method.

Member Function Documentation

◆ computeModelFDR()

template<class T >
std::vector< double > computeModelFDR ( const std::vector< T > &  data_in)
inlinestatic

Compute model-based FDR estimates from posterior error probabilities.

Parameters
data_inVector of posterior error probabilities (PEPs)
Returns
Vector of FDR estimates

References RankData::Max, and RankData::Propagate.

Referenced by OpenMS::Math::computeModelFDR().

◆ lfdr()

static std::vector< double > lfdr ( const std::vector< double > &  p_values,
double  pi0,
bool  trunc = true,
bool  monotone = true,
LfdrTransform  transf = LfdrTransform::Probit,
double  adj = 1.5,
double  eps = 1e-8,
std::size_t  gridsize = 512,
double  cut = 3.0 
)
static

Estimate local false discovery rate (local FDR) from p-values.

Parameters
p_valuesVector of p-values from hypothesis tests
pi0Estimated proportion of true null hypotheses
truncIf true, truncate lfdr values to [0,1] range (default true)
monotoneIf true, enforce monotonicity constraint (default true)
transfTransformation to apply: Probit (default) or Logit
adjBandwidth adjustment factor (default 1.5)
epsSmall constant to avoid division by zero (default 1e-8)
gridsizeNumber of FFT grid points for KDE (default 512)
cutGrid extension factor in units of bandwidth (default 3.0)
Returns
Vector of local FDR values

◆ lfdrTransformToString()

static std::string lfdrTransformToString ( LfdrTransform  t)
static

Convert LfdrTransform enum to string representation.

◆ pEmp()

template<class T >
std::vector< double > pEmp ( const std::vector< T > &  stat,
const std::vector< T > &  stat0 
)
inlinestatic

Compute empirical p-values from test statistics and null distribution.

Parameters
statVector of observed test statistics
stat0Vector of null test statistics
Returns
Vector of empirical p-values

References RankData::Average, and RankData::Propagate.

Referenced by OpenMS::Math::pEmp().

◆ pi0Est()

static Pi0Result pi0Est ( const std::vector< double > &  p_values,
const std::vector< double > &  lambda_ = std::vector< double >(),
Pi0Method  method = Pi0Method::Smoother,
int  smooth_df = 3,
bool  smooth_log_pi0 = false 
)
static

Estimate the proportion of true null hypotheses (pi0).

Parameters
p_valuesVector of p-values from hypothesis tests (range [0,1])
lambda_Vector of lambda threshold values for estimation. If empty, defaults to seq(0.05, 0.95, 0.05).
methodMethod for pi0 estimation: Smoother (default) or Bootstrap
smooth_dfDegrees of freedom for smoothing spline (default: 3)
smooth_log_pi0If true, perform smoothing in log-space (default: false)
Returns
Pi0Result structure with estimation results

◆ pi0MethodToString()

static std::string pi0MethodToString ( Pi0Method  m)
static

Convert Pi0Method enum to string representation.

◆ pNorm()

static std::vector< double > pNorm ( const std::vector< double > &  stat,
const std::vector< double > &  stat0 
)
static

Compute tail probabilities under a fitted normal distribution.

Parameters
statVector of test statistics
stat0Vector of null statistics used to estimate N(mu, sigma^2)
Returns
Vector of upper tail probabilities (p-values)

References OpenMS::Math::computeModelFDR(), and OpenMS::Math::pEmp().

Referenced by OpenMS::Math::pNorm().

◆ qValue()

static std::vector< double > qValue ( const std::vector< double > &  p_values,
double  pi0,
bool  pfdr = false 
)
static

Calculate q-values (FDR-adjusted p-values) for multiple testing correction.

Converts p-values to q-values using the Storey-Tibshirani method. A q-value is the minimum FDR at which a test is called significant.

Parameters
p_valuesVector of p-values to be adjusted (must be in range [0,1])
pi0Proportion of true null hypotheses (typically estimated by pi0Est())
pfdrIf true, compute positive FDR; if false (default), compute regular FDR
Returns
Vector of q-values corresponding to input p-values. NaN values are propagated.

Referenced by OpenMS::Math::qValue().

◆ toLfdrTransform()

static LfdrTransform toLfdrTransform ( const std::string &  s)
static

Convert string to LfdrTransform enum (throws if invalid)

◆ toPi0Method()

static Pi0Method toPi0Method ( const std::string &  s)
static

Convert string to Pi0Method enum (throws if invalid)