(data)
return out
Exhaustive paired t-test for permutation tests

    Returns p-values for exhaustive ttest that runs through all possible
    permutations of the first dimension. Very bad idea for size greater than 12

    Parameters
    ----------
    data: ndarray of shape (n_subj, n_pipelines, n_pipelines)
        Array of differences between scores for each pair of algorithms per subject

    Returns
    -------
    pvals: ndarray of shape (n_pipelines, n_pipelines)
        array of pvalues
Exhaustive paired t-test for permutation tests
Exhaustive paired t - test for permutation tests
def _pairedttest_exhaustive(data):
    """Exhaustive paired t-test for permutation tests

    Returns p-values for exhaustive ttest that runs through all possible
    permutations of the first dimension. Very bad idea for size greater than 12

    Parameters
    ----------
    data: ndarray of shape (n_subj, n_pipelines, n_pipelines)
        Array of differences between scores for each pair of algorithms per subject

    Returns
    -------
    pvals: ndarray of shape (n_pipelines, n_pipelines)
        array of pvalues
    """
    out = np.ones((data.shape[1], data.shape[1]))
    true = data.sum(axis=0)
    nperms = 2 ** data.shape[0]
    for perm in itertools.product([-1, 1], repeat=data.shape[0]):
        # turn into numpy array
        perm = np.array(perm)
        # multiply permutation by subject dimension and sum over subjects
        randperm = (data * perm[:, None, None]).sum(axis=0)
        # compare to true difference (numpy autocasts bool to 0/1)
        out += randperm > true
    out = out / nperms
    # control for cases where pval is 1
    out[out == 1] = 1 - (1 / nperms)
    return out
def _pairedttest_exhaustive ( data ) : out = np . ones ( ( data . shape [ 1 ] , data . shape [ 1 ] ) ) true = data . sum ( axis = 0 ) nperms = 2 ** data . shape [ 0 ] for perm in itertools . product ( [ - 1 , 1 ] , repeat = data . shape [ 0 ] ) : # turn into numpy array perm = np . array ( perm ) # multiply permutation by subject dimension and sum over subjects randperm = ( data * perm [ : , None , None ] ) . sum ( axis = 0 ) # compare to true difference (numpy autocasts bool to 0/1) out += randperm > true out = out / nperms # control for cases where pval is 1 out [ out == 1 ] = 1 - ( 1 / nperms ) return out