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:
probability density function

Subject: probability density function

From: CNN

Date: 31 Aug, 2010 18:47:19

Message: 1 of 12

I just read an article using a probability density function (PDF) to display the results. Now despite the numbers in the original data, all the values in the PDF are between zero (0) and one (1). I'm really new to this so I was wondering which PDF function would produce something like that.
The original data contain both positive and negative numbers.

Subject: probability density function

From: ImageAnalyst

Date: 31 Aug, 2010 18:55:14

Message: 2 of 12

On Aug 31, 2:47 pm, "CNN " <cnln2...@yahoo.co.uk> wrote:
> I just read an article using a probability density function (PDF) to display the results. Now despite the numbers in the original data, all the values in the PDF are between zero (0) and one (1). I'm really new to this so I was wondering which PDF function would produce something like that.
> The original data contain both positive and negative numbers.

------------------------------------------------------------------------------------------------------------------------------------------------------
Well, all of them. Because the integral of the PDF from -infinity to
+infinity has to be 1.0 (100%), so that means any given value in
between is certainly less than 1. The original data can go from any
starting value to any other ending value - doesn't matter. Positive,
negative - doesn't matter at all. The value is the probability that
that number will occur.

Subject: probability density function

From: Wayne King

Date: 31 Aug, 2010 19:13:05

Message: 3 of 12

"CNN " <cnln2000@yahoo.co.uk> wrote in message <i5jinn$ova$1@fred.mathworks.com>...
> I just read an article using a probability density function (PDF) to display the results. Now despite the numbers in the original data, all the values in the PDF are between zero (0) and one (1). I'm really new to this so I was wondering which PDF function would produce something like that.
> The original data contain both positive and negative numbers.

Keep in mind that if the random variable is discrete, the values of the probability mass function are interpretable as probabilities directly.

However, if you really have a probability density function, then the values of the pdf are not directly interpretable as probabilities. All you can say for sure is that they are nonnegative. You have to integrate the pdf over a set of nonzero length, area, or volume (measure) to find a probability. If you have the Statistics Toolbox, note the difference between

x = linspace(-3,3,1000);
y = normpdf(x,0,.5);
plot(x,y)
figure;
y1 = normpdf(x,0,.1);
plot(x,y1)

In the latter case, the pdf assumes values greater than 1.

Wayne

Subject: probability density function

From: Jomar Bueyes

Date: 31 Aug, 2010 19:15:19

Message: 4 of 12

On Aug 31, 2:55 pm, ImageAnalyst <imageanal...@mailinator.com> wrote:
> On Aug 31, 2:47 pm, "CNN " <cnln2...@yahoo.co.uk> wrote:
>
> > I just read an article using a probability density function (PDF) to display the results. Now despite the numbers in the original data, all the values in the PDF are between zero (0) and one (1). I'm really new to this so I was wondering which PDF function would produce something like that.
> > The original data contain both positive and negative numbers.
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------
> Well, all of them.  Because the integral of the PDF from -infinity to
> +infinity has to be 1.0 (100%), so that means any given value in
> between is certainly less than 1.  The original data can go from any
> starting value to any other ending value - doesn't matter.  Positive,
> negative - doesn't matter at all.  The value is the probability that
> that number will occur.

That is not quite correct. The cumulative distribution function (CDF) -
the integral of the PDF indeed has values only between (and including)
zero and one. However, the probability density function (PDF) is not
restricted to be less than one. For example, a Normal distribution
with a variance smaller than 1/2pi has a values greater than 1.0 near
its mean. On the other hand, if the random variable were discrete,
then it would have a probability mass function (pmf) instead of a PDF.
The pmf indeed takes values only between zero and one.

HTH

Jomar

Subject: probability density function

From: CNN

Date: 31 Aug, 2010 19:36:21

Message: 5 of 12

