[R] Bhattacharyya in R

56 views
Skip to first unread message

Dzu

unread,
Jul 1, 2013, 4:47:56 PM7/1/13
to r-h...@r-project.org
Dear R-user,
I am trying to apply bhattacharyya-distance function to my data. Did anybody
use it before ?

My code is the following

#Bhattacharya Distance measure
#a and b are vectors
a <- (1,2,3,4,2,2,2,2,2,2,2,1,4,5,6,-1,-1,-1,-1,-1,-3,-3,-3)
b <-
(1.1,1.1,1.2,1.2,1.2,1.2,1.2,2.1,2.1,2.2,2.2,2,0,0,0,0,2,2,2,2,2,3.1,3.1)

dist <- bhattacharyya.matrix(a,b,missclasification = TRUE)
plot(dist)


Could somebody give me a guide on the syntax ?

Thanks
Dizem





--
View this message in context: http://r.789695.n4.nabble.com/Bhattacharyya-in-R-tp4670671.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.

Jeff Newmiller

unread,
Jul 1, 2013, 5:35:39 PM7/1/13
to Dzu, r-h...@r-project.org
There is a built-in guide to syntax called the help system. If you have read it you should be able to be mitre specific with your questions.

I had never heard of this function. Your example code is not reproducible, nor does it indicate what result you got from running it.

I used

RSiteSearch("bhattacharya")

and there appears to be a function bhattacharyya.matrix in the fpc package. The syntax indicated in the help for that function mentions wanting input matrices, not vectors. It also mentions another function bhattacharyya.dist which does accept vectors, but it does not accept the misclassification.bound argument.

You should read the help file and ask more specific questions and provide reproducible examples per the Posting Guide recommendations.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdne...@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.

Dzu <dizem...@alumni.fh-aachen.de> wrote:

>Dear R-user,
>I am trying to apply bhattacharyya-distance function to my data. Did
>anybody
>use it before ?
>
>My code is the following
>
>#Bhattacharya Distance measure
>#a and b are vectors
>a <- (1,2,3,4,2,2,2,2,2,2,2,1,4,5,6,-1,-1,-1,-1,-1,-3,-3,-3)
>b <-
>(1.1,1.1,1.2,1.2,1.2,1.2,1.2,2.1,2.1,2.2,2.2,2,0,0,0,0,2,2,2,2,2,3.1,3.1)
>
>dist <- bhattacharyya.matrix(a,b, misclassification.bound = TRUE)
Reply all
Reply to author
Forward
0 new messages