Exact quantile confidence interval based on order statisticsΒΆ

We consider a random variable X of dimension 1 and its quantile x_{\alpha} of level \alpha (\alpha \in [0, 1]). We seek to evaluate an upper bound of x_{\alpha} with a confidence greater than or equal to \beta, using order statistics.

Let (X_1, \dots, X_\sampleSize) be independent copies of X. Let X_{(k)} be the k-th order statistic of (X_1, \dots, X_\sampleSize) i.e., X_{(k)} is the k-th smallest value of (X_1, \dots, X_\sampleSize) for 1 \leq k \leq \sampleSize. For example, X_{(1)} = \min (X_1, \dots, X_\sampleSize) is the minimum and X_{(\sampleSize)} = \max (X_1, \dots, X_\sampleSize) is the maximum. We have:

X_{(1)} \leq X_{(2)} \leq \dots \leq X_{(\sampleSize)}.

The cumulative distribution function of the order statistic X_{(k)} is:

F_{X_{(k)}}(x)
= \sum_{i = k}^{\sampleSize} \binom{\sampleSize}{i}
\left(F(x)\right)^i \left(1 - F(x) \right)^{\sampleSize-i}.

For any strictly positive integer \sampleSize and \alpha \in [0, 1], let F_{(\sampleSize, \alpha)} be the cumulative distribution function of the binomial distribution \cB(\sampleSize, \alpha). Let \overline{F} be the complementary cumulative distribution function (also named survival function in dimension 1):

\overline{F}_{(\sampleSize, \alpha)}(k)
= 1 - F_{(\sampleSize, \alpha)}(k),

for any integer k. Then the cumulative distribution function of the k-th order statistic is:

F_{X_{(k)}}(x) = \overline{F}_{(\sampleSize,F(x))}(k - 1),

for any integer k \in \llbracket 1, \sampleSize \rrbracket. Therefore:

\begin{aligned}
F_{X_{(k)}}(x_{\alpha})
& = \sum_{i = k}^{\sampleSize} \binom{\sampleSize}{i} \alpha^i (1 - \alpha)^{\sampleSize - i} \\
& = \overline{F}_{(\sampleSize, \alpha)}(k - 1).
\end{aligned}

Rank for an upper bound of the quantileΒΆ

Let (x_1, \dots, x_\sampleSize) be an i.i.d. sample of size \sampleSize of the random variable X. Given a quantile level \alpha \in [0,1], a confidence level \beta \in [0,1], and a sample size \sampleSize, we seek the smallest rank k \in \llbracket 1, \sampleSize \rrbracket such that:

(1)ΒΆ\Prob{x_{\alpha} \leq X_{(k)}} \geq \beta.

The previous equation is equivalent to:

(2)ΒΆF_{(\sampleSize, \alpha)}(k - 1) \geq \beta.

Then, the smallest rank k_{\text{sol}} such that the previous equation is satisfied is:

k_{\text{sol}}
= \min \{ k \in \llbracket 1, \sampleSize \rrbracket \,
        \mid \, F_{(\sampleSize, \alpha)}(k - 1)\geq \beta \}.

If:

1 - \alpha^\sampleSize < \beta,

then there is no solution. Otherwise, the solution k_{\text{sol}} is:

(3)ΒΆk_{\text{sol}} = 1 + F_{(\sampleSize, \alpha)}^{-1}(\beta).

First, the optimal rank k_{\text{sol}} is computed. Then, the upper bound of x_{\alpha} is estimated using the corresponding order statistic x_{(k_{\text{sol}})} from the sample (x_1, \dots, x_\sampleSize).

The following table presents the solution depending on the parameters.

k_{\text{sol}}

\beta=0

0 < \beta < 1

\beta=1

\alpha=0

1

1

1

0 < \alpha < 1

1

see (3)

\emptyset

\alpha=1

1

\emptyset

\emptyset

Rank for a lower bound of the quantileΒΆ

Given the same data as previously, we seek the greatest rank k \in \llbracket 1, \sampleSize \rrbracket such that:

(4)ΒΆ\Prob{X_{(k)} \leq x_{\alpha}} \geq \beta.

This is equivalent to:

