[R] How to determine the quantile boundary from an ECDF?

2011-02-10 Thread Ivan Popivanov
Given a dataset x, the ecdf is ecdf(x). Then I can use ecdf(x)(y) to find
the percentile of y. Given the ecdf is there a way to determine what is the
value of y that is the boundary of let's say 95 percentile? In other words,
is there a function I can call on the ecdf like:

fomeFunc( ecdf( x ), 0.95 )

Which will return the highest value of y, for which ecdf( y )  0.95?

The only solution I can think of is to generate 100 quantiles using
quantile, and lookup the value at index 95, but I have the feeling I am
overlooking something much simpler. ;)

Thanks in advance!

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] How to determine the quantile boundary from an ECDF?

2011-02-10 Thread Eik Vettorazzi
Hi Ivan,
are you looking for quantiles of type 1? See ?quantile

x-rnorm(50)
ecdfx-ecdf(x)
ecdfx(quantile(x,.95,type=1)) #so this is the lowest x having ecdf(x)=.95

ecdfx(quantile(x,.95,type=1)-1e-10) #left from that point ecdf.95

so actually it is right-continuous (because its an inverse of an left
continuous function).

hth.

Am 10.02.2011 22:50, schrieb Ivan Popivanov:
 Given a dataset x, the ecdf is ecdf(x). Then I can use ecdf(x)(y) to find
 the percentile of y. Given the ecdf is there a way to determine what is the
 value of y that is the boundary of let's say 95 percentile? In other words,
 is there a function I can call on the ecdf like:
 
 fomeFunc( ecdf( x ), 0.95 )
 
 Which will return the highest value of y, for which ecdf( y )  0.95?
 
 The only solution I can think of is to generate 100 quantiles using
 quantile, and lookup the value at index 95, but I have the feeling I am
 overlooking something much simpler. ;)
 
 Thanks in advance!
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org 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.


-- 
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790

__
R-help@r-project.org 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.