1%{ @file fj_xmax_approx.m
2 % @brief General approximation
for expected maximum of K random variables
4 % @author LINE Development Team
8 % @brief General approximation
for expected maximum of K random variables
11 % Approximates the expected value of the maximum of K i.i.d. random
12 % variables
using the mean-variance approximation from David [1970].
14 % X_K^max ≈ mu_X + sigma_X * G(K)
16 % where G(K) depends on the distribution type:
17 % - Exponential: G(K) = H_K - 1 (where H_K
is the K-th harmonic number)
18 % - Uniform: G(K) = sqrt(3) * (K-1) / (K+1)
19 % - EVD: G(K) = sqrt(6) * ln(K) / pi
20 % - General: G(K) <= (K-1) / sqrt(2K-1) (upper bound)
24 % Xmax = fj_xmax_approx(K, mu_X, sigma_X, dist_type)
29 % <tr><th>Name<th>Description
30 % <tr><td>K<td>Number of random variables (positive integer)
31 % <tr><td>mu_X<td>Mean of the distribution
32 % <tr><td>sigma_X<td>Standard deviation of the distribution
33 % <tr><td>dist_type<td>Distribution type:
'exp',
'uniform',
'evd',
'bound' (default:
'exp')
38 % <tr><th>Name<th>Description
39 % <tr><td>Xmax<td>Approximate expected maximum X_K^max
40 % <tr><td>GK<td>The G(K) factor used
44 % A. Thomasian,
"Analysis of Fork/Join and Related Queueing Systems",
45 % ACM Computing Surveys, Vol. 47, No. 2, Article 17, July 2014.
46 % Eq. (22) and (23) on page 17:16.
48 % Original: H.A. David,
"Order Statistics", Wiley, 1970.
50function [Xmax, GK] = fj_xmax_approx(K, mu_X, sigma_X, dist_type)
57 line_error(mfilename,
'K must be a positive integer. Got K=%d.', K);
61 line_error(mfilename,
'Standard deviation sigma_X must be non-negative.');
64% Compute G(K) based on distribution type
65switch lower(dist_type)
67 % Exponential distribution: G(K) = H_K - 1
68 GK = fj_harmonic(K) - 1;
71 % Uniform distribution: G(K) = sqrt(3) * (K-1) / (K+1)
72 GK = sqrt(3) * (K - 1) / (K + 1);
75 % Extreme Value Distribution: G(K) = sqrt(6) * ln(K) / pi
76 GK = sqrt(6) * log(K) / pi;
79 % Upper bound
for any distribution: G(K) <= (K-1) / sqrt(2K-1)
80 GK = (K - 1) / sqrt(2 * K - 1);
83 line_error(mfilename,
'Unknown distribution type: %s. Valid: exp, uniform, evd, bound.', dist_type);
86% X_K^max ≈ mu_X + sigma_X * G(K)
87Xmax = mu_X + sigma_X * GK;