File Exchange

## Multidimensional distributions visualisation and analysis.

version 1.3.0.0 (10.7 KB) by
Matrix of planar projections of multidimensional distributions with tools for interactive analysis.

Updated 25 Nov 2014

Simultaneously visualises multiple multidimensional distributions as a matrix of planar projections and provides means for further interactive analysis of them. Supports large data set (tested with 2 million 4D data points). plot_feature_matrix is an essential tool for statistical modelling and classification algorithms development.
Given N-dimensional data points, plot_feature_matrix constructs NxN matrix of axes, and plots the projections of the data points onto the planes corresponding to the respective coordinates. The diagonal axes show histograms of the data points. Additional vector of class IDs for each of the data points can be provided, in which case each class is shown with a separate color and each diagonal axis includes histogram for each of the classes.
Mouse click inside a non-diagonal axis shows information about the points in the vicinity of the click. By default, the amount of points from each of the class is shown. However, if a custom visualisation function is provided, then more detailed analysis of the data points in the vicinity of the click is possible.
For example, let's assume that you are conducting a study, which aim is to estimate the probability of myocardial infarction based on four metrics:
- duration of atrial fibrillation during 24 hour ambulatory ECG recording (stored in vector 'holter').
- peak ischemic ST depression during cardiac stress test (stored in vector 'ST').
- mean arterial pressure from 24 hour ambulatory blood pressure recording (stored in vector 'MAP').
- duration of the depolarization wave of the ventricles measured in resting ECG recording (stored in vector QRS).
Also, boolean vector 'MI' has value 'true' for those patients which experience myocardial infarction during 5 years since the above tests. Use the following commands to initialize the variables:
>> N = 1e4;
>> t1 = randn(1,N); t2 = randn(1,N);
>> holter = [t1 2+t2];
>> ST = [t1+t2 2+t1*2-t2];
>> MAP = [t1.^2+t2 -t1-t2.^2];
>> QRS = [t1./(1+t2.^2) 1+(t1.^2+t2.^2)./(1+(t1-t2).^2+t2.^2)];
>> MI = [false(1,N), true(1,N)];
>> Z = [holter; ST; MAP; QRS];
>> csFeatures = {'holter','ST','MAP', 'QRS'};
>> vClass = 1+MI;
>> csClasses = {'Healthy', 'MI'};

Show the feature matrix with default investigation tool (just reports number of cases in the vicinity):
>> plot_feature_matrix(Z, vClass, csFeatures, csClasses)

Only the first parameter is mandatory, every other one can be omitted or replaced with the empty matrix:
>> plot_feature_matrix(Z)

Use custom visualisation function to show all selected cases in one plot:
>> t1_ = [t1 t1]; t2_ = [t2 t2];
>> plot_feature_matrix(Z, vClass, csFeatures, csClasses, @(~,~,isSel) scatter(t1_(isSel),t2_(isSel)) )

Use custom visualisation function which can show only one case at a time (press <space> to see next uniformly sampled example):
>> show_1_func = @(isSel,ii) cylinder(abs(Z(:,find(cumsum(isSel)==ii,1))));
>> show_set_func = @(~,~,isSel) show_uniformly_sampled(sum(isSel), @(ii) show_1_func(isSel,ii));
>> plot_feature_matrix(Z, vClass, csFeatures, csClasses, show_set_func)

Use the output parameter to get axis handles of the matrix (can be used to overlay additional plots):
>> hAxis = plot_feature_matrix(...);

For additional explanations type: help plot_feature_matrix

This submission is courtesy of Norav Medical (www.norav.com) - the leading company in the fields of PC-ECG, EKG Management systems and related non-invasive cardiac devices.

### Cite As

Mark Matusevich (2020). Multidimensional distributions visualisation and analysis. (https://www.mathworks.com/matlabcentral/fileexchange/45740-multidimensional-distributions-visualisation-and-analysis), MATLAB Central File Exchange. Retrieved .