I have two estimates of two points in space - each has a 3D position and a cigar shaped 3x3 covariance matrix and I am checking the hypothesis that these observations are actually referencing the one and same point. So I would like to calculate the agreement of the two observations with this assumption.
A search brings up Bhattacharyya distance, or Kullback–Leibler divergence as candidates. I am not looking for the most correct estimate, but rather an easy to implement function which takes two positions and two 3x3 matrices and returns a percentage or distance in standard deviations.
Here are some similar threads:
Mahalanobis distance between two bivariate distributions with different covariances
Measures of similarity or distance between two covariance matrices
bhattacharyya.dist <- function(mu1, mu2, Sigma1, Sigma2){ aggregatesigma <- (Sigma1+Sigma2)/2 d1 <- mahalanobis(mu1,mu2,aggregatesigma)/8 d2 <- log(det(as.matrix(aggregatesigma))/sqrt(det(as.matrix(Sigma1))* det(as.matrix(Sigma2))))/2 out <- d1+d2 out }
, but I don't understand why the div/8. $\endgroup$ – bgp2000 Mar 29 '17 at 15:30