2 % @brief Quantile approximation
for maximum of K random variables
4 % @author LINE Development Team
8 % @brief Quantile approximation
for maximum of K random variables
11 % Approximates the q-th quantile of the maximum of K i.i.d. random
12 % variables from the standard Gumbel (Type I extreme value) distribution.
14 % x(K,q) ≈ ln(K) - ln(ln(1/q))
16 % where
P(M_K <= x(K,q)) = q
is the q-th quantile.
18 % Note: This approximation
is inaccurate
for small values of K.
20 % For general distributions, the quantile of the maximum can be computed
21 %
using the inverse CDF:
22 % x(K,q) = F^{-1}(q^{1/K})
26 % x_Kq = fj_quantile(K, q) % Standard Gumbel approx
27 % x_Kq = fj_quantile(K, q, F_inv) % General distribution
32 % <tr><th>Name<th>Description
33 % <tr><td>K<td>Number of random variables (positive integer)
34 % <tr><td>q<td>Quantile probability (0 < q < 1)
35 % <tr><td>F_inv<td>Optional: inverse CDF function handle for general distributions
40 % <tr><th>Name<th>Description
41 % <tr><td>x_Kq<td>q-th quantile of the maximum of K random variables
45 % A. Thomasian,
"Analysis of Fork/Join and Related Queueing Systems",
46 % ACM Computing Surveys, Vol. 47, No. 2, Article 17, July 2014.
49function x_Kq = fj_quantile(K, q, F_inv)
52 line_error(mfilename,
'K must be a positive integer. Got K=%d.', K);
55if any(q <= 0) || any(q >= 1)
56 line_error(mfilename, 'Quantile q must satisfy 0 < q < 1.');
59if nargin < 3 || isempty(F_inv)
60 % Standard Gumbel approximation
61 % x(K,q) ≈ ln(K) - ln(ln(1/q))
62 x_Kq = log(K) - log(log(1 ./ q));
64 % General distribution using inverse CDF
65 % The CDF of the maximum
is F_max(x) = [F(x)]^K
66 % So the q-th quantile satisfies: [F(x)]^K = q
67 % Therefore: F(x) = q^(1/K) and x = F^{-1}(q^{1/K})
68 x_Kq = F_inv(q.^(1 / K));