[R] "reverse" quantile function

Andras Farkas motyocska at yahoo.com
Thu Jun 15 21:37:21 CEST 2017


Dear All,

we have:

t<-seq(0,24,1) 
a<-10*exp(-0.05*t) 
b<-10*exp(-0.07*t) 
c<-10*exp(-0.1*t) 
d<-10*exp(-0.03*t) 
z<-data.frame(a,b,c,d) 

res<-t(apply(z, 1, quantile, probs=c(0.3))) 



my goal is to do a 'reverse" of the function here that produces "res" on a data frame, ie: to get the answer 0.3 back for the percentile location when I have "res" available to me... For a single vector this would be done using ecdf something like this:

x <- rnorm(100) 
#then I know this value:  
quantile(x,0.33) 
#so do this step
ecdf(x)(quantile(x,0.33)) 
#to get 0.33 back...

 any suggestions on how I could to that for a data frame?

thank you,Andras Farkas



More information about the R-help mailing list