How to calculate empirical cumulative distribution function of a dataset? If I use ecdf function then why the number of datapoints are decreasing? Is there any other formula?

11 views (last 30 days)
How to calculate empirical cumulative distribution function of a dataset which is a (18993x1) matrix? If I use ecdf function then why the number of datapoints (the matrix f1 becomes (1564x1) and x1 becomes(1564x1) matrix) are decreasing? Is there any other formula or method or function to do so?

Answers (1)

Torsten
Torsten on 9 Aug 2023
Edited: Torsten on 9 Aug 2023
If I use ecdf function then why the number of datapoints (the matrix f1 becomes (1564x1) and x1 becomes(1564x1) matrix) are decreasing?
Usually, a lower number of data points is sufficient to describe the cdf. If you want to get the values of the cdf exactly for the points of your data vector, you can use interpolation.
Is there any other formula or method or function to do so?
If you know that your data points follow a known distribution, you can try to use "mle" to fit the distribution parameters. After that, you can plot the cumulative distribution function of the fitted distribution (maybe together with the empirical cumulative distribution you get from "ecdf").
But this is all explained here with a lot of examples:

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!