[R] Function from ecdf to ccdf
David Winsemius
dwinsemius at comcast.net
Tue Apr 24 14:42:23 CEST 2012
On Apr 24, 2012, at 4:47 AM, Alaios wrote:
> Dear all,
> I would like to calculate the complementary cumulative distribution
> function. As it is known, the ccdf is the 1-ecdf(X)==1-F(x). (From ?
> ecdf help is shown that ecdf returns a function which is the F(x)
>
> I would like to use that function inside my function and after call
> curve (which accepts function as input). My code looks like that
>
>
> onVector<-seq(1:100)
> offVector<-seq(101:200)
Heh, .... I've made that mistake myself. It's a difficult one for the
brain to catch. Unfortunately it does not throw an error. (Arguably
this is an infelicity that should be flagged with at least a warning.)
> myecdfOn<-function(onVector){1-ecdf(onVector)} # This gives the ccdf
I do not think it does. Have your tried to do anything with it?
>
> curve(myecdfOn,from=1,to=max(c(onVector,offVector)), add=TRUE,lwd=2)
>
> Unfortunately fails and I can not really see what is he problem of it.
Try reading the error message more closely (... and next time post it.)
>
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list