0

I'm unable to use SciPy and its modules for calculating the probability density function of a multivariate Gaussian distribution. I know that such modules exist, but I'm unable to use them (I can't even import scipy: I get the message: ImportError: No module named scipy).

I was wondering if there were any good tool or other way to calculate the pdf of a multivariate Gaussian distribution in python. Thanks in advance for the help!

CT Zhu
  • 52,648
  • 17
  • 120
  • 133
user3431370
  • 1
  • 2
  • 3

1 Answers1

0

It is provided by scipy.stats.multivariate_normal.pdf(): http://docs.scipy.org/doc/scipy-dev/reference/generated/scipy.stats.multivariate_normal.html. You will need to specify the mean and variance-covariance matrix.

Before that you need to install scipy if you have not done so. You can either download a .dmg installation package. Or try an 'distribution' such as Anaconda Python.

CT Zhu
  • 52,648
  • 17
  • 120
  • 133
  • Thanks very much for the reply. I've now installed SciPy (I first installed anaconda, and then I also used pip). After each, I am successfully able to "import scipy" and "import scipy.stats", but when I type "from scipy.stats import multivariate_normal" in my Python code, I encounted the error: "ImportError: cannot import name multivariate_normal". Do you have any ideas as to how I might be able to gain access to multivariate_normal so I can use the multivariate_normal.pdf() function? – user3431370 Mar 18 '14 at 17:55
  • You need `scipy` version>0.14.0 for this I believe. `Anaconda` is probably shipped with `0.13.3` or whatever the last stable release is. New versions are there: http://sourceforge.net/projects/scipy/files/scipy/0.14.0b1/. For `Anaconda` you probably has to install it from source. – CT Zhu Mar 18 '14 at 18:21