"Wayne King" <wmkingty@gmail.com> wrote in message <i5jk80$7da$1@fred.mathworks.com>...
> "CNN " <cnln2000@yahoo.co.uk> wrote in message <i5jinn$ova$1@fred.mathworks.com>...
> > I just read an article using a probability density function (PDF) to display the results. Now despite the numbers in the original data, all the values in the PDF are between zero (0) and one (1). I'm really new to this so I was wondering which PDF function would produce something like that.
> > The original data contain both positive and negative numbers.
>
> Keep in mind that if the random variable is discrete, the values of the probability mass function are interpretable as probabilities directly.
>
> However, if you really have a probability density function, then the values of the pdf are not directly interpretable as probabilities. All you can say for sure is that they are nonnegative. You have to integrate the pdf over a set of nonzero length, area, or volume (measure) to find a probability. If you have the Statistics Toolbox, note the difference between
>
> x = linspace(-3,3,1000);
> y = normpdf(x,0,.5);
> plot(x,y)
> figure;
> y1 = normpdf(x,0,.1);
> plot(x,y1)
>
> In the latter case, the pdf assumes values greater than 1.
>
> Wayne
I'm now more confused than ever. This is the code I ran
Y = normpdf(N,mean(N),std(N,1))
and

Z = pdf('Normal',N,mean(N),std(N,1))

I was just following the instructions from the help file. 'N' is the array that I want to evaluate.

Subject: probability density function

From: CNN

Date: 31 Aug, 2010 20:09:04

Message: 6 of 12

Jomar Bueyes <jomarbueyes@hotmail.com> wrote in message <c2822b07-76d9-4afa-9e57-1facabec7d43@j18g2000yqd.googlegroups.com>...
> On Aug 31, 2:55 pm, ImageAnalyst <imageanal...@mailinator.com> wrote:
> > On Aug 31, 2:47 pm, "CNN " <cnln2...@yahoo.co.uk> wrote:
> >
> > > I just read an article using a probability density function (PDF) to display the results. Now despite the numbers in the original data, all the values in the PDF are between zero (0) and one (1). I'm really new to this so I was wondering which PDF function would produce something like that.
> > > The original data contain both positive and negative numbers.
> >
> > ------------------------------------------------------------------------------------------------------------------------------------------------------
> > Well, all of them.  Because the integral of the PDF from -infinity to
> > +infinity has to be 1.0 (100%), so that means any given value in
> > between is certainly less than 1.  The original data can go from any
> > starting value to any other ending value - doesn't matter.  Positive,
> > negative - doesn't matter at all.  The value is the probability that
> > that number will occur.
>
> That is not quite correct. The cumulative distribution function (CDF) -
> the integral of the PDF indeed has values only between (and including)
> zero and one. However, the probability density function (PDF) is not
> restricted to be less than one. For example, a Normal distribution
> with a variance smaller than 1/2pi has a values greater than 1.0 near
> its mean. On the other hand, if the random variable were discrete,
> then it would have a probability mass function (pmf) instead of a PDF.
> The pmf indeed takes values only between zero and one.
>
> HTH
>
> Jomar

Okay I tried using CDF and it worked. However, I have a gradually increasing S-shaped curve from zero to one and I was expecting a series of peaks. Or does the function produce a standard shape?

Subject: probability density function

From: Wayne King

Date: 31 Aug, 2010 21:34:04

Message: 7 of 12

"CNN " <cnln2000@yahoo.co.uk> wrote in message <i5jnh0$f23$1@fred.mathworks.com>...
> Jomar Bueyes <jomarbueyes@hotmail.com> wrote in message <c2822b07-76d9-4afa-9e57-1facabec7d43@j18g2000yqd.googlegroups.com>...
> > On Aug 31, 2:55 pm, ImageAnalyst <imageanal...@mailinator.com> wrote:
> > > On Aug 31, 2:47 pm, "CNN " <cnln2...@yahoo.co.uk> wrote:
> > >
> > > > I just read an article using a probability density function (PDF) to display the results. Now despite the numbers in the original data, all the values in the PDF are between zero (0) and one (1). I'm really new to this so I was wondering which PDF function would produce something like that.
> > > > The original data contain both positive and negative numbers.
> > >
> > > ------------------------------------------------------------------------------------------------------------------------------------------------------
> > > Well, all of them.  Because the integral of the PDF from -infinity to
> > > +infinity has to be 1.0 (100%), so that means any given value in
> > > between is certainly less than 1.  The original data can go from any
> > > starting value to any other ending value - doesn't matter.  Positive,
> > > negative - doesn't matter at all.  The value is the probability that
> > > that number will occur.
> >
> > That is not quite correct. The cumulative distribution function (CDF) -
> > the integral of the PDF indeed has values only between (and including)
> > zero and one. However, the probability density function (PDF) is not
> > restricted to be less than one. For example, a Normal distribution
> > with a variance smaller than 1/2pi has a values greater than 1.0 near
> > its mean. On the other hand, if the random variable were discrete,
> > then it would have a probability mass function (pmf) instead of a PDF.
> > The pmf indeed takes values only between zero and one.
> >
> > HTH
> >
> > Jomar
>
> Okay I tried using CDF and it worked. However, I have a gradually increasing S-shaped curve from zero to one and I was expecting a series of peaks. Or does the function produce a standard shape?

