In general, comparing two continuous densities is difficult because they can differ on a set of measure 0 (i.e., at a single point) and yet have the same distribution function.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chang Jia-Ming Sent: Friday, December 05, 2008 8:00 AM To: r-help@r-project.org Subject: [R] How to calculate the distance between two density functions 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. 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. ______________________________________________ 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.