drflxms
2012-Mar-03 12:37 UTC
[R] percentile of a given value: is there a "reverse" quantile function?
Dear all, I am familiar with obtaining the value corresponding to a chosen probability via the quantile function. Now I am facing the opposite problem I have a value an want to know it's corresponding percentile in the distribution. So is there a function for this as well? Thank you for your support in advance, Felix
Stephan Kolassa
2012-Mar-03 13:20 UTC
[R] percentile of a given value: is there a "reverse" quantile function?
?ecdf Best, Stephan On 03.03.2012 13:37, drflxms wrote:> Dear all, > > I am familiar with obtaining the value corresponding to a chosen > probability via the quantile function. > Now I am facing the opposite problem I have a value an want to know it's > corresponding percentile in the distribution. So is there a function for > this as well? > > Thank you for your support in advance, Felix > > ______________________________________________ > 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. >
peter dalgaard
2012-Mar-03 13:33 UTC
[R] percentile of a given value: is there a "reverse" quantile function?
On Mar 3, 2012, at 13:37 , drflxms wrote:> Dear all, > > I am familiar with obtaining the value corresponding to a chosen > probability via the quantile function. > Now I am facing the opposite problem I have a value an want to know it's > corresponding percentile in the distribution. So is there a function for > this as well?For a single value, mean(x <= a) will do. Otherwise check ecdf().> x <- rnorm(100) > mean(x <= 2)[1] 0.97> ecdf(x)(2)[1] 0.97> ecdf(x)(-3:3)[1] 0.00 0.01 0.14 0.48 0.80 0.97 1.00 if you need values for your original data points, rank(x)/length(x) should do (bar missing value issues).> > Thank you for your support in advance, Felix > > ______________________________________________ > 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.-- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
Pascal Oettli
2012-Mar-03 13:36 UTC
[R] Re : percentile of a given value: is there a "reverse" quantile function?
Hi Felix, Have a look at ?pnorm and ?qnorm. And at ?Distributions Regards, Pascal ----- Mail original ----- De?: drflxms <drflxms at googlemail.com> ??: r-help at r-project.org Cc?: Envoy? le : Samedi 3 mars 2012 21h37 Objet?: [R] percentile of a given value: is there a "reverse" quantile function? Dear all, I am familiar with obtaining the value corresponding to a chosen probability via the quantile function. Now I am facing the opposite problem I have a value an want to know it's corresponding percentile in the distribution. So is there a function for this as well? Thank you for your support in advance, Felix ______________________________________________ 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.
Seemingly Similar Threads
- contour for plotting confidence interval on scatter plot of bivariate normal distribution
- "reverse" quantile function
- "reverse" quantile function
- how to compute the inverse percentile of a given observation w.r.t. a reference distribution
- "reverse" quantile function