We know that, if $X$ is a continuous random variable with a strictly increasing distribution function or DF $F(x)$ then, its $p$th quantile is unique. But if the distribution function is non-decreasing then the $p$th quantile may not be unique anymore. The same could happen if the random variable is a discrete type random variable. So what should be taken as its estimate in such cases?

  • $\begingroup$ An idea, in the discrete case, is to remove the points with probability $0$. $\endgroup$ – dcolazin Jun 22 at 7:54
  • $\begingroup$ One definition of the quantile function is $Q(p)=\inf\left\{ x\in \mathbb{R} : p \le F(x) \right\}$ and this does give a unique value even for discrete random variables $\endgroup$ – Henry Jun 22 at 7:59
  • $\begingroup$ I have seen a definition $Q(p) = \tfrac{1}{2}(L(p) + R(p))$ where $L(p) := \inf\{ x \in \mathbb R : p \le P(X \le x) \}$ and $R(p) = \sup\{ x \in \mathbb R : 1 - p \le P(X \ge x) \}$. This also gives a unique value even for discrete random variables. $\endgroup$ – Orat Jun 23 at 3:04

For the cases you ask about, there are about a dozen slightly different definitions of exact quantile values. Each one is based on somewhat different assumptions and goals. Here are some practical illustrations using R statistical software.

(a) Discrete distribution. Suppose you have a sample of size 10 from a Binomial distribution. Your null hypothesis is $H_o: p \ge .5$ vs $H_a: p < .5.$ Then we will reject $H_0$ if the number $X$ out of $n = 10$ trials is sufficiently small. If we want to test at the 5% level of significance we need to find the critical value $c$ such that $P(X \le cc\,|\, p = .5) = 0.05.$

Because the 'null distribution' is $X \sim \mathsf{Binom}(n,.5),$ we seek quantile 0.05 of that distribution. In R statistical software (where pbinom is a binomial CDF and qbinom, its inverse, is a binomial quantile function). we have the following:

qbinom(.05, 10, .5)
[1] 2
pbinom(2, 10, .5)
[1] 0.0546875
pbinom(1, 10, .5)
[1] 0.01074219

This means that $c = 2$ is a candidate for the critical value. But upon checking exact binomial probabilities we find that using $c = 2$ gives a test at level about 5.47%, whereas using $c = 1$ gives a test at about level 1.02%. There can be no (nonrandomized) test exactly level 5%.

Here is a plot of the distribution $\mathsf{BINOM}(n = 10, p= .5).$ The sum of the heights of the two bars to the left of the vertical dotted line is 0.0107.

enter image description here

For this particular example, the quantile function in R is defined to give a significance level that is somewhat too large; using the next smaller integer gives a test at the largest available level less than 5%.

(b) Quantiles for data. Suppose we have $n = 14$ observations from a continuous distribution. In real life, we have to round to some number of decimal places and rounding can produce ties. The sample considered to produce a discrete 'empirical' distribution with probability $1/14$ at each datapoint.

Specifically, if we sample $n=14$ observations at random from $\mathsf{Norm}(\mu = 100, \sigma = 10),$ and round to the nearest integer, then we might get the sample below:

set.seed(622)  # for reproducibility
x = sort(round(rnorm(14, 100, 10))); x
[1]  78  86  93  94  96  98  99 
{8} 101 102 102 105 107 112 121

enter image description here

The function quantile gives the minimum, lower quantile, median, upper quantile, and maximum. The default version of the quantile function in R gives the following results:

    0%    25%    50%    75%   100% 
 78.00  94.50 100.00 104.25 121.00 

Because $n = 14$ is even, the median is taken to be 100, halfway between the middle two observations at 99 and 101.

Various assumptions and compromises can be made to define the lower and upper quantiles. (The objective of one method may be to describe the sample; another may seek to estimate population quartiles.) Results in in any one statistical software program may or may not exactly match the definition given in your textbook.

Minitab and SPSS software give slightly different values than the default values from R. These are obtainable in R by using the parameter type=6 in the function `quantile:

  quantile(x, type=6)
     0%    25%    50%    75%   100% 
  78.00  93.75 100.00 105.50 121.00 

A couple of other versions used elsewhere are shown below:

quantile(x, type=4)
   0%   25%   50%   75%  100% 
 78.0  93.5  99.0 103.5 121.0 

quantile(x, type=8)
       0%       25%       50%       75%      100% 
 78.00000  93.91667 100.00000 105.16667 121.00000 

While these differences among definitions are noticeable for small samples, they are mainly unimportant for large samples, and it is for large sample that quantiles are most used as descriptive statistics and as estimates.

Notes: (1) You can see the exact formulas used for the various types of quantiles (and rationales for some of them) by looking at the Documentation for the quantile function in R. (By default, R uses type=7, unless a diffreent type is specified.)

(2) If you are taking a statistics course, you should use the quantile rules given in your text or class notes.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.