Skip to content

Commit 9d1d88c

Browse files
committed
Auto adjust network analysis alpha when necessary.
1 parent 467df40 commit 9d1d88c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Python/shapeworks/shapeworks/network_analysis.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,12 @@ def run(self):
297297
snpm = spm1d.stats.nonparam.ttest2(
298298
np.transpose(all_data[:, :, np.where(grouprs == 0)[0], :].reshape(num_pts, len(np.where(grouprs == 0)[0]))),
299299
np.transpose(all_data[:, :, np.where(grouprs == 1)[0], :].reshape(num_pts, len(np.where(grouprs == 1)[0]))))
300-
snpmi = snpm.inference(0.05, two_tailed=True, iterations=n_iter, force_iterations=True) # assume one-sided
300+
301+
alpha = 0.05
302+
# Specified alpha must be greater than or equal to (1/nPermTotal)=0.33333
303+
if (alpha < 1/n_iter):
304+
alpha = 1/n_iter
305+
snpmi = snpm.inference(alpha, two_tailed=True, iterations=n_iter, force_iterations=True) # assume one-sided
301306

302307
Z = snpmi.z # flattened test statistic (i.e., t value) over only non-zero-variance nodes
303308
tradzstar = snpmi.zstar # critical test statistic (i.e., critical t value)

0 commit comments

Comments
 (0)