[R] adding a method to the dist function

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon May 3 12:16:25 CEST 2004


On Mon, 3 May 2004, Giampiero Salvi wrote:

> Hi all,
> I'd like to add the Bhattacharyya method to the dist function.
> What is the best way to do this? I'm using R 1.9.0 and I was looking
> for the code that defines the already existing distances, but I didn't
> manage. As far as I understand, dist is defined in mva that is part
> of the stats package now, but where is the code?

In src/library/stats/src/distance.c

Where else did you think the C source code for the stats package would be
but src/library/stats/src?

You will need to add your own function, and BTW, I don't think `the 
Bhattacharyya method' is appropriate for dist, as it is defined for 
distributions, not data items.  It's even defined that way in your own 
paper

http://www.speech.kth.se/ctt/publications/papers03/icphs03_giampi.pdf

although you make Gaussian assumptions about the distributions whihc you 
did not in your posting.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list