[R] Multiple density plots on 1 graph

Berton Gunter gunter.berton at gene.com
Wed Sep 21 19:48:45 CEST 2005


Emma:

1. I don't know what you mean by "empirical density of the data." I'm pretty
sure that overlaying 50, say, kernel density estimators (with the same
kernels?) would produce a completely useless mess. Ditto, I would think, for
anything that looks something like a kernel density (histograms, frequency
polygons, etc.).

2. You might be able to see something using empirical cumulative
distribution functions (?ecdf), so I suggest you consider that instead.

3. Better yet, as was suggested by Max Kuhn, try lattice plots of ecdf's (or
possibly kernel density estimators) with the lattice arrangement determined
by factors of interest or ordered by some useful summary statistic (e.g.
median) of the distributions. Or perhaps use qqmath if the data come from
some known distributional form (Gaussian, gamma, ...). Ordering the lattice
plots in an informative way can reveal a great deal more.

4. Thinking more carefully about what you want to show and what you want to
learn from these plots should help you decide what to do. Then you can use R
to do it (usually easily).


-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box
 
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of emma hartnett
> Sent: Wednesday, September 21, 2005 8:58 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Multiple density plots on 1 graph
> 
> I want to overlay 50 denisty plots on a single plot. 
> For each plot there are 10,000 data points and i want
> the empirical density of the data. I have not been
> able to find an easy way to achieve this (I have
> scoured the manula and website so sorry if I missed
> it!), does anyone have any suggestions?
> 
> Thankyou.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list