Is there any python package that allows the efficient computation of the PDF (probability density function) of a multivariate normal distribution?
It doesn\'t seem to be
Here I elaborate a bit more on how exactly to use the multivariate_normal() from the scipy package:
# Import packages
import numpy as np
from scipy.stats import multivariate_normal
# Prepare your data
x = np.linspace(-10, 10, 500)
y = np.linspace(-10, 10, 500)
X, Y = np.meshgrid(x,y)
# Get the multivariate normal distribution
mu_x = np.mean(x)
sigma_x = np.std(x)
mu_y = np.mean(y)
sigma_y = np.std(y)
rv = multivariate_normal([mu_x, mu_y], [[sigma_x, 0], [0, sigma_y]])
# Get the probability density
pos = np.empty(X.shape + (2,))
pos[:, :, 0] = X
pos[:, :, 1] = Y
pd = rv.pdf(pos)