Skip to content

Commit de4f37f

Browse files
committed
Resolve CCA Incorrect Statistics neurodata#413
1 parent e50b28e commit de4f37f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

hyppo/independence/cca.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ def statistic(self, x, y):
7373

7474
# if 1-d, don't calculate the svd
7575
if varx.size == 1 or vary.size == 1 or covar.size == 1:
76-
covar = np.sum(covar**2)
77-
stat = covar / np.sqrt(np.sum(varx**2) * np.sum(vary**2))
76+
covar = np.sum(covar)
77+
stat = covar / np.sqrt(np.sum(varx) * np.sum(vary))
7878
else:
79-
covar = np.sum(np.linalg.svd(covar, 1)[1] ** 2)
79+
covar = np.sum(np.linalg.svd(covar, compute_uv=False) ** 2)
8080
stat = covar / np.sqrt(
81-
np.sum(np.linalg.svd(varx, 1)[1] ** 2)
82-
* np.sum(np.linalg.svd(vary, 1)[1] ** 2)
81+
np.sum(np.linalg.svd(varx, compute_uv=False) ** 2)
82+
* np.sum(np.linalg.svd(vary, compute_uv=False) ** 2)
8383
)
8484
self.stat = stat
8585

0 commit comments

Comments
 (0)