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
correlation_analysis.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录