Skip to content

Commit 41219c5

Browse files
authored
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
1 parent e67f266 commit 41219c5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

nltools/stats.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1943,6 +1943,7 @@ def isc(
19431943
tail=2,
19441944
n_jobs=-1,
19451945
random_state=None,
1946+
sim_metric="correlation",
19461947
):
19471948
"""Compute pairwise intersubject correlation from observations by subjects array.
19481949
@@ -1981,6 +1982,7 @@ def isc(
19811982
tail: (int) either 1 for one-tail or 2 for two-tailed test (default: 2)
19821983
n_jobs: (int) The number of CPUs to use to do the computation. -1 means all CPUs.
19831984
return_null: (bool) Return the permutation distribution along with the p-value; default False
1985+
sim_metric: (str) pairwise distance metric. See sklearn's pairwise_distances for valid inputs (default: correlation)
19841986
19851987
Returns:
19861988
stats: (dict) dictionary of permutation results ['correlation','p']
@@ -2000,7 +2002,7 @@ def isc(
20002002
stats = {"isc": _compute_isc(data, metric=metric)}
20012003

20022004
similarity = Adjacency(
2003-
1 - pairwise_distances(data.T, metric="correlation"), matrix_type="similarity"
2005+
1 - pairwise_distances(data.T, metric=sim_metric), matrix_type="similarity"
20042006
)
20052007

20062008
if method == "bootstrap":

0 commit comments

Comments
 (0)