| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Statistics Toolbox |
| Contents | Index |
| Learn more about Statistics Toolbox |
n = ecdfhist(f,x)
n = ecdfhist(f,x,m)
n = ecdfhist(f,x,c)
[n,c] = ecdfhist(...)
ecdfhist(...)
n = ecdfhist(f,x) takes a vector f of empirical cumulative distribution function (cdf) values and a vector x of evaluation points, and returns a vector n containing the heights of histogram bars for 10 equally spaced bins. The function computes the bar heights from the increases in the empirical cdf, and normalizes them so that the area of the histogram is equal to 1. In contrast, hist produces bars whose heights represent bin counts.
n = ecdfhist(f,x,m), where m is a scalar, uses m bins.
n = ecdfhist(f,x,c), where c is a vector, uses bins with centers specified by c.
[n,c] = ecdfhist(...) also returns the position of the bin centers in c.
ecdfhist(...) without output arguments produces a histogram bar plot of the results.
The following code generates random failure times and random censoring times, and compares the empirical pdf with the known true pdf.
y = exprnd(10,50,1); % Random failure times d = exprnd(20,50,1); % Drop-out times t = min(y,d); % Observe the minimum of these times censored = (y>d); % Observe whether the subject failed % Calculate the empirical cdf and plot a histogram from it [f,x] = ecdf(t,'censoring',censored); ecdfhist(f,x) set(get(gca,'Children'),'FaceColor',[.8 .8 1]) hold on % Superimpose a plot of the known population pdf xx = 0:.1:max(t); yy = exp(-xx/10)/10; plot(xx,yy,'r-','LineWidth',2) hold off

![]() | ecdf | end (categorical) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |