Compute Intersubject Correlation (ISC)
Description
Computes ISC using either the pairwise correlation method or the leave-one-out method. The pairwise method computes a full correlation matrix and averages Fisher z-transformed values. The leave-one-out method computes the correlation of each participant’s time series with the mean of all others.
Usage
calculate_isc(
data_matrix,
method = c("pairwise", "leave-one-out"),
cor_method = c("pearson", "spearman"),
return_matrix = FALSE
)
Arguments
data_matrix
|
A numeric matrix or data.frame where rows represent time points and columns represent participants. |
method
|
A string specifying the ISC computation method. Options are ‘"pairwise"’ (default) or ‘"leave-one-out"’. |
cor_method
|
Correlation type passed to [stats::cor()]. One of ‘"pearson"’ (default) or ‘"spearman"’. |
return_matrix
|
Logical. If ‘TRUE’ and ‘method = "pairwise"’, return the full participant-by-participant correlation matrix (self-correlations set to NA) instead of a summary vector. Ignored for ‘method = "leave-one-out"’. |
Value
A named numeric vector of ISC values (one per participant), or a correlation matrix if ‘return_matrix = TRUE’.