Look at the logspline package. It has a different way of estimating densities that allows for limits to be specified (i.e. probability is 0 beyond the point(s) you specify).
Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Gunther Jansen > Sent: Wednesday, April 23, 2008 4:59 AM > To: r-help@r-project.org > Subject: [R] Density estimation > > Hi, > > I am analysing a dataset containing genetic distances within > and between species. I want to show a overlap of the > distributions of the intra- and interspecific values; on a > second graph I use a cut-off value to determine these > boundaries. As the dataset contains >30 000 values, I would > like to do this with a simple line rather than superimposed > histograms. Hence, density plots. With the standard settings > of plot(density(x)), I receive the desirable result, except > that the function extends slightly in negative x values > (which is impossible, distance values are always positive). > Furthermore, in the second figure I supplied the cut-off > value a priori, so overlap between the two classes is zero by > definition. Is there a way to visualise this information in > another way, or to readjust the density parameters so > intraspecific values below zero have zero probability in the > first case, and there is no overlap in the second case? > > > Thanks, > > gunther > > ______________________________________________ > 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.