Empirical distribution, find the (1 - ecdf) and find value of the distribution
3 views (last 30 days)
Show older comments

Hi all, I have some data and I want first to calculate the empirical distribution and then set in a way such that the plot tho have on the x-axis the actual frequency and the y-axis the 1-ecdf. To do that I have used the following code:
[f_4,x_4] = ecdf(.);
y_4 = 1 -f_4;
figure H_4 = plot(x_4,y_4);
I want to ask if this is correct. And moreover if I want to find i.e. when x_4=80% what is the value of y_4 how I can do that? I am asking because on the workspace of Matlab the value of x_4 =0.8 does not exist. Any help will be much appreciated.
Attached is what I have plotted.
0 Comments
Answers (1)
the cyclist
on 7 Dec 2017
The canonical way to do what you want is to use the syntax
ecdf(y,'function','survivor')
which tells MATLAB to compute a survival curve rather than a cumulative distribution function. There is an example in the documentation for ecdf.
You'll then need to interpolate to get the exact value you want. Take a look at the documentation for interp1.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!