[R] R function for percentrank
ggrothendieck at gmail.com
Thu Dec 6 13:40:10 CET 2007
On Dec 6, 2007 6:11 AM, Martin Maechler <maechler at stat.math.ethz.ch> wrote:
> >>>>> "MS" == Marc Schwartz <marc_schwartz at comcast.net>
> >>>>> on Wed, 05 Dec 2007 12:43:50 -0600 writes:
> MS> Martin,
> MS> Thanks for the corrections. In hindsight, now seeing the intended use of
> MS> ecdf() in the fashion you describe above, it is now clear that my
> MS> approach in response to David's query was un-needed and "over the top".
> MS> "Yuck" is quite appropriate... :-)
> MS> As I was going through this "exercise", it did seem overly complicated,
> MS> given R's usual elegant philosophy about such things. I suppose if I had
> MS> looked at the source for plot.stepfun(), it would have been more evident
> MS> as to how the y values are acquired.
> MS> In reviewing the examples in ?ecdf, I think that an example using
> MS> something along the lines of the discussion here more explicitly, would
> MS> be helpful. It is not crystal clear from the examples, that one can use
> MS> ecdf() in this fashion, though the use of "12 * Fn(tt)" hints at it.
> MS> Perhaps:
> MS> ##-- Simple didactical ecdf example:
> MS> x <- rnorm(12)
> MS> Fn <- ecdf(x)
> MS> Fn
> MS> Fn(x) # returns the percentiles for x
> MS> ...
> Thank you, Marc for the above proposal, to make the examples
> more "crystal clear" :-)
> I've now amended the R-devel version of help(ecdf) accordingly.
Since the above does not actually reproduce percentrank in the case
of ties, the change that would facilitate this particularly would be to add
a ties = "excelpercentrank" to approx. See my solution earlier in this
More information about the R-help