\overline{F}_{(\sampleSize, \alpha)}(k - 1) \geq \beta.

Then, the greatest rank k_{\text{sol}} such that the previous equation is satisfied is:

k_{\text{sol}}
= \max \left\{ k \in \llbracket 1, \sampleSize \rrbracket \,
         \mid \, \overline{F}_{(\sampleSize, \alpha)}(k - 1) \geq \beta \right\}.

If:

1 - (1 - \alpha)^\sampleSize < \beta,

then there is no solution. Otherwise, the solution k_{\text{sol}} is:

(5)ΒΆk_{\text{sol}} =
\begin{cases}
1 + \overline{F}_{(\sampleSize, \alpha)}^{-1}(\beta)
    & \text{if } \exists k_0 \mid \overline{F}_{(\sampleSize, \alpha)}(k_0 - 1) = \beta,\\
\overline{F}_{(\sampleSize, \alpha)}^{-1}(\beta) & \text{otherwise}.
\end{cases}

The following table presents the solution depending on the parameters.

k_{\text{sol}}

\beta=0

0 < \beta < 1

\beta=1

\alpha=0

\sampleSize

\emptyset

\emptyset

0 < \alpha < 1

\sampleSize

see (5)

\emptyset

\alpha=1

\sampleSize

\sampleSize

\sampleSize

Ranks for bilateral bounds of the quantileΒΆ

Given the previously established data, we seek the ranks k_1, k_2 \in \llbracket 1, \sampleSize \rrbracket^2. Because the optimal interval can be defined in various ways, the solution depends on the chosen criterion.

Here are the different formulations based on the target objective.

Criterion 1: Symmetric probability tails

(6)ΒΆ\begin{cases}
\Prob{X_{(k_1)} \leq x_{\alpha}} \geq 1 - \dfrac{1 - \beta}{2}, \\
\Prob{x_{\alpha} \leq X_{(k_2)}} \geq 1 - \dfrac{1 - \beta}{2}.
\end{cases}

Criterion 2: Minimizing the rank interval length

(7)ΒΆ\begin{aligned}
(k_1, k_2) =
& \argmin (k_2 - k_1) \\
& \text{s.t. } \quad \Prob{X_{(k_1)} \leq x_{\alpha} \leq X_{(k_2)}}
  \geq \beta.
\end{aligned}

Criterion 3: Minimizing the probability of coverage

(8)ΒΆ\begin{aligned}
(k_1, k_2) =
& \argmin \Prob{X_{(k_1)} \leq x_{\alpha} \leq X_{(k_2)}} \\
& \text{s.t. } \quad \Prob{X_{(k_1)} \leq x_{\alpha} \leq X_{(k_2)}}
  \geq \beta.
\end{aligned}

Criterion 4: Symmetric ranks

Let k_\alpha be the rank corresponding to the empirical estimator of the quantile x_{\alpha}:

k_\alpha
= \begin{cases}
\max(1, \alpha \sampleSize) & \textrm{ if } \alpha \sampleSize \textrm{ is an integer}, \\
\min(\sampleSize, \lfloor\alpha \sampleSize\rfloor + 1) & \textrm{ otherwise.}
\end{cases}

We search for the smallest \ell \leq \min(k_\alpha - 1, \sampleSize - k_\alpha + 1) such that:

(9)ΒΆ\Prob{X_{(k_\alpha - \ell)} \leq x_{\alpha} \leq X_{(k_\alpha + \ell)}}
  \geq \beta.

The solutions to (8) and (7) are determined numerically, using an optimization algorithm.

The solutions to (6) are such that:

\begin{aligned}
F_{(\sampleSize, \alpha)}(k_1 - 1) \leq \dfrac{1 - \beta}{2}, \\
F_{(\sampleSize, \alpha)}(k_2 - 1) \geq 1 - \dfrac{1 - \beta}{2}.
\end{aligned}

The solutions are:

k_{1, \text{sol}}
= F_{(\sampleSize, \alpha)}^{-1}\left(\dfrac{1 - \beta}{2}\right),

and:

k_{2, \text{sol}}
= 1 + F_{(\sampleSize, \alpha)}^{-1}\left(1 - \dfrac{1 - \beta}{2}\right).