The CDF is, F(x), is the integral of the PDF from -infty to x so it is an increasing function as you observe. The CDF, unlike the PDF, does have a range between [0,1] since it is the probability that the random variable assumes a value in the interval (-infty,x].

The "S"-shape you mention is what you expect for continuous random variables, while for discrete random variables, the CDF exhibits jumps (increases) in value, but still lies between [0,1].

Wayne

Subject: probability density function

From: CNN

Date: 31 Aug, 2010 21:55:06

Message: 8 of 12

"Wayne King" <wmkingty@gmail.com> wrote in message <i5jsgc$bsp$1@fred.mathworks.com>...
> "CNN " <cnln2000@yahoo.co.uk> wrote in message <i5jnh0$f23$1@fred.mathworks.com>...
> > Jomar Bueyes <jomarbueyes@hotmail.com> wrote in message <c2822b07-76d9-4afa-9e57-1facabec7d43@j18g2000yqd.googlegroups.com>...
> > > On Aug 31, 2:55 pm, ImageAnalyst <imageanal...@mailinator.com> wrote:
> > > > On Aug 31, 2:47 pm, "CNN " <cnln2...@yahoo.co.uk> wrote:
> > > >
> > > > > I just read an article using a probability density function (PDF) to display the results. Now despite the numbers in the original data, all the values in the PDF are between zero (0) and one (1). I'm really new to this so I was wondering which PDF function would produce something like that.
> > > > > The original data contain both positive and negative numbers.
> > > >
> > > > ------------------------------------------------------------------------------------------------------------------------------------------------------
> > > > Well, all of them.  Because the integral of the PDF from -infinity to
> > > > +infinity has to be 1.0 (100%), so that means any given value in
> > > > between is certainly less than 1.  The original data can go from any
> > > > starting value to any other ending value - doesn't matter.  Positive,
> > > > negative - doesn't matter at all.  The value is the probability that
> > > > that number will occur.
> > >
> > > That is not quite correct. The cumulative distribution function (CDF) -
> > > the integral of the PDF indeed has values only between (and including)
> > > zero and one. However, the probability density function (PDF) is not
> > > restricted to be less than one. For example, a Normal distribution
> > > with a variance smaller than 1/2pi has a values greater than 1.0 near
> > > its mean. On the other hand, if the random variable were discrete,
> > > then it would have a probability mass function (pmf) instead of a PDF.
> > > The pmf indeed takes values only between zero and one.
> > >
> > > HTH
> > >
> > > Jomar
> >
> > Okay I tried using CDF and it worked. However, I have a gradually increasing S-shaped curve from zero to one and I was expecting a series of peaks. Or does the function produce a standard shape?
>
> The CDF is, F(x), is the integral of the PDF from -infty to x so it is an increasing function as you observe. The CDF, unlike the PDF, does have a range between [0,1] since it is the probability that the random variable assumes a value in the interval (-infty,x].
>
> The "S"-shape you mention is what you expect for continuous random variables, while for discrete random variables, the CDF exhibits jumps (increases) in value, but still lies between [0,1].
>
> Wayne

Continuous as in gradually increasing? My data is discrete, specifically, the y-position of particles in a fluid flow. Since each particle is independent from the other, the data should be discrete.

CNN

