[R] Cumulative distribution estimation
Thomas Lumley
thomas at biostat.washington.edu
Thu Jul 27 17:05:31 CEST 2000
On Thu, 27 Jul 2000, Murray Jorgensen wrote:
> Apologies for bothering the list for something that I could probably have
> worked out myself had I brought my V&R in to work!
>
> I have been asked how to construct useable cdf's and quantile functions
> from density() output. If I were using Minitab I'd begin by making partial
> sums of the density values and normalizing to a maximum of 1, but I don't
> know the R analogue to the Minitab PARSUMS command.
Cumulative sums are done with the cumsum() function (apropos("sum") might
have been one way to find out, or help.search("cumulative"))
If d is a density object then at least approximately what you want is
cumsum(d$y*c(0,diff(d$x)))
(there may be an off-by-one error).
In reasonably large samples I don't think this improves on the empirical
CDF, though.
-thomas
Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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