Processing flow for representational similarity analysis (RSA).

Experimental stimuli or conditions are presented to both the subjects and the model we want to test. Using an estimator for the representational dissimilarity matrix (RDM), we compute the dissimilarities between all pairs of stimuli. These matrices can then be compared using an RDM comparator. Uncertainty estimates for the comparison results can be obtained from bootstrap resampling.

Preprocessing workflow.

RSA can be applied to data from a wide variety of sources. Neural data recorded from any species, in any modality such as single-cell recordings, calcium imaging, magnetoencephalography (MEG), electroencephalography (EEG), local field potentials (LFP), and functional magnetic resonance imaging (fMRI). RSAtoolbox integrates with a range of popular analysis tools to help prepare and import data patterns as well as residuals. This is in the form of i/o functions to read various data formats as well as utilities to make it easier to navigate a dataset. For examples applied to fMRI data, see the SPM demo, the nilearn demo, or a bare-bones NumPy patterns demo.

Methods for estimating RDMs.

See text for details and recommendations for choosing from this list. r1 and r2 are the two response patterns, 1/2 are standardized versions of them, Σ is an estimate of the noise covariance, ri is the response pattern in the i-th of Nr runs, i.e. sets of measurements that are assumed to be independent from the other Nr 1 sets. log of a vector here refers to the vectors of logarithms of each entry. * add a square root transform.

Impact of correlated noise across channels (a) and measurements (b,c) on distance estimation.

A. Mean activity patterns for 3 conditions (red, green blue) plotted in the space of 2 measurement channels. In the raw data space (left), the two channels are negatively correlated across individual measurements (dots). After spatial pre-whitening (arrow), the correlation is removed. The distances in prewhitened space now reflect discriminability of the different conditions across measurements. B. Normal (red) and cross-validated (blue) estimation of four squared Euclidean distances (x-axis). When the noise is independently and identically distributed (iid) across measurements, the bias is constant for all squared distances and the rank-ordering of the distances is preserved. C Same as B, but the pair of condition with distance 2 has correlated (r = 0.5) measurement noise. This induces a negative bias in the distance estimate, also changing the rank-ordering of the distances. Cross-validated distances (blue) remove this bias.

Choosing an appropriate dissimilarity estimator and RDM comparator.

This Euler diagram shows which combination of RDM estimator and RDM comparator promises the most powerful model-comparative inferential analyses in different scenarios, and when a different experimental design is needed. To find the right combination of RDM estimator (italics) and RDM comparator (bold), answer the three questions (black, blue, red). For each question, a yes (Y) indicates that the answer is inside the set, and a no (N) indicates that the answer is outside the set. See text for details. The diagram is the minimum-contour-length iso-Euler diagram.

Methods for comparing two RDMs to evaluate predictions of representational geometries.

The column labeled “function” specifies the name to be passed to the compare function to compute the similarity. In the formulae, dk for k = 1, 2 are the two vectorized RDMs, dk,i is the i-th scalar dissimilarity of dk,k is the centered version of dk (with the mean subtracted from each dissimilarity), d°k is the rank transformed version of dk and Dk are their transforms into positive definite matrices as described in the text. n is the number of dissimilarities, nb = nb1nb2 is the normalization for τb where nb1 and nb2 are the numbers of ordered pairs in the two compared distance vectors. V is the n n covariance matrix of the dissimilarity estimate errors. Citations: 1. [114] 2. [17] 3. [70] 4. [71] 5. [113] 6. [67] 7. [117] .

Symbols used

Visualization of model-comparative inference results.

Results of inferential analysis of simulated data. Ground-truth model is convolutional layer 2 (conv2) of AlexNet. All layers of AlexNet (blue to red) serve as candidate models. (a) Bar plot of RDM prediction accuracies. Model comparisons two-tailed, false-discovery rate controlled at q < 0.01 (36 model-pair comparisons). Inference by bootstrap resampling (1,000 samples) of subjects. Error bars are 95% confidence intervals. One-sided comparisons of each model performance against 0 (white “dew drops” at the bottom indicate significant difference from 0) and against the lower-bound estimate of the noise ceiling (gray bar, gray dew drops indicate significant difference from the noise ceiling) are Bonferroni-corrected for 9 models. “Model-dominance wings” (top) indicate, for each model (dot in model color), which other models it significantly dominates (downward tick marks). (b) Model map. Same results as (a), but deviations of model predictions from the data are used to map the models around the data RDM with a modified multidimensional scaling (MDS). Inter-RDM distances measured by the Pearson correlation distance. MDS constrained to represent the deviations from the data RDM exactly (same information as in a) and the deviations among model RDMs (not shown in a) approximately.

Library overview

Structure of the library with key elements listed. The columns display the sub packages of rsatoolbox; corresponding from left-to-right with the typical order in which they come into play during an analysis. Light gray grouping boxes represent modules annotated with the respective module name. White boxes are key functions (lowercase) and classes (capitalized nouns).