[R] inverse cumulative distribution

Shiazy Fuzzy shiazy at gmail.com
Mon Jun 4 13:22:38 CEST 2007


On 6/4/07, salcaraz at obelix.umh.es <salcaraz at obelix.umh.es> wrote:
> hi all:
>
> ecdf() is the empirical cumulative distribution function, but I need the
> INVERSE cumulative distribution.
>
> how can I calculate it?

Two ways:
1. eccdf <- function(x) { return( 1 - ecdf(x)(x) ) }
  This returns an array of element, not an object (like ecdf)
2. Cut&Paste "ecdf" code (from R write "ecdf" and then Enter) into a
new function "eccdf" (or whatever u want); in place of "cumsum(...)"
write "1-cumsum(...)", and rename the class name "ecdf" in"eccdf" (or
other). Note, doing "plot(eccdf(x))" you will not get similar result
to "plot(ecdf(x))" since the last one call "plot.ecdf". By the way you
can write a "plot.eccdf" function.

-- Marco

>
> thank you in advance
>
> /salva
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list