How to calculate the derivative of a multidimensional normal probability density function

Is there a built-in function that calculates the gradient value of a multidimensional normal probability density function for a given point?

Edit: found how to evaluate the derivative of a function in matlab? but that is not what i'm looking for

Edit2: owkay that I am using http://www.mathworks.co.uk/help/stats/mvnpdf.html case 3, looking for the value of the derivative with respect to X

+4
source share
1 answer

May I suggest you check out the Matrix Cookbook by Peterson and Pedersen (available free online - just Google). An analytical solution to your problem is p39, Equation 325 (2008 edition).

We don’t even need Matlab for this!

EDIT: As follows from YBE, perhaps I should include the solution in my answer. So, let p (x) denote a multidimensional Gaussian pdf characterized by the mean vector m and the covariance matrix S. Then:

dp (x) / dx = -p (x) * S ^ (- 1) * (x - m)

and

d ^ 2p / dx dx '= p (x) * (S ^ (- 1) (x - m) (x - m)' S ^ (- 1) - S ^ (- 1))

If you want the Matlab function, then:

function Gradient = MultNormD1(x, Mu, Sigma) Gradient = -1 * mvnpdf(x, Mu, Sigma) * (Sigma \ (x - Mu)); 
+3
source

Source: https://habr.com/ru/post/1444962/


All Articles