The answer for This question here suggest a way by applying ecdf
.
However I am using Ecdf()
from package Hmisc
for it provides a convenient way to do a ccdf(Complementary Cumulative Distribution Function) plot. (by setting the what
option to '1-F')
By default, Ecdf()
does the plot and return a nested list containing x
and y
.
How can I extract the y
value of a certain x
value? and then plot it on the original plot?
FYI:
> str(Ecdf(rnorm(20), lwd = 2))
List of 2
$ x: num [1:21] -1.46 -1.46 -1.18 -1.17 -1.16 ...
$ y: num [1:21] 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 ...
- attr(*, "N")=List of 2
..$ n: num 20
..$ m: num 0
At first i am considering convert this list to a data.frame using methods suggested from R List to Data Frame, but my data is huge and the rbind
seems really slow.