[f,x]=ecdf(y) definationf of x

6 views (last 30 days)
JM
JM on 22 Jun 2022
Edited: Torsten on 22 Jun 2022
Hallo everyone,
Now i just do the statsic data analysis by ecdf function.
so i have a matrix, and i change this matrix in to a colum.
[f,x]=ecdf(y)
y represent this colum. then i get a colum of f and a colum of x, and plot (x, f),
i would like to know what it means for x, f is the cumulative function, also the probility.
how they caculate f and x based on the y
Thank so much
Jialin

Accepted Answer

Torsten
Torsten on 22 Jun 2022
There are six literature reference at the bottom of the page.
Usually, the minimum and maximum value of the y-data is determined. The interval [ymin,ymax] is divided in a certain number of subintervals (bins). According to their value, the y-data are put into the bin where they belong. Then the number of y-data in each bin is divided by the total number of y-data. Let us call these values bi (i=1,...,n = number of bins) (note that they sum to 1). Then it is set
B1 = b1
B2 = b1+b2
...
Bn-1 = b1 + b2 + ... + bn-1
Bn = 1
and the B1,B2,...,Bn are plotted as ecdf.
  5 Comments
JM
JM on 22 Jun 2022
hallo Torsten
I just want to confirm, this following diagram is from plot(x,f)
this x axis is minpoint of bins.right?
for this histogram, the data is also based on the y.
for this y axis, is also frequency. and this x axis, i don't understand why there is negative value, actually all the value from Y is positive.
Torsten
Torsten on 22 Jun 2022
Edited: Torsten on 22 Jun 2022
this x axis is minpoint of bins.right?
Yes, your y-data seem to range between 0 (ymin) and 0.8 (ymax).
i don't understand why there is negative value, actually all the value from Y is positive.
My guess is that you chose a normal distribution to approximate your empirical pdf - and the normal distribution has mass on the complete real axis (thus also for y being negative). That's why approximating your empirical pdf by a normal distribution is most probably a bad choice. Try a LogNormal distribution or something advised in the literature for your application.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!