[SciPy-User] Evaluate normal distribution at certain point given the covariance matrix and mean

Skipper Seabold jsseabold at gmail.com
Sat May 28 13:18:58 EDT 2011


On Fri, May 27, 2011 at 5:43 AM, Stefan Otte <stefan.otte at gmail.com> wrote:
> Hello,
>
> I'm wondering if there is a function that evaluates a normal
> distribution at a certain point given the covariance matrix and mean.
> I already took a look at the stats module and, to my surprise, didn't
> find a function like that.
>
> NN(mean_of_distribution, covariance_matrix, point_to_evaluate)
>
> I ended up implementing it myself but I'm still wondering if this
> isn't a common task and why it's not included in the stats module.
>

For the univariate case, you can use scipy.stats.norm. I take it you
want the multivariate case? Others will know more, as I haven't looked
at the details, but I think you could use stats.mvn.* for the cdf. See
here [1,2] and the attachment to the ticket [3] for convenience
wrappers.

[1] http://thread.gmane.org/gmane.comp.python.scientific.user/18921
[2] http://projects.scipy.org/scipy/ticket/846
[3] http://projects.scipy.org/scipy/attachment/ticket/846/mvncdf.py

Skipper



More information about the SciPy-User mailing list