Ivan Popivanov
2011-Feb-10 21:50 UTC
[R] How to determine the quantile boundary from an ECDF?
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]]
Eik Vettorazzi
2011-Feb-10 22:51 UTC
[R] How to determine the quantile boundary from an ECDF?
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 at 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