statsmodels.stats.multitest.local_fdr

statsmodels.stats.multitest.local_fdr(zscores, null_proportion=1.0, null_pdf=None, deg=7, nbins=30, alpha=0)[source]

Calculate local FDR values for a list of Z-scores.

Parameters:
zscoresarray_like

A vector of Z-scores

null_proportionfloat

The assumed proportion of true null hypotheses

null_pdffunction mapping reals to positive reals

The density of null Z-scores; if None, use standard normal

degint

The maximum exponent in the polynomial expansion of the density of non-null Z-scores

nbinsint

The number of bins for estimating the marginal density of Z-scores.

alphafloat

Use Poisson ridge regression with parameter alpha to estimate the density of non-null Z-scores.

Returns:
fdrarray_like

A vector of FDR values

References

B Efron (2008). Microarrays, Empirical Bayes, and the Two-Groups Model. Statistical Science 23:1, 1-22.

Examples

Basic use (the null Z-scores are taken to be standard normal):

>>> from statsmodels.stats.multitest import local_fdr
>>> import numpy as np
>>> zscores = np.random.randn(30)
>>> fdr = local_fdr(zscores)

Use a Gaussian null distribution estimated from the data:

>>> null = EmpiricalNull(zscores)
>>> fdr = local_fdr(zscores, null_pdf=null.pdf)