Given an array of correlation snapshots in time, returns a matrix of some rolling distance measure on the correlations.

```
cordist(R, distance = c("ma","ms","meda","meds","eigen", "cmd"), n = 25,
plot = TRUE, dates = NULL, title = NULL)
```

R

An array of correlations.

distance

The measure to use to capture the change between 2 correlation matrices (see details).

n

The distance between 2 correlation matrices.

plot

Whether to create a heatmap plot of the result.

dates

A `POSIXct`

vector of dates to use for the heatmap (recommend to
supply).

title

Title for the heatmap plot.

A symmetric matrix of the rolling distance measure for each period.

This function provides for a visualization of dynamic correlation distance between periods with a number of plausible measures including “ma” (mean absolute), “ms” (mean squared), “meda” (median absolute), “meds” (median squared) “eigen” (largest eigenvalue difference) and “cmd” (correlation matrix distance). See the references for more details.

Munnix, M. C., Shimada, T., Schafer, R., Leyvraz, F., Seligman, T. H.,
Guhr, T., & Stanley, H. E. (2012). Identifying states of a financial market.
*Scientific Reports 2*.
Herdin, M., Czink, N., Ozcelik, H., & Bonek, E. (2005). Correlation matrix
distance, a meaningful measure for evaluation of non-stationary MIMO channels.
*Vehicular Technology Conference, 2005, IEEE 61st*, **1**, 136--140.