correlation_analysis.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:Waskom_PNAS_2017 作者: WagnerLabPapers 项目源码 文件源码
def permutation_test(corrmat, tails, mask=None, n=100, seed=None):
    """Permute tail assignments to generate null distribution."""
    rs = np.random.RandomState(seed)
    corrs_real = tail_correlations(corrmat, tails, mask)
    corrs_null = []
    for _ in xrange(n):
        perm_tails = rs.permutation(tails)
        corrs_null.append(tail_correlations(corrmat, perm_tails, mask))
    diff_real = np.subtract(*corrs_real)
    diff_null = np.subtract(*zip(*corrs_null))
    pctile = stats.percentileofscore(diff_null, diff_real)
    return pctile
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号