Table Of Contents

Previous topic

neurospin.spatial_models.structural_bfls

Next topic

neurospin.utils.mask

This Page

neurospin.utils.emp_null

Module: neurospin.utils.emp_null

Inheritance diagram for nipy.neurospin.utils.emp_null:

this module contains a class that fits a gaussian model to the central part of an histogram, following schwartzman et al, 2009. This is typically necessary to estimate a fdr when one is not certain that the data behaves as a standard normal under H_0.

Author : Bertrand Thirion, 2008-2009

Classes

ENN

class nipy.neurospin.utils.emp_null.ENN(x)

Class to compute the empirical null normal fit to the data.

The data which is used to estimate the FDR, assuming a gaussian null from Schwartzmann et al., NeuroImage 44 (2009) 71–82

__init__(x)

Initiate an empirical null normal object.

Parameters:

x : 1D ndarray

The data used to estimate the empirical null.

fdr(theta)
given a threshold theta, find the estimated fdr
fdrcurve()
Returns the fdr associated with any point of self.x
learn(left=0.20000000000000001, right=0.80000000000000004)

Estimate the proportion, mean and variance of a gaussian distribution for a fraction of the data

Parameters:

left : float, optional

Left cut parameter to prevent fitting non-gaussian data

right : float, optional

Right cut parameter to prevent fitting non-gaussian data

Notes

This method stores the following attributes:
  • mu = mu
  • p0 = min(1, np.exp(lp0))
  • sqsigma : standard deviation of the estimated normal distribution
  • sigma = np.sqrt(sqsigma) : variance of the estimated normal distribution
plot(efp=None, alpha=0.050000000000000003, bar=1)

plot the histogram of x

Parameters:

efp : float, optional

The empirical fdr (corresponding to x) if efp==None, the false positive rate threshod plot is not drawn.

alpha : float, optional

The chosen fdr threshold

threshold(alpha=0.050000000000000003, verbose=0)

Compute the threshold correponding to an alpha-level fdr for x

Parameters:

alpha : float, optional

the chosen false discovery rate threshold.

verbose : boolean, optional

the verbosity level, if True a plot is generated.

uncorrected_threshold(alpha=0.001, verbose=0)

Compute the threshold correponding to a specificity alpha for x

Parameters:

alpha : float, optional

the chosen false discovery rate threshold.

verbose : boolean, optional

the verbosity level, if True a plot is generated.

Results :

theta: float :

the critical value associated with the provided p-value

FDR

class nipy.neurospin.utils.emp_null.FDR(x)

This is the basic class to handle false discovery rate computation parameter: fdr.x the samples from which the fdr is derived x is assumed to be a normal variate

The Benjamini-Horchberg procedure is used

__init__(x)
x is assumed to be a 1-d array
all_fdr(x=None, verbose=0)

Returns all the FDR (false discovery rates) values for the sample x

Parameters:

x : ndarray of shape (n)

The normal variates

all_fdr_from_pvals(pv, verbose=0)

Returns the fdr associated with each the values

Parameters:

pv : ndarray of shape (n)

The samples p-value

Returns:

q : array of shape(n)

The corresponding fdrs

check_pv(pv)

Do some basic checks on the pv array: each value should be within [0,1]

Parameters:

pv : array of shape (n)

The sample p-values

Returns:

pv : array of shape (n)

The sample p-values

pth_from_pvals(pv, alpha=0.050000000000000003)

Given a set pv of p-values, returns the critical p-value associated with an FDR alpha

Parameters:

alpha : float

The desired FDR significance

pv : array of shape (n)

The samples p-value

Returns:

pth: float :

The p value corresponding to the FDR alpha

threshold(alpha=0.050000000000000003, x=None)

Given an array x of normal variates, this function returns the critical p-value associated with alpha. x is explicitly assumed to be normal distributed under H_0

Parameters:

alpha: float, optional :

The desired significance, by default 0.05

x : ndarray, optional

The variate. By default self.x is used

Returns:

th : float

The threshold in variate value

threshold_from_student(df, alpha=0.050000000000000003, x=None)

Given an array t of student variates with df dofs, returns the critical p-value associated with alpha.

Parameters:

df : float

The number of degrees of freedom

alpha : float, optional

The desired significance

x : ndarray, optional

The variate. By default self.x is used

Returns:

th : float

The threshold in variate value