[R] ECDF values

Martin Maechler maechler at stat.math.ethz.ch
Thu Nov 17 09:22:54 CET 2005


>>>>> "Vito" == Vito Ricci <vito_ricci at yahoo.com>
>>>>>     on Thu, 17 Nov 2005 08:20:35 +0100 (CET) writes:

    Vito> Dear UseRs,
    Vito> maybe is a silly question: how can I get Empirical CDF
    Vito> values from an object created with ecdf()?? Using
    Vito> print I obtain:

    Vito> Empirical CDF 
    Vito> Call: ecdf(t)
    Vito> x[1:57] =    4.1,    4.4,    4.5,  ...,  491.3, 671.27

help(ecdf) supposedly has enough explanation; however
it seems the author of the help page (guess who) was
mistaken about the "simple" in

>> Examples:
>> 
>>      ##-- Simple didactical  ecdf  example:
>>      Fn <- ecdf(rnorm(12))
>>      Fn; summary(Fn)
>>      12*Fn(knots(Fn)) == 1:12 ## == 1:12  if and only if there are no ties !

The clue is that the result of ecdf() 
{ and also of stepfun(), approxfun() or splinefun() ! }
is a *function*  (with some additional attributes); hence it's
as simple as

 tt <- seq(-3, 3, by = 0.1)
 Fn(tt)

    Vito> Thanks in advance.

you're welcome.
Martin Maechler, ETH Zurich




More information about the R-help mailing list