Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pairwise distance metric keyword for stats.isc #442

Merged
merged 3 commits into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading