# Defining Sample Quantiles by the True Rank Probability

Authors: Lasse Makkonen; Matti Pajari
Journal: Journal of Probability and Statistics
 (2014)

---

## Abstract

Many definitions exist for sample quantiles and are included in statistical software. The need to adopt a standard definition of sample quantiles has been recognized and different definitions have been compared in terms of satisfying some desirable properties, but no consensus has been found. We outline here that comparisons of the sample quantile definitions are irrelevant because the probabilities associated with order-ranked sample values are known exactly. Accordingly, the standard definition for sample quantiles should be based on the true rank probabilities. We show that this allows more accurate inference of the tails of the distribution, and thus improves estimation of the probability of extreme events.


---

## Body

## 1. Introduction

The quantile of a continuous, strictly monotonous distribution functionF is defined as
(1)
Q
p
=
F
-
1
p
,
where p is the probability of nonexceedance of a variable value. When the distribution is unknown, sample quantiles provide estimators of their population counterparts based on a set of independent order-ranked observations X
1
,
…
,
X
n. The associated sample probabilities are then p
1
,
…
,
p
n, where p
m is the probability of a new sampled value X
n
+
1 being less than or equal to X
m. These nonexceedance probabilities are those defining the cumulative distribution function (CDF).Many different formulas for defining sample quantiles have been used in literature and statistical software. This has caused considerable confusion, in particular when performing extreme value analysis for various applications where probabilities of rare events need to be estimated. In a widely cited article Hyndman and Fan [1] identified this problem and emphasized that there is a need to adopt a standard definition for sample quantiles. The same problem was discussed again by Langford [2] who identified twelve different sample quantile definitions that are used in statistical software.Hyndman and Fan [1] analysed nine different sample quantile definitions. They selected six “desirable properties” for an estimator of a sample quantile and considered how well different definitions satisfy them. This approach is similar to judging the plotting position estimators by five “postulates” as done by Gumbel [3] and by three “purposes” by Kimball [4]. Hyndman and Fan [1] proposed p
m
=
(
m
-
1
/
3
)
/
(
n
+
1
/
3
) to be used as the basis of the standard definition.However, the definition of the quantile has not yet been standardized. Modern statistical software, such asMatlab,Excel,SciPy,STATA, G, and R, include different definitions and offer user-selected options for the formulation of the quantile function, as well as for plotting positions in quantile plots and quantile-quantile plots; see, for example, Castillo-Gutiérrez et al. [5]. The inability to agree on a standard definition has arisen from the many proposals [6–8] and the subjective nature of the “criteria” and “desired properties.”Since the quantile function is the reverse of the cumulative distribution function, the quality of its definition must be judged by how close the probabilities defined by it are to the true probabilities of the cumulative distribution function. Thus, the definition of a sample quantile function should be based on the true nonexceedance probabilities. It was pointed out by Makkonen [9] that, for order-ranked data, they are known exactly. We outline here two rigorous proofs of this conclusion and show how the appropriate definition for the sample quantile function follows from it.


## 2. Sample Probabilities

We present in the following two deductions of the probabilityp
m.Consider in Figure1 an order-ranked sample (a) of n random observations (white circles) and a new observation (grey circle) sampled randomly from the population the distribution of which is unknown. In the new sample (b) obtained by including the new observation the new value may fall in any interval of the original sample or be smaller than X
1 or larger than X
n. In the sample, each observation X
1
,
…
,
X
n
+
1 has the same probability 1
/
(
n
+
1
) to be the smallest one. In particular, P
(
X
n
+
1
is
smallest
)
=
P
(
X
n
+
1
≤
X
1
)
=
1
/
(
n
+
1
).Re-ranking when adding a new sample.
(a)
(b)In the same way, each observationX
1
,
…
,
X
n
+
1 has the same probability to be the m
th in order, where m
=
2
,
…
,
n. In particular, P
(
X
m
-
1
<
X
n
+
1
≤
X
m
)
=
1
/
(
n
+
1
). Consequently, the probability of the value X
n
+
1 to be smaller than or equal to the m
th value of the original sample equals m
/
(
n
+
1
).The result deduced above can also be derived by formal mathematics [10]. Consider variate x with cumulative distribution function F and a sample of n observations X
1
,
…
,
X
n ranked in ascending order. Values X
m in different samples of size n are random values of variate x
m for which the probability density function f
m in terms of F and its derivative F
′
=
f is given by [3, 11]
(2)
f
m
x
m
=
m
n
m
F
x
m
m
-
1
1
-
F
x
m
N
-
m
f
x
m
.
We wish to associate a probability p
m
=
P
{
x
≤
x
m
} with each observed rank m. The precise meaning of p
m is illustrated in Figure 2. Since the probability of event {
x
≤
x
m
} is controlled by two variates x
m and x, the probability is obtained by integrating the joint density function f
x
m
,
x of the variates x
m and x over the area where x
≤
x
m.Figure 2
Contours of joint density functionf
x
m
,
x drawn in x
m, x-plane. f
x
m
,
x integrated over the grey half plane where x
≤
x
m gives the probability P
{
x
≤
x
m
}.Due to the mutual independence ofx
m and x, their joint density function f
X
m
,
X
x
m
,
x equals f
m
x
m
f
x, where f
m and f
=
F
′ are the density functions of x
m and x, respectively. The nonexceedance probability P
x
≤
x
m is, therefore, obtained by integration of the joint density function over zone x
≤
x
m:
(3)
P
x
≤
x
m
=
∫
-
∞
+
∞
∫
-
∞
x
m
f
m
x
m
f
x
d
x
m
d
x
=
∫
-
∞
+
∞
∫
-
∞
x
m
f
x
d
x
f
m
x
m
d
x
m
=
∫
-
∞
+
∞
F
x
m
f
m
x
m
d
x
m
=
∫
-
∞
+
∞
F
x
m
m
n
m
F
x
m
m
-
1
×
1
-
F
x
m
n
-
m
f
x
m
d
x
m
=
m
n
m
∫
0
1
F
m
1
-
F
n
-
m
d
F
=
⋯
=
m
n
+
1
.
The last step in the deduction above is based on direct application of Euler’s β-function.


