(data, nperms)
return out / nperms
Returns p-values based on nperms permutations of a paired ttest

    data is a (subj, alg, alg) matrix of differences between scores for each
    pair of algorithms per subject

    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
Returns p-values based on nperms permutations of a paired ttest
Returns p - values based on nperms permutations of a paired ttest
def _pairedttest_random(data, nperms):
    """Returns p-values based on nperms permutations of a paired ttest

    data is a (subj, alg, alg) matrix of differences between scores for each
    pair of algorithms per subject

    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)
    for _ in range(nperms):
        perm = np.random.randint(2, size=(data.shape[0],))
        perm[perm == 0] = -1
        # 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] = nperms - 1
    return out / nperms
def _pairedttest_random ( data , nperms ) : out = np . ones ( ( data . shape [ 1 ] , data . shape [ 1 ] ) ) true = data . sum ( axis = 0 ) for _ in range ( nperms ) : perm = np . random . randint ( 2 , size = ( data . shape [ 0 ] , ) ) perm [ perm == 0 ] = - 1 # 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 ] = nperms - 1 return out / nperms