David Winsemius
2017-06-15 22:46:36 UTC
Dear All,
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)))
x <- rnorm(100)
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?
Can't you just used ecdf and quantile ecdf?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)))
x <- rnorm(100)
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?
# See ?ecdf page for both functions
lapply( lapply(z, ecdf), quantile, 0.33)
$a33%
4.475758
$b
33%
3.245151
$c
33%
2.003595
$d
33%
6.173204
--
David Winsemius
Alameda, CA, USA
______________________________________________
R-***@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.
David Winsemius
Alameda, CA, USA
______________________________________________
R-***@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.