Correlation Matrix Pseudocolor Map Function

What it does

The function corrmap.m displays a pseudocolor map of the correlation matrix for a input data set. This much would be easy, but it can also reorder the variables so that they are grouped by how correlated they are with each other. A modified k-nearest neighbor algorithm is used to reorder the variables. An example of its use is shown below. Here the data file plsdata was loaded into the MATLAB workspace. The plsdata file contains data from a slurry-fed ceramic melter process for solidifying the reprocessing wastes from nuclear fuels (yes, I know that this example is a bit unusual). The variable xblock1 contains 300 observations of the 20 temperatures measured within the melter. The variable yblock1 contains the molten glass level at each time. The MATLAB command window shows the functions that were called to develop a correlation map of the 20 temperatures plus the level. (Note: it is generally much easier to write a small script to make up labels rather than writing it on the command line.) When the function is called, it produces the plot shown in the second figure. (Temperatures are labeled L for left side of the melter, R for right, numbered from 1 at the bottom to 0 at the top, the level is LV.) Note how the variables have been arranged so that the highly correlated ones are near each other in the figure producing a psuedocolor map where the the high correlations are mainly along the diagonal. The function can also be used without variable re-ordering, as shown here.

Example of Command Window when using CORRMAP.

Example of Figure Produced by CORRMAP with Variable Reordering.

Requirements for running corrmap

  • MATLAB 5.0
  • No other toolboxes required

Developed by:

Barry M. Wise
Eigenvector Research, Inc.

Download corrmap.m

To get it, simply click on corrmap.m for Mac, or corrmap.m for PC. Move the file to a folder on your MATLAB path and you're done.