neurosynth/analysis/stats.py
def one_way(data, n):
    """ One-way chi-square test of independence.
    Takes a 1D array as input and compares activation at each voxel to
    proportion expected under a uniform distribution throughout the array. Note
    that if you're testing activation with this, make sure that only valid
    voxels (e.g., in-mask gray matter voxels) are included in the array, or
    results won't make any sense!
    """
    term = data.astype('float64')
    no_term = n - term
    t_exp = np.mean(term, 0)
    t_exp = np.array([t_exp, ] * data.shape[0])
    nt_exp = n - t_exp
    t_mss = (term - t_exp) ** 2 / t_exp
    nt_mss = (no_term - nt_exp) ** 2 / nt_exp
    chi2 = t_mss + nt_mss
    return special.chdtrc(1, chi2)
def one_way(data, n):
    """ One-way chi-square test of independence.
    Takes a 1D array as input and compares activation at each voxel to
    proportion expected under a uniform distribution throughout the array. Note
    that if you're testing activation with this, make sure that only valid
    voxels (e.g., in-mask gray matter voxels) are included in the array, or
    results won't make any sense!
    """
    term = data.astype('float64')
    no_term = n - term
    t_exp = np.mean(term, 0)
    t_exp = np.array([t_exp, ] * data.shape[0])
    nt_exp = n - t_exp
    t_mss = (term - t_exp) ** 2 / t_exp
    nt_mss = (no_term - nt_exp) ** 2 / nt_exp
    chi2 = t_mss + nt_mss
    return special.chdtrc(1, chi2)
def one_way ( data , n ) : term = data . astype ( 'float64' ) no_term = n - term t_exp = np . mean ( term , 0 ) t_exp = np . array ( [ t_exp , ] * data . shape [ 0 ] ) nt_exp = n - t_exp t_mss = ( term - t_exp ) ** 2 / t_exp nt_mss = ( no_term - nt_exp ) ** 2 / nt_exp chi2 = t_mss + nt_mss return special . chdtrc ( 1 , chi2 )
One-way chi-square test of independence.
    Takes a 1D array as input and compares activation at each voxel to
    proportion expected under a uniform distribution throughout the array. Note
    that if you're testing activation with this, make sure that only valid
    voxels (e.g., in-mask gray matter voxels) are included in the array, or
    results won't make any sense!
One - way chi - square test of independence . Takes a 1D array as input and compares activation at each voxel to proportion expected under a uniform distribution throughout the array . Note that if you re testing activation with this make sure that only valid voxels ( e . g . in - mask gray matter voxels ) are included in the array or results won t make any sense!