Time-windowed Intersubject Correlation (ISC) per subject
Description
Computes ISC for each subject by correlating that subject’s time series against the mean of all other subjects within sliding windows, then Fisher z-transforms correlations, averages them per subject, and converts back to r.
Usage
time_window_isc(
data,
window_size = 10,
step = 1,
min_overlap = 3,
method = c("pearson", "spearman"),
return_per_window = FALSE
)
Arguments
data
|
A numeric matrix or data.frame with rows = time points, columns = participants. |
window_size
|
Integer, window length in time points (default 10). |
step
|
Integer, step size between consecutive windows (default 1). |
min_overlap
|
Integer, minimum number of non-NA paired points within a window required to compute a correlation (default 3). |
method
|
Correlation method passed to [stats::cor()], usually "pearson" (default), or "spearman". |
return_per_window
|
Logical; if TRUE, also return a data.frame of per-window Fisher-z correlations per subject (default FALSE). |
Value
If ‘return_per_window = FALSE’, a named numeric vector of ISC values (length = n subjects). If ‘TRUE’, a list with: - ‘isc’: named numeric vector of per-subject ISC (as above) - ‘per_window’: data.frame with columns ‘window_start’, ‘window_end’, ‘subject’, ‘z’