Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Cummulative Distribution Function (CDF)

Subject: Cummulative Distribution Function (CDF)

From: Erik L

Date: 27 Jun, 2012 21:37:08

Message: 1 of 8

Hi,
I need to find the cumulative distribution for my data. The data which i got at the output is in the form:
X=[1 2 3 4 5 6 7 8 9 10 11 12];
Y=[0.92 0.87 0.79 0.71 0.90 0.83 0.71 0.8 0.99 0.89 0.88 0.78];

where i draw X is on the x-axis and Y is on the y-axis.
The result for my system output is always between 0.71 and 1.
How can i find the CDF for this data; sorry i am not strong in statistics.

thanks

Erick.

Subject: Cummulative Distribution Function (CDF)

From: Matt J

Date: 27 Jun, 2012 21:50:11

Message: 2 of 8

"Erik L" wrote in message <jsfue3$j4c$1@newscl01ah.mathworks.com>...
> Hi,
> I need to find the cumulative distribution for my data. The data which i got at the output is in the form:
> X=[1 2 3 4 5 6 7 8 9 10 11 12];
> Y=[0.92 0.87 0.79 0.71 0.90 0.83 0.71 0.8 0.99 0.89 0.88 0.78];
>
> where i draw X is on the x-axis and Y is on the y-axis.
> The result for my system output is always between 0.71 and 1.
> How can i find the CDF for this data; sorry i am not strong in statistics.
======

cumsum(Y)

Subject: Cummulative Distribution Function (CDF)

From: TideMan

Date: 27 Jun, 2012 21:53:14

Message: 3 of 8

On Thursday, June 28, 2012 9:37:08 AM UTC+12, Erik L wrote:
> Hi,
> I need to find the cumulative distribution for my data. The data which i got at the output is in the form:
> X=[1 2 3 4 5 6 7 8 9 10 11 12];
> Y=[0.92 0.87 0.79 0.71 0.90 0.83 0.71 0.8 0.99 0.89 0.88 0.78];
>
> where i draw X is on the x-axis and Y is on the y-axis.
> The result for my system output is always between 0.71 and 1.
> How can i find the CDF for this data; sorry i am not strong in statistics.
>
> thanks
>
> Erick.

First, you calculate the PDF using hist.
Second, you integrate the PDF to get the CDF using cumsum.
[n,bins]=hist(y);
p=n/length(y);
P=cumsum(p); % Prob less than
plot(P,bins)
or for probability greater than:
plot(1-P,bins)

But with only 12 data points, the CDF will not be reliable.

Subject: Cummulative Distribution Function (CDF)

From: Erik L

Date: 27 Jun, 2012 22:03:09

Message: 4 of 8

"Matt J" wrote in message <jsfv6j$m8c$1@newscl01ah.mathworks.com>...
> "Erik L" wrote in message <jsfue3$j4c$1@newscl01ah.mathworks.com>...
> > Hi,
> > I need to find the cumulative distribution for my data. The data which i got at the output is in the form:
> > X=[1 2 3 4 5 6 7 8 9 10 11 12];
> > Y=[0.92 0.87 0.79 0.71 0.90 0.83 0.71 0.8 0.99 0.89 0.88 0.78];
> >
> > where i draw X is on the x-axis and Y is on the y-axis.
> > The result for my system output is always between 0.71 and 1.
> > How can i find the CDF for this data; sorry i am not strong in statistics.
> ======
>
> cumsum(Y)

Thanks Matt,

i tried cumsum(Y)- can you tell me what i need to do further ? plot Z=cumsum(Y) ?

as i said i am not good in statistics- if you have any clue please share. will read about it in detail. What my tutor need is the CDF- i read about CDF but could not grab the concept to be honest.

thanks

Subject: Cummulative Distribution Function (CDF)

From: Matt J

Date: 28 Jun, 2012 10:49:07

Message: 5 of 8

"Erik L" wrote in message <jsfvut$paq$1@newscl01ah.mathworks.com>...
>
> >
> > cumsum(Y)
>
> Thanks Matt,
=============

Actually, Tideman is right. Normally, you will have to histogram your data first as in his code. In the data you showed, however, your data was already pre-histogrammed.

 
> i tried cumsum(Y)- can you tell me what i need to do further ? plot Z=cumsum(Y) ?
>
> as i said i am not good in statistics- if you have any clue please share. will read about it in detail. What my tutor need is the CDF- i read about CDF but could not grab the concept to be honest.
===============

I don't know what you need to do further, because you haven't mentioned the need to do anything else besides computing the histogram. If you want to plot the results, you can read the documentation on the PLOT command

help plot
doc plot

Subject: Cummulative Distribution Function (CDF)

From: TideMan

Date: 28 Jun, 2012 11:08:20

Message: 6 of 8

On Thursday, June 28, 2012 10:49:07 PM UTC+12, Matt J wrote:
> "Erik L" wrote in message <jsfvut$paq$1@newscl01ah.mathworks.com>...
> >
> > >
> > > cumsum(Y)
> >
> > Thanks Matt,
> =============
>
> Actually, Tideman is right. Normally, you will have to histogram your data first as in his code. In the data you showed, however, your data was already pre-histogrammed.
>
>
> > i tried cumsum(Y)- can you tell me what i need to do further ? plot Z=cumsum(Y) ?
> >
> > as i said i am not good in statistics- if you have any clue please share. will read about it in detail. What my tutor need is the CDF- i read about CDF but could not grab the concept to be honest.
> ===============
>
> I don't know what you need to do further, because you haven't mentioned the need to do anything else besides computing the histogram. If you want to plot the results, you can read the documentation on the PLOT command
>
> help plot
> doc plot

How can his data be "pre-histogrammed"?
What are these numbers:
Y=[0.92 0.87 0.79 0.71 0.90 0.83 0.71 0.8 0.99 0.89 0.88 0.78];
They cannot be probabilities because they should add to unity, neither are they the number of data in each bin.
So, what are they?

There's something screwy going on here......................

Subject: Cummulative Distribution Function (CDF)

From: Matt J

Date: 28 Jun, 2012 12:37:07

Message: 7 of 8

TideMan <mulgor@gmail.com> wrote in message <7930ff3a-67e6-4c74-b7fc-640c66c9bab3@googlegroups.com>...
>
> How can his data be "pre-histogrammed"?
> What are these numbers:
> Y=[0.92 0.87 0.79 0.71 0.90 0.83 0.71 0.8 0.99 0.89 0.88 0.78];
> They cannot be probabilities because they should add to unity, neither are they the number of data in each bin.
> So, what are they?
>
> There's something screwy going on here......................
============

I just assumed that X(i) were histogram bin indices for corresponding Y(i) and that this was just some sort of unnormalized distribution.

Subject: Cummulative Distribution Function (CDF)

From: Tom Lane

Date: 28 Jun, 2012 14:37:53

Message: 8 of 8

> I need to find the cumulative distribution for my data. The data which i
> got at the output is in the form:
> X=[1 2 3 4 5 6 7 8 9 10 11 12];
> Y=[0.92 0.87 0.79 0.71 0.90 0.83 0.71 0.8 0.99 0.89 0.88 0.78];

Erick, if you want a cdf of the Y values, and the X values simply represent
the order in which they were collected, you could try this:

stairs([min(Y),sort(Y)],(0:length(Y))/length(Y))

Otherwise, like the other posters, I don't know how to interpret your X and
Y values.

-- Tom

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us