[R] Bhattacharyya distance metric

0 views
Skip to first unread message

Diana Garrett

unread,
Nov 5, 2009, 3:25:37 PM11/5/09
to r-h...@r-project.org

I need to use the Bhattacharyya distance metric to determine population
separation. Has anyone written a Bhattacharyya distance metric function in
R?
--
View this message in context: http://old.nabble.com/Bhattacharyya-distance-metric-tp26221259p26221259.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-h...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Νίκος Αλεξανδρής

unread,
Nov 5, 2009, 9:11:34 PM11/5/09
to Diana Garrett, r-h...@r-project.org
On Thu, 2009-11-05 at 12:25 -0800, Diana Garrett wrote:
> I need to use the Bhattacharyya distance metric to determine population
> separation. Has anyone written a Bhattacharyya distance metric function in
> R?

Something like this ( I think it's correct ):

--%<---
DBhat <- function(X1,X2){
# define means
mX1 <- mean(X1)
mX2 <- mean(X2)

# define difference of means
mDiff <- mX1 - mX2

# define cov
cvX1 <- cov(X1)
cvX2 <- cov(X2)

# define halfsum of cv's
p <- (cvX1+cvX2)/2

# the equation
0.125 * t(mDiff) * p^(-1) * mDiff + 0.5 * log10( det(p) /
sqrt( det(cvX1) * det(cvX2) ))
--%<---

A related thread (in grass-stats):
http://www.mail-archive.com/grass...@lists.osgeo.org/msg00183.html

Regards, Nikos

Liaw, Andy

unread,
Nov 6, 2009, 9:24:30 AM11/6/09
to Diana Garrett, r-h...@r-project.org
Is that another name for the Mahalanobis distance? See ?mahalanobis.

Notice: This e-mail message, together with any attachme...{{dropped:10}}

jude...@ubs.com

unread,
Nov 9, 2009, 11:30:40 AM11/9/09
to andy...@merck.com, r-h...@r-project.org
The Bhattacharyya distance is different from the Mahalanobis distance.
See:

http://en.wikipedia.org/wiki/Bhattacharyya_distance

There is also the Hellinger Distance and the Rao distance. For the Rao
distance, see:

http://www.scholarpedia.org/article/Fisher-Rao_metric

Jude

___________________________________________
Jude Ryan
Director, Client Analytical Services
Strategy & Business Development
UBS Financial Services Inc.
1200 Harbor Boulevard, 4th Floor
Weehawken, NJ 07086-6791
Tel. 201-352-1935
Fax 201-272-2914
Email: jude...@ubs.com

disclaim.txt
Reply all
Reply to author
Forward
0 new messages