From: carl on 12 Feb 2010 09:18 In my matlab code I use the mvnpdf function to compute the probability for a set of samples based on the following covariance matrix (Sigma) and mean (mu): mu = 0.9556 0.2994 0.2569 Sigma = 0.0082 0.0052 0.0067 0.0052 0.0171 0.0199 0.0067 0.0199 0.0241 prob = mvnpdf(X , mu, Sigma); where X is a 1000*3 matrix containing various samples. If I do: max(prob) I get: 197.3913 And if I do: sum(prob) I get: 1.2987e+006 I would expect that max(prob) would be 1 (since probabilites lies in the range [0;1]) and that max(prob) would also be 1 since the integral should sum to 1. I assume that me problem is that I mix the term: probability density function http://en.wikipedia.org/wiki/Probability_density_function with the term: probability distribution http://en.wikipedia.org/wiki/Discrete_probability_distribution But maybe someone could give me a hint to better understand the difference?
From: Brian Borchers on 12 Feb 2010 10:32 A probability density function (pdf) has to be integrated over some range of x values to obtain a probability. If the pdf is nonzero over a narrow range it's quite easy for the maximum of the pdf to be larger than one, even though the integral of the pdf from x=-infinity to x= +infinity is 1. For example, consider a random variable X that is uniformly distributed on the interval [0,1/2]. The pdf is f(x)=2 0<=x<=1/2. f(x)=0 x<0 or x>1/2. The probability that x is between 0 and 0.1 is P(0<=x<=0.1)=int(f,x=0..0.1)=0.2.
From: Peter Perkins on 12 Feb 2010 10:33 On 2/12/2010 9:18 AM, carl wrote: > In my matlab code I use the mvnpdf function to compute the probability > for a set of samples based on the following covariance matrix (Sigma) > and mean (mu): > I would expect that max(prob) would be 1 (since probabilites lies in the > range [0;1]) and that max(prob) would also be 1 since the integral > should sum to 1. The integral should _integrate_ to 1. For a discrete distribution, the individual probabilies must be less than or equal to one, because they must sum to one. But for a continuous distribution, it's an integral. Consider the uniform distribution on the interval [0,a]. It's uniform, so the density is a constant, call it c, and the integrl of the density over the interval [0,a], (a-0)*c == a*c, has to equal one. Thus the density has to be 1/a. When a is .5, say, the density is larger than one. More towards your specific question: try plotting normpdf(linspace(-1,1,1001),0,.1) and normcdf(linspace(-1,1,1001),0,.1) and compare the two. Probabilities have to be less than 1, Densities can be anything, even infinite (at individual points). Hope this helps.
From: carl on 12 Feb 2010 11:04 "Brian Borchers" <borchers.brian(a)gmail.com> wrote in message news:5a9bc554-5cf9-47fd-a610-b98217017a7a(a)g28g2000prb.googlegroups.com... >A probability density function (pdf) has to be integrated over some > range of x values to obtain a probability. If the pdf is nonzero over > a narrow range it's quite easy for the maximum of the pdf to be larger > than one, even though the integral of the pdf from x=-infinity to x= > +infinity is 1. > > For example, consider a random variable X that is uniformly > distributed on the interval [0,1/2]. The pdf is > > f(x)=2 0<=x<=1/2. > f(x)=0 x<0 or x>1/2. > > The probability that x is between 0 and 0.1 is > > P(0<=x<=0.1)=int(f,x=0..0.1)=0.2. Ok I thought that mvnpdf corresponded to this expression: http://upload.wikimedia.org/math/a/d/4/ad4c63257208b495d1084a74a15e0113.png which in the litterature is both referred to as the multivariate gaussian distribution, multivariate probability density and probability mass function. And that the plot would look like this: http://upload.wikimedia.org/wikipedia/commons/7/74/Normal_Distribution_PDF.svg depending on the parameters sigma and the mean. But cleary that this is not mvnpdf. Maybe its best to implement things from scratch to understand how they work.
From: John D'Errico on 12 Feb 2010 11:21 "carl" <carl@.com> wrote in message <4b757bff$0$283$14726298(a)news.sunsite.dk>... > > "Brian Borchers" <borchers.brian(a)gmail.com> wrote in message > news:5a9bc554-5cf9-47fd-a610-b98217017a7a(a)g28g2000prb.googlegroups.com... > >A probability density function (pdf) has to be integrated over some > > range of x values to obtain a probability. If the pdf is nonzero over > > a narrow range it's quite easy for the maximum of the pdf to be larger > > than one, even though the integral of the pdf from x=-infinity to x= > > +infinity is 1. > > > > For example, consider a random variable X that is uniformly > > distributed on the interval [0,1/2]. The pdf is > > > > f(x)=2 0<=x<=1/2. > > f(x)=0 x<0 or x>1/2. > > > > The probability that x is between 0 and 0.1 is > > > > P(0<=x<=0.1)=int(f,x=0..0.1)=0.2. > > Ok I thought that mvnpdf corresponded to this expression: > > http://upload.wikimedia.org/math/a/d/4/ad4c63257208b495d1084a74a15e0113.png > > which in the litterature is both referred to as the multivariate gaussian > distribution, multivariate probability density and probability mass > function. > > And that the plot would look like this: > > http://upload.wikimedia.org/wikipedia/commons/7/74/Normal_Distribution_PDF.svg > > depending on the parameters sigma and the mean. But cleary that this is not > mvnpdf. Maybe its best to implement things from scratch to understand how > they work. It does correspond to that expression. But you need to appreciate that that expression can easily be larger than 1. Only the integral must be 1. John
|
Next
|
Last
Pages: 1 2 Prev: Problem with Linear Constraint Equations ("portopt()" function) Next: digitalio buffer |