Minimum sample size for an upper bound of the quantileΒΆ

Given \alpha, \beta, and the rank 1 \leq k \leq \sampleSize, we seek the smallest sample size \sampleSize such that:

\Prob{x_{\alpha} \leq X_{(\sampleSize - k + 1)}} \geq \beta.

The previous equation is equivalent to:

(10)ΒΆF_{(\sampleSize, \alpha)}(\sampleSize - k)\geq \beta.

Unlike the formulation leading to equation (1), where the sample size is fixed and the rank is the unknown, here the relative rank is fixed and the sample size is the variable to determine. To determine this minimum sample size, we solve equation (10) for the sample size \sampleSize. An optimization algorithm is used to compute \sampleSize_{\text{sol}} from the set \{ k, k + 1, \dots\}. We can reduce the search space to the interval \llbracket k, \sampleSize_2 \rrbracket, where \sampleSize_2 is a sample size that satisfies equation (10). This value \sampleSize_2 can be determined using the normal approximation of the binomial distribution with the same mean and variance.

Once the smallest size \sampleSize has been estimated, a sample of size \sampleSize can be generated from X and an upper bound of x_{\alpha} is estimated using x_{(\sampleSize - k + 1)}.

Minimum sample size for a lower bound of the quantileΒΆ

Given the same data as previously, we seek the smallest sample size \sampleSize such that equation (4) is satisfied.

The solution is:

\sampleSize_{\text{sol}}
= \min \left\{\sampleSize \geq k
   \mid \overline{F}_{(\sampleSize, \alpha)}(k - 1) \geq \beta \right\}.

The following table presents the solution depending on the parameters.

\sampleSize_{\text{sol}}

\beta=0

0 < \beta < 1

\beta=1

\alpha=0

k

\emptyset

\emptyset

0 < \alpha < 1

\sampleSize_{\text{sol}}

\sampleSize_{\text{sol}}

\emptyset

\alpha=1

k

k

k

Minimum sample size for bilateral bounds of the quantileΒΆ

Given two order statistics (k_1, k_2) with 1 \leq k_1 < k_2 \leq \sampleSize, we seek the smallest sample size \sampleSize such that:

(11)ΒΆ\Prob{X_{(k_1)} \leq x_{\alpha} \leq X_{(\sampleSize - k_2 + 1)}} \geq \beta.

Equation (11) can be rewritten as:

(12)ΒΆF_{X_{(\sampleSize - k_2 + 1)}}(x_{\alpha})
- F_{X_{(k_1)}}(x_{\alpha}) \geq \beta.

This can be equivalently expressed using the binomial distribution:

F_{(\sampleSize, \alpha)}(\sampleSize - k_2)
- F_{(\sampleSize, \alpha)}(k_1 - 1) \geq \beta.

Unlike the formulation in equation :eq:EqOrderStatMinRankLength, where the sample size is fixed and the ranks are the unknowns, this approach fixes the relative ranks to determine the minimum required sample size. To find the exact minimum \sampleSize_{\text{sol}} that solves equation (12), we use an optimization algorithm.

Once the smallest size \sampleSize has been computed, a sample of size \sampleSize can be generated from X and a lower and an upper bound of x_{\alpha} are estimated using x_{(k_1)} and x_{(\sampleSize - k_2 + 1)}.

In the particular case where (k_1, k_2) = (1,1), we seek the smallest sample size \sampleSize such that:

\Prob{ \min (X_1, \dots, X_\sampleSize)
\leq x_{\alpha}
\leq \max (X_1, \dots, X_\sampleSize)} \geq \beta.

Then, equation (12) is equivalent to:

1 - \alpha^\sampleSize - (1 - \alpha)^\sampleSize \geq \beta.

The optimal \sampleSize is determined using an optimization algorithm. The search space is reduced to the interval:

\left \lfloor \dfrac{\log (1 - \beta)}{\log \gamma} \right \rfloor
\leq \sampleSize
\leq \left \lfloor \dfrac{\log \left(\dfrac{1 - \beta}{2}\right)}{\log \gamma} \right \rfloor,

where \gamma = \max(\alpha, 1 - \alpha).