tfrStats.mvtfr_reliability module¶
- tfrStats.mvtfr_reliability.mvtfr_reliability(rdms, conf)[source]¶
Multivariate Time Frequency Representation Reliability (MVTFR-RSA)
Taking paths and a configuration structure as input and computes, for each frequency bin and time window, the Spearman’s rho correlation between two RDMs (for ven and odd trials). Following on Schütt et al, (2023), here we use the Spearman’s rank-correlation with random tiebreaking as an evaluation criterion for RSA instead of original Spearman’s rank-correlation, as the later is biased for tied ranks (for details see Schütt et al, (2023)). Optionally, we assess the contribution to the representational structure that emerges in time-frequency correlation map, by using a permutation approach. For each frequency bin in a given time point (an index to an epoque), we proceeded as follows:
Calculate the correlation of the original RDMs A and B.
- Perform a permutation on RDM A (random shuffle) and calculate the correlation with RDM B.
Repeat the other way around.To save time, this step is performed within a time window of interest (here -250 to 1200 ms). See line 200.
- Repeat step 2 a certain number of times, e.g., 100 times, to obtain a null distribution
of correlation values.
- Calculate the p-value based on the percentage of permuted correlation coefficients greater
than or equal to the observed correlation.
This results in spectrograms that are based on time-frequency specific image-related information and a null distribution that tests for condition-level significance.
Originally I was using scipy’s Kendall’s tau but now I use: https://rsatoolbox.readthedocs.io/en/stable/comparing.html#spearman-s-rho
- Parameters:
input_path – a string
condition – an integer
fband – frequency band index (low frequencies, high frequencies), integer
method – method index (hanning, multitaper, wavelet)
dvar – spectral variable (GPR or spectral power), integer
split – index to split (even, odd or whole)
- Returns:
empirical and nulll channel x time x frequency distributiont (np.array)
@author: Nicolas Gravel, 19.09.2023