Skip to content

Commit

Permalink
Pairwise distance metric keyword for stats.isc (#442)
Browse files Browse the repository at this point in the history
* added similarity metric keyword to stats.isc (defaults to correlation)

* add description for sim_metric

* Update stats.py
  • Loading branch information
srken32 authored Aug 1, 2024
1 parent e67f266 commit 41219c5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nltools/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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']
Expand All @@ -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":
Expand Down

0 comments on commit 41219c5

Please sign in to comment.