# dependents_plot

Version 1.1 (1.94 KB) by
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 (2024). dependents_plot (https://www.mathworks.com/matlabcentral/fileexchange/45481-dependents_plot), MATLAB Central File Exchange. Retrieved .

##### MATLAB Release Compatibility
Created with R2009b
Compatible with any release
##### Platform Compatibility
Windows macOS Linux
##### Categories
Find more on Frequently-used Algorithms in Help Center and MATLAB Answers

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1

Bug fix : elements where X was equal to max(X) were counted in the lowest bin instead of the highest bin.

Also, change behavior of map2bins when mode=='center' or vBins is a number: the first and the last bins are now extended to infinity.

1.0.0.0