## 3. Plotting Positions

One might expect that, based on (3) and the definition of CDF, m
/
(
n
+
1
) would have been the sample probability used by everybody. Unfortunately, this is not so, as discussed, for example, in the reviews [12, 13]. Even though m
/
(
n
+
1
) has been recommended already by Weibull [7] and used by numerous researchers since the 1950s, there has been a lot of research aiming at “improving” the probability by using probability estimates called plotting positions of the form (
m
+
a
)
/
(
n
+
b
), where a and b are constants depending on the type of parent distribution, size of the sample, and so forth. These attempts include, for example, Benard and Bos-Levenbach [14], Blom [6], Langbein [15], Gringorten [8], Wilk and Gnanadesikan [16], Barnett [17], Cunnane [18], Guo [19], Jones [20], Yu and Huang [21], and Folland and Anderson [22]. To the effect of adding to this complexity, even numerical methods to calculate plotting positions have been proposed [23].The main reason for this trend appears to be a misunderstanding in the role of the mean value both in theoretical considerations and when interpreting the results of Monte Carlo simulations. This is shown in the Appendix, in which also the ideal performance of the Weibull positions is demonstrated in one special case using the bin frequency criterion introduced by Makkonen et al. [24]. According to the bin frequency criterion, the method of least squares (MLS) using the Weibull probabilities gives a better distribution function than MLS using any of the plotting positions of Cunnane, Gringorten and Blom.


## 4. Sample Quantiles

It is apparent that even if there may be some reasons, for example, bias in the MLS, to use the linear transformations ofm
/
(
n
+
1
), that is, the plotting positions of the type of Cunnane, Blom, Gringorten, Hyndman and Fan, and so forth, incurve fitting, none of them is valid when thesample probabilities are plotted. The definition of a sample quantile does not need to be based on any “estimator” of p
m. It can be defined objectively based on the true nonexceedance probability p
m
=
m
/
(
n
+
1
) of a new value drawn from the population. For variable values in between the observed values, one may interpolate linearly. Accordingly, we define the following.Form
=
1
,
…
,
n
(4)
p
m
=
m
n
+
1
.
For m
=
1
,
…
,
n
-
1 and p
m
≤
p
≤
p
m
+
1 we define
(5)
Q
p
=
n
+
1
X
m
+
1
-
X
m
p
-
p
m
+
X
m
.
The definition of the quantile function in (5) is illustrated in Figure 3.Figure 3
Illustration of the proposed sample quantile definition by an example wheren
=
9.The definition of (5) has all the desired properties of Hyndman and Fan [1]. The huge advantage of (5) over all other suggestions for the sample quantile definition is that it is based on the true probabilities. This makes it possible to standardize the sample quantile function in statistical software by sound theoretical basis instead of subjective criteria.Using any other definition, for example,m
/
n promoted by Langford [2], as an estimate of the probability p
m, results in significant relative errors, particularly at the tails of the distribution. This is illustrated in Figure 4 showing the relative errors for different ranks m. The relative error in the exceedance probability 1
-
p
m is defined as
(6)
[
(
1
-
m
/
n
)
-
(
1
-
m
/
(
n
+
1
)
)
]
[
1
-
m
/
(
n
+
1
)
]
=
⋯
=
-
m
n
.
Note that, at the upper tail of the distribution, the relative error remains large even when the sample size n goes to infinity. The error of using m
/
n or some other improper estimate of the probability plotting positions is particularly persistent in the extreme value analysis methods [13]. This confusion alone justifies the definition as proposed here.Figure 4
Relative error in the exceedance probability1
-
p
m resulting from the conventional definition [2] of the empirical distribution function for order-ranked observations X
1
,
X
2
,
…
,
X
n as a function of the sample size n for different ranks m.


## 5. Conclusions

The sample quantiles can be defined by the true nonexceedance probabilitiesm
/
(
n
+
1
) of the order-ranked sample values. Following the basic principles of the probability calculus, the sample quantile function can, therefore, be defined by (5).This definition removes the methodological uncertainty related to calculating sample quantiles and should be adopted as a standard in statistical software.The claim that the true nonexceedance probabilities, so-called Weibull plotting positions, result in a biased estimate of a CDF is shown to be false and founded on a misunderstanding in theoretical considerations and when interpreting the results of Monte Carlo simulations.The definition of the quantile function proposed here should, of course, be applied to its reverse function, EDF, as well, and used in the inference of data. This is particularly important in the extreme value analysis where probabilities of rare events need to be estimated.



---

*Source: 326579-2014-12-08.xml*