This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
calculate_isc_per_subject <- function(data_matrix, window_size = 10) { | |
# data_matrix: A matrix where each column is a participant and each row is a time point. | |
# window_size: The size of the sliding window for calculating correlations. | |
n_timepoints <- nrow(data_matrix) | |
n_participants <- ncol(data_matrix) | |
# Check that the number of participants is greater than 1 | |
if (n_participants <= 1) { | |
stop("There must be more than one participant to calculate inter-subject correlation.") |