File Exchange

## dependents_plot

version 1.1 (1.94 KB) by Mark Matusevich

### Mark Matusevich (view profile)

Visualises dependents of one variable on another.

Updated 24 Nov 2014

Visualises dependents of one variable on another.
Plots conditional statistics. The statistics plotted by default is the conditional mean. However, any other statistics also can be plotted.

For example, let's assume that you have two 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').
and you need to analyse the conditional probability distribution of the former on the later.
Use the following commands to initialize the variables:
>> N = 1e5;
>> ST = 2*pi*(1:N)/N;
>> holter = sin(ST) + randn(size(ST));

Show E(holter|ST):
>> dependents_plot(ST,holter)
Show E(holter|ST), conditional standard deviation, and maximum:
>> dependents_plot(ST,holter,[],{@mean, @std, @max})

Basically, you can show any statistics you need; all you need is to provide an appropriate function handle. For example, you can show different percentiles:
>> index_ = @(v,ii) v(ii);
>> perc = @(v,p) index_(sort(v(:)), max(round(numel(v)*p/100),1)); % find percentile (p= 0..100)
>> dependents_plot(ST,holter,[],{@(z) perc(z,10), @(z) perc(z,30), @median, @mean, @(z) perc(z,70), @(z) perc(z,90)});
>> legend('10%','30%','median','mean','70%','90%')

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 (2019). dependents_plot (https://www.mathworks.com/matlabcentral/fileexchange/45481-dependents_plot), MATLAB Central File Exchange. Retrieved .