[R] Density estimation

Gunther Jansen gunther.jansen at gmail.com
Wed Apr 23 12:58:49 CEST 2008


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



More information about the R-help mailing list