Calculate the distance from point p to the overall Gaussian (M, V)

I have a high Gaussian size with average M and covariance matrix V. I would like to calculate the distance from point p to M, taking V into account (I assume this is the distance in standard deviations p from M?).

Highlighted differently, I take an ellipse one sigma from M and would like to check if p is inside this ellipse.

+3
source share
3 answers

If Vis an admissible covariance matrix Gaussian, then it is symmetric positive definite and, therefore, defines a real scalar product. By the way, also inv(V).

, , M p -, :

d1 = sqrt((M-p)'*V*(M-p));
d2 = sqrt((M-p)'*inv(V)*(M-p));

Matlab d2 (, ):

d2 = sqrt((M-p)'*(V\(M-p)));

, V - , d1==d2 . , d1 d2, (, ). 1D-, - 1D ( ).

NB: / V (.. ).

, .

.

+2

, :

M = [1 -1];             %# mean vector
V = [.9 .4; .4 .3];     %# covariance matrix
p = [0.5 -1.5];         %# 2d-point
prob = mvnpdf(p,M,V);   %# probability P(p|mu,cov)

MVNPDF

+2

, , , : ?

:

foreach(dimension d)
    (M(d) - sigma(d) < p(d) < M(d) + sigma(d)) ?

, p . , , ( M , ).

MATLAB - :

all(M - sigma < p < M + sigma)

, . , dist:

dist(M, p)

Because M is just a point in space and p. Only 2 vectors. And now the last one. You want to know the distance in sigma form:

% create a distance vector and divide it by sigma
M - p ./ sigma

I think this will do the trick.

0
source

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


All Articles