# [R] Diff btw percentile and quantile

(Ted Harding) Ted.Harding at manchester.ac.uk
Wed Mar 4 17:31:44 CET 2009

```On 04-Mar-09 16:10:29, megh wrote:
> Yes, I aware of those definitions. However I wanted to know the
> difference btw the words "Percentile" and "quantile", if any.
> Secondly your link navigates to some non-english site, which I could
> not understand.

"Percentile" and "quantile" are in effect the same thing.
The difference is in how they express what they refer to.

For example, the Median of a distribution is the 0.5 Quantile,
and is the 50% percentile.

So, for 0 <= p <= 1, refer to either the p-th quantile,
or to the (100*p)-th percentile.

Thus R has the function quantile(), whose ?quantile states:
The generic function 'quantile' produces sample quantiles
corresponding to the given probabilities. The smallest
observation corresponds to a probability of 0 and the
largest to a probability of 1.

R (in its basic distribution) does now have a function percentile(),
but, given a series P of percentages, e.g.
P <- c(1,5,10,25,50,75,90,95,99)
one could obtain the equivalent as
quantile(X,probs=P/100).

So, with reference to your original question
"Excel has percentile() function. R function quantile() does the
same thing. Is there any significant difference btw percentile
and quantile?"
the answer is that they in effect give the same results, though
differ with respect to how they are to be fed (quantile eats
probabilities, percentile eats percentages). [Though (since I am
not familiar with Excel) I cannot rule out that Excel's percentile()
function also eats probabilities; in which case its name would be
an example of sloppy nomenclature on Excel's part; which I cannot
rule out on general grounds either].

Ted.

> Dieter Menne wrote:
>> megh <megh700004 <at> yahoo.com> writes:
>>> To calculate Percentile for a set of observations Excel has
>>> percentile() function. R function quantile() does the same thing.
>>> Is there any significant difference btw percentile and quantile?
>>
>> If you check the documentation of quantile, you will note that
>> there are 9 variants of quantile which may give different values
>> for small sample sizes and many ties.
>>
>> I found a German page that explains the algorithm Excel uses:
>>
>> http://www.excel4managers.de/index.php?page=quantile01
>>
>> but I did not check if which of the R-variants this is equivalent to.
>>
>> Dieter

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 04-Mar-09                                       Time: 16:31:42
------------------------------ XFMail ------------------------------

```