# Representational similarity analysis¶

## Visualizing dissimilarity matrices¶

Dissimilarities, based on neural data, behavioural data, and/or model data, can be visualised in various ways.

Compute the similarities in the `ev`

and `vt`

regions for participant `s01`

across the six categories, and load the model similarities for the behavioural ratings. Then visualize the similarities in three ways:

- with dissimilarity matrices
- with dendograms
- with multi-dimensional scaling

Hint: run rsa visualize skl.

Solution: run rsa visualize / Matlab output: run_rsa_visualize.

## Comparing dissimilarity matrices¶

It is easy to compare dissimilarity matrices by computing the
Pearson correlation between two flattened upper triangle DSMs using the
cosmo corr function. For the next exercise, stack flattened DSMs vertically
into a single matrix starting with all of the EV DSMs from every subject then
all of the VT DSM. You should have an 16x15 matrix. Then add the v1 model and the
behavioral DSMs to make it a 18x15 matrix. Now compute the cross-correlation
matrix using cosmo corr. Visualize the cross-correlation matrix with
**imagesc**. Try this with demeaning and without demeaning to compare the
results. Finally, use matlabs **boxplot** function to view the distributions of
correlations between neural simiilarities and model/behavioral DSMs.

Hint: run compare dsm skl.

Solution: run compare dsm / Matlab output: run_compare_dsm.

## Target dissimilarity matrix searchlight¶

The function cosmo target dsm corr measure implements representational similarity. Use this measure to map where the neural similarity is similar to the behavioural similarity.

It is recommended to center the data using the `center_data`

option.

Advanced exercise: the cosmo target dsm corr measure function can also run regression on multiple dissimilarity matrices. Use this function to estimate the contribution of the V1 and behavioural model using a searchlight.

Hint: run rsm measure searchlight skl

Solution: run rsm measure searchlight / run_rsm_measure_searchlight_pb