Subject: probability density function

From: Wayne King

Date: 31 Aug, 2010 22:37:04

Message: 9 of 12

"CNN " <cnln2000@yahoo.co.uk> wrote in message <i5jtnq$n8$1@fred.mathworks.com>...
> "Wayne King" <wmkingty@gmail.com> wrote in message <i5jsgc$bsp$1@fred.mathworks.com>...
> > "CNN " <cnln2000@yahoo.co.uk> wrote in message <i5jnh0$f23$1@fred.mathworks.com>...
> > > Jomar Bueyes <jomarbueyes@hotmail.com> wrote in message <c2822b07-76d9-4afa-9e57-1facabec7d43@j18g2000yqd.googlegroups.com>...
> > > > On Aug 31, 2:55 pm, ImageAnalyst <imageanal...@mailinator.com> wrote:
> > > > > On Aug 31, 2:47 pm, "CNN " <cnln2...@yahoo.co.uk> wrote:
> > > > >
> > > > > > I just read an article using a probability density function (PDF) to display the results. Now despite the numbers in the original data, all the values in the PDF are between zero (0) and one (1). I'm really new to this so I was wondering which PDF function would produce something like that.
> > > > > > The original data contain both positive and negative numbers.
> > > > >
> > > > > ------------------------------------------------------------------------------------------------------------------------------------------------------
> > > > > Well, all of them.  Because the integral of the PDF from -infinity to
> > > > > +infinity has to be 1.0 (100%), so that means any given value in
> > > > > between is certainly less than 1.  The original data can go from any
> > > > > starting value to any other ending value - doesn't matter.  Positive,
> > > > > negative - doesn't matter at all.  The value is the probability that
> > > > > that number will occur.
> > > >
> > > > That is not quite correct. The cumulative distribution function (CDF) -
> > > > the integral of the PDF indeed has values only between (and including)
> > > > zero and one. However, the probability density function (PDF) is not
> > > > restricted to be less than one. For example, a Normal distribution
> > > > with a variance smaller than 1/2pi has a values greater than 1.0 near
> > > > its mean. On the other hand, if the random variable were discrete,
> > > > then it would have a probability mass function (pmf) instead of a PDF.
> > > > The pmf indeed takes values only between zero and one.
> > > >
> > > > HTH
> > > >
> > > > Jomar
> > >
> > > Okay I tried using CDF and it worked. However, I have a gradually increasing S-shaped curve from zero to one and I was expecting a series of peaks. Or does the function produce a standard shape?
> >
> > The CDF is, F(x), is the integral of the PDF from -infty to x so it is an increasing function as you observe. The CDF, unlike the PDF, does have a range between [0,1] since it is the probability that the random variable assumes a value in the interval (-infty,x].
> >
> > The "S"-shape you mention is what you expect for continuous random variables, while for discrete random variables, the CDF exhibits jumps (increases) in value, but still lies between [0,1].
> >
> > Wayne
>
> Continuous as in gradually increasing? My data is discrete, specifically, the y-position of particles in a fluid flow. Since each particle is independent from the other, the data should be discrete.
>
> CNN

Continuous as in the random variable can take in principle an uncountably infinite number of values. From your description, I would say that your random variable is continuous. Of course all data are ultimately discrete since we measure them with finite precision, but underlying the position would be continuous. We would model that as a continuous random variable.
Wayne

Subject: probability density function

From: CNN

Date: 31 Aug, 2010 23:18:06

Message: 10 of 12

"Wayne King" <wmkingty@gmail.com> wrote in message <i5k06g$7u2$1@fred.mathworks.com>...
> "CNN " <cnln2000@yahoo.co.uk> wrote in message <i5jtnq$n8$1@fred.mathworks.com>...
> > "Wayne King" <wmkingty@gmail.com> wrote in message <i5jsgc$bsp$1@fred.mathworks.com>...
> > > "CNN " <cnln2000@yahoo.co.uk> wrote in message <i5jnh0$f23$1@fred.mathworks.com>...
> > > > Jomar Bueyes <jomarbueyes@hotmail.com> wrote in message <c2822b07-76d9-4afa-9e57-1facabec7d43@j18g2000yqd.googlegroups.com>...
> > > > > On Aug 31, 2:55 pm, ImageAnalyst <imageanal...@mailinator.com> wrote:
> > > > > > On Aug 31, 2:47 pm, "CNN " <cnln2...@yahoo.co.uk> wrote:
> > > > > >
> > > > > > > I just read an article using a probability density function (PDF) to display the results. Now despite the numbers in the original data, all the values in the PDF are between zero (0) and one (1). I'm really new to this so I was wondering which PDF function would produce something like that.
> > > > > > > The original data contain both positive and negative numbers.
> > > > > >
> > > > > > ------------------------------------------------------------------------------------------------------------------------------------------------------
> > > > > > Well, all of them.  Because the integral of the PDF from -infinity to
> > > > > > +infinity has to be 1.0 (100%), so that means any given value in
> > > > > > between is certainly less than 1.  The original data can go from any
> > > > > > starting value to any other ending value - doesn't matter.  Positive,
> > > > > > negative - doesn't matter at all.  The value is the probability that
> > > > > > that number will occur.
> > > > >
> > > > > That is not quite correct. The cumulative distribution function (CDF) -
> > > > > the integral of the PDF indeed has values only between (and including)
> > > > > zero and one. However, the probability density function (PDF) is not
> > > > > restricted to be less than one. For example, a Normal distribution
> > > > > with a variance smaller than 1/2pi has a values greater than 1.0 near
> > > > > its mean. On the other hand, if the random variable were discrete,
> > > > > then it would have a probability mass function (pmf) instead of a PDF.
> > > > > The pmf indeed takes values only between zero and one.
> > > > >
> > > > > HTH
> > > > >
> > > > > Jomar
> > > >
> > > > Okay I tried using CDF and it worked. However, I have a gradually increasing S-shaped curve from zero to one and I was expecting a series of peaks. Or does the function produce a standard shape?
> > >
> > > The CDF is, F(x), is the integral of the PDF from -infty to x so it is an increasing function as you observe. The CDF, unlike the PDF, does have a range between [0,1] since it is the probability that the random variable assumes a value in the interval (-infty,x].
> > >
> > > The "S"-shape you mention is what you expect for continuous random variables, while for discrete random variables, the CDF exhibits jumps (increases) in value, but still lies between [0,1].
> > >
> > > Wayne
> >
> > Continuous as in gradually increasing? My data is discrete, specifically, the y-position of particles in a fluid flow. Since each particle is independent from the other, the data should be discrete.
> >
> > CNN
>
> Continuous as in the random variable can take in principle an uncountably infinite number of values. From your description, I would say that your random variable is continuous. Of course all data are ultimately discrete since we measure them with finite precision, but underlying the position would be continuous. We would model that as a continuous random variable.
> Wayne

Sorry, but I don't get it.
CNN

Subject: probability density function

From: ImageAnalyst

Date: 31 Aug, 2010 23:50:17

Message: 11 of 12

Your data appears to be continuous because "the y-position of
particles in a fluid flow" should be able to take on any value,
between, say, 0 and 5 cm. Or am I wrong? Are you only able to
measure your position to the nearest cm, like sensing that it's at 1
cm, 2 cm, 3 cm, 4 cm, or 5 cm, and it's not possible for you to find
your particle at 2.523445234 cm?

Subject: probability density function

From: CNN

Date: 1 Sep, 2010 00:32:06

Message: 12 of 12

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <a5b914cd-ece3-4a89-bc02-698fd83970f5@j18g2000yqd.googlegroups.com>...
> Your data appears to be continuous because "the y-position of
> particles in a fluid flow" should be able to take on any value,
> between, say, 0 and 5 cm. Or am I wrong? Are you only able to
> measure your position to the nearest cm, like sensing that it's at 1
> cm, 2 cm, 3 cm, 4 cm, or 5 cm, and it's not possible for you to find
> your particle at 2.523445234 cm?

My data is from -0.2 to 0.2 and it can take any value. No rounding up is required or carried out . When i view them with Matlab, they rare usually in 4 decimal places.
CNN

Tags for this Thread

No tags are associated with 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