[R] evaluating density objects
Liaw, Andy
andy_liaw at merck.com
Fri Nov 15 17:46:12 CET 2002
Are you talking about overlaying all the density estimates in the same plot?
If you have the density estimates in a matrix, just use something like:
matplot(X, density.X, type="l")
where X is the vector of points where density is estimated (e.g., the x
component of a density object) and density.X is the matrix containing the
density estimates. Check out the options to matplot in its help page.
HTH,
Andy
-----Original Message-----
From: Hinnerk Boriss [mailto:boriss at izbi.uni-leipzig.de]
Sent: Friday, November 15, 2002 10:57 AM
To: ripley at stats.ox.ac.uk
Cc: R-help at stat.math.ethz.ch
Subject: RE: [R] evaluating density objects
Thanks for all the suggestions!
> dens <- density(...)
> write.table(data.frame(x=dens$x, y=dens$y), "somefile")
>
> I have no idea why anyone would want to plot in gnuplot
> rather than in R,
> and hence don't know what formats gnuplot accepts.
The point is that I want to plot many densities in one graph. I can do
that with R using par(new=T), but I cannot print those graphs.
Thus, I wonder if I could also apply (lapply) density(...) to a vector
of x-values, to get a my different density functions evaluated all at
the same x. Then, I should be able to write a file that looks like:
X dens1(X) dens2(X) ...
Can anyone help?
Cheers,
Hinnerk
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.
==============================================================================
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list