pdf for multivariate normal function?
hi all, i'm trying to find the function for the pdf of a multivariate normal pdf. i know that the function "multivariate_normal" can be used to sample from the multivariate normal distribution, but i just want to get the pdf for a given vector of means and a covariance matrix. is there a function to do this? thank you.
On Thu, Jul 23, 2009 at 7:14 AM, per freem
hi all,
i'm trying to find the function for the pdf of a multivariate normal pdf. i know that the function "multivariate_normal" can be used to sample from the multivariate normal distribution, but i just want to get the pdf for a given vector of means and a covariance matrix. is there a function to do this?
Well, what does a pdf mean in the multidimensional case? One way to convert the density function into a Stieltjes type measure is to plot the integral over a polytope with one corner at [-inf, -inf,....] and the diagonally opposite corner at the plotting point, but the multidimensional display of the result might not be very informative. What do you actually want here? Chuck
Hi, Charles R Harris wrote:
On Thu, Jul 23, 2009 at 7:14 AM, per freem
mailto:perfreem@gmail.com> wrote: i'm trying to find the function for the pdf of a multivariate normal pdf. i know that the function "multivariate_normal" can be used to sample from the multivariate normal distribution, but i just want to get the pdf for a given vector of means and a covariance matrix. is there a function to do this?
Well, what does a pdf mean in the multidimensional case? One way to convert the density function into a Stieltjes type measure is to plot the integral over a polytope with one corner at [-inf, -inf,....] and the diagonally opposite corner at the plotting point, but the multidimensional display of the result might not be very informative. What do you actually want here?
You are confusing PDF (Probability Density Functions) with CDF (Cumulative Density Function), I think. The PDF is well-defined for multivariate distributions. It is defined so that P(x) dx is the probability to be in the infinitesimal range (x,x+dx). For a multivariate gaussian, it's P(x|m, C) = [1/det(2 pi C)] exp{ -1/2 (x-m)^T C^{-1} (x-m) } in matrix notation, where m is the mean and C is the covariance matrix. Andrew
per freem wrote:
hi all,
i'm trying to find the function for the pdf of a multivariate normal pdf. i know that the function "multivariate_normal" can be used to sample from the multivariate normal distribution, but i just want to get the pdf for a given vector of means and a covariance matrix. is there a function to do this?
AFAIK, there is no such function in scipy. There is one in the em subpackage of the learn scikits. The file which implements it is self-contained, so you could use this in the meantime: http://projects.scipy.org/scikits/browser/trunk/learn/scikits/learn/machine/... I wrote this code some time ago, so it is not optimal in various ways, but it should get the job done. cheers, David
participants (4)
-
Andrew Jaffe
-
Charles R Harris
-
David Cournapeau
-
per freem