On Fri, Dec 5, 2008 at 3:59 PM, Chang Jia-Ming <[EMAIL PROTECTED]> wrote: > Dear all, > > I wrote the following code to calculate the density functions for two data > sets, respectively. > > den_str <-density(str_data$Similarity); > den_non_str <-density(nonstr_data$Similarity); > > However, I would like to knowing the difference between den_str and > den_non_str, that is, the difference between the region under the curve of > the den_str and the region under the curve of the den_non_str.
One way of calculating the difference between two density functions (or more general histograms), is the Earth Movers Distance (e.g.http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/RUBNER/emd.htm or http://en.wikipedia.org/wiki/Earth_Mover's_Distance ). Dirk Eddelbuettel and myself are finalizing an implementation of it and it will be available as soon as some licensing issues are sorted out, which will be hopefully rather soon. If you don't want to wait till the release, please drop either Dirk or myself an email and we could mail you the package. As I said, the implementation is working (I am using it in a research project at the moment), it is just that the license is at the moment nonprofit research only. Rainer > > How to do? > > Thank you for help. > > Jia-Ming > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Faculty of Science Natural Sciences Building Private Bag X1 University of Stellenbosch Matieland 7602 South Africa ______________________________________________ R-help@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.