From de4f37fe48210f6a03ac01314da7174defbf6e6e Mon Sep 17 00:00:00 2001 From: mattbrwnn Date: Thu, 3 Oct 2024 11:09:31 -0400 Subject: [PATCH] Resolve CCA Incorrect Statistics #413 --- hyppo/independence/cca.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hyppo/independence/cca.py b/hyppo/independence/cca.py index f2197d038..86c6cd4f7 100644 --- a/hyppo/independence/cca.py +++ b/hyppo/independence/cca.py @@ -73,13 +73,13 @@ def statistic(self, x, y): # if 1-d, don't calculate the svd if varx.size == 1 or vary.size == 1 or covar.size == 1: - covar = np.sum(covar**2) - stat = covar / np.sqrt(np.sum(varx**2) * np.sum(vary**2)) + covar = np.sum(covar) + stat = covar / np.sqrt(np.sum(varx) * np.sum(vary)) else: - covar = np.sum(np.linalg.svd(covar, 1)[1] ** 2) + covar = np.sum(np.linalg.svd(covar, compute_uv=False) ** 2) stat = covar / np.sqrt( - np.sum(np.linalg.svd(varx, 1)[1] ** 2) - * np.sum(np.linalg.svd(vary, 1)[1] ** 2) + np.sum(np.linalg.svd(varx, compute_uv=False) ** 2) + * np.sum(np.linalg.svd(vary, compute_uv=False) ** 2) ) self.stat = stat