Reliability module

reliability.within_subj(data, cond_vec, part_vec, separate='none', subtract_mean=True)[source][source]

Calculates the within-subject reliability of a data set Data (X) is grouped by condition vector, and the partition vector indicates the independent measurements Does the calculation for each subject if X is a 3d array

Parameters:
  • data (ndarray) – (num_subj x) num_trials x num_voxel tensor of data

  • cond_vec (ndarray) – num_trials condition vector

  • part_vec (ndarray) – num_trials partition vector

  • separate (str) – {‘none’,’voxel_wise’,’condition_wise’}

  • subtract_mean (bool) – Remove the mean per voxel in partition across conditions?

Returns:

r (ndarray) – (n_subjects x) n_separate array of correlations

reliability.between_subj(data, cond_vec=None, separate='none', subtract_mean=True)[source][source]

Calculates the average between-subject reliability The data is averaged across multiple measurements first - so the reliability is for the mean patterns

Parameters:
  • datas (ndarray) – num_subj x num_trials x num_voxel tensor of data

  • cond_vec (ndarray) – num_trials condition vector (otherwise assumed to be identity)

  • separate (str) – {‘none’,’voxel_wise’,’condition_wise’}

  • subtract_mean (bool) – Remove the mean per voxel before correlation calc?

Returns:

r (ndarray) – num_subj vector of correlations

reliability.within_subj_loo(data, cond_vec, part_vec, separate='voxel_wise', subtract_mean=True)[source][source]

Calculates the within-subject reliability of a data set Data (X) is grouped by condition vector, and the partition vector indicates the independent measurements Does the calculation for each subejct if X is a 3d array

Parameters:
  • X (ndarray) – (num_subj x) num_trials x num_voxel tensor of data

  • cond_vec (ndarray) – num_trials condition vector

  • part_vec (ndarray) – num_trials partition vector

  • separate (str) – {‘none’,’voxel_wise’,’condition_wise’}

  • subtract_mean (bool) – Remove the mean per voxel before correlation calc?

Returns:

r (ndarray) – (num_subj x) num_partition matrix of correlations

reliability.between_subj_loo(data, cond_vec=None, separate='none', subtract_mean=True)[source][source]

Calculates the correlation of the responses of each of the subjects with the mean of the other subjects. This serves as a lower noise ceiling for any group model (a model that predicts the same value for all subjects). If cond_vec is given, the data is averaged across multiple measurem first.

Parameters:
  • data (ndarray) – num_subj x num_trials x num_voxel tensor of data

  • cond_vec (ndarray) – num_trials condition vector

  • separate (str) – {‘none’,’voxel_wise’,’condition_wise’}

  • subtract_mean (bool) – Remove the mean per voxel before correlation calc?

Returns:

r (ndarray) – num_subj vector of correlations

reliability.decompose_subj_group(data, cond_vec, part_vec, separate='none', subtract_mean=True)[source][source]

this function decompose a collection of (across subjects and partitions) activity patterns (N condition x P voxels) into group, individual and noise components, returns the variance estimates of each component.

Parameters:
  • data (ndarray) – n_subjects x n_trials x n_voxels array

  • cond_vec (ndarray) – n_trials condition vector

  • part_vec (ndarray) – n_trials partition vector

  • separate (str) –

    • ‘none’: partition variance components for the whole pattern (N x P) -> returns a single row

    • ’voxel_wise’: partition variance components for each voxel separately -> returns as many rows as voxels

    • ’condition_wise’: partition variance components for each condition separately -> returns as many rows as conditions

    • ’subject_wise’: partition variance components for the whole pattern (NxP) -> but return split by Subjects

Returns:

variances – (K x 3 ndarray): v_g, v_s, v_e (variance for group, subject, and noise), where K is the number of voxels, conditions, subjects, or 1