From 41219c5bb5adf5448b515a7bffb19eccbf9f35d7 Mon Sep 17 00:00:00 2001 From: Sam <119359217+srken32@users.noreply.github.com> Date: Thu, 1 Aug 2024 13:16:35 -0400 Subject: [PATCH] Pairwise distance metric keyword for stats.isc (#442) * added similarity metric keyword to stats.isc (defaults to correlation) * add description for sim_metric * Update stats.py --- nltools/stats.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nltools/stats.py b/nltools/stats.py index 7e93afbb..fec0415c 100644 --- a/nltools/stats.py +++ b/nltools/stats.py @@ -1943,6 +1943,7 @@ def isc( tail=2, n_jobs=-1, random_state=None, + sim_metric="correlation", ): """Compute pairwise intersubject correlation from observations by subjects array. @@ -1981,6 +1982,7 @@ def isc( tail: (int) either 1 for one-tail or 2 for two-tailed test (default: 2) n_jobs: (int) The number of CPUs to use to do the computation. -1 means all CPUs. return_null: (bool) Return the permutation distribution along with the p-value; default False + sim_metric: (str) pairwise distance metric. See sklearn's pairwise_distances for valid inputs (default: correlation) Returns: stats: (dict) dictionary of permutation results ['correlation','p'] @@ -2000,7 +2002,7 @@ def isc( stats = {"isc": _compute_isc(data, metric=metric)} similarity = Adjacency( - 1 - pairwise_distances(data.T, metric="correlation"), matrix_type="similarity" + 1 - pairwise_distances(data.T, metric=sim_metric), matrix_type="similarity" ) if method == "bootstrap":