rudi
2011-May-25 19:42 UTC
[R] how to compute the inverse percentile of a given observation w.r.t. a reference distribution
Hi, can anyone help me to figure out how to compute the percentile of an individual observation with respect to a reference distribution. What I mean is. Let's assume I have a vector consisting of 10 numbers {3,5,8,1,9,5,4,3,5.5,7} and I want figure out what percentile the number 4.9 corresponds to. I failed to find any reference to such a function, although I would assume this must frequently be necessary. Thanks in advance for you help. /Rudi
David Winsemius
2011-May-25 21:09 UTC
[R] how to compute the inverse percentile of a given observation w.r.t. a reference distribution
On May 25, 2011, at 3:42 PM, rudi wrote:> Hi, > > can anyone help me to figure out how to compute the percentile of an > individual observation with respect to a reference distribution. > > What I mean is. Let's assume I have a vector consisting of 10 numbers > {3,5,8,1,9,5,4,3,5.5,7} and I want figure out what percentile the > number 4.9 corresponds to. I failed to find any reference to such a > function, although I would assume this must frequently be necessary.?quantile Talking about percentiles when you only have 10 numbers seems rather misleading, don't you think? -- David Winsemius, MD West Hartford, CT
Jorge Ivan Velez
2011-May-25 21:13 UTC
[R] how to compute the inverse percentile of a given observation w.r.t. a reference distribution
Hi Rudi, Take a look at ?ecdf HTH, Jorge On Wed, May 25, 2011 at 3:42 PM, rudi <> wrote:> Hi, > > can anyone help me to figure out how to compute the percentile of an > individual observation with respect to a reference distribution. > > What I mean is. Let's assume I have a vector consisting of 10 numbers > {3,5,8,1,9,5,4,3,5.5,7} and I want figure out what percentile the > number 4.9 corresponds to. I failed to find any reference to such a > function, although I would assume this must frequently be necessary. > > Thanks in advance for you help. > > /Rudi > > ______________________________________________ > 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. >[[alternative HTML version deleted]]
Dennis Murphy
2011-May-25 21:50 UTC
[R] how to compute the inverse percentile of a given observation w.r.t. a reference distribution
Hi: On Wed, May 25, 2011 at 12:42 PM, rudi <rudi.strasser at gmail.com> wrote:> Hi, > > can anyone help me to figure out how to compute the percentile of an > individual observation with respect to a reference distribution. > > What I mean is. Let's assume I have a vector consisting of 10 numbers > {3,5,8,1,9,5,4,3,5.5,7} and I want figure out what percentile the > number 4.9 corresponds to. I failed to find any reference to such a > function, although I would assume this must frequently be necessary.The simple answer is, I believe, x <- c(3,5,8,1,9,5,4,3,5.5,7) plot(ecdf(x)) sum(x <= 4.9)/length(x) [1] 0.4 This would correspond to the empirical cumulative distribution function (ecdf) to which Jorge alluded. HTH, Dennis> > Thanks in advance for you help. > > /Rudi > > ______________________________________________ > 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. >