Class Qsys_maxima_twomoment

java.lang.Object
jline.api.qsys.Qsys_maxima_twomoment

public final class Qsys_maxima_twomoment extends Object
Two-moment approximation for the maximum of n iid non-negative variables.

THE SHAPE OF THE ANSWER. For a law with an exponential-like tail the maximum of n samples grows like c~^2 (log n + ...): doubling n ADDS a constant, it does not scale the answer. The two moments buy the SLOPE and an offset: x_n(q) = c~^2[log(n eta) - log log(1/q)], E[M_n] = c~^2[log(n eta) + gamma], with c~^2 = cs2 and eta = (cs2+1)/(2cs2^2) for cs2 >= 1 (the H2 representative), and c~^2 = sqrt(cs2), eta = exp((1-sqrt(cs2))/sqrt(cs2)) below (the shifted exponential).

WHEN NOT TO USE IT: n must pass n* ~ cs2/q, because with a highly variable law only about n p of the samples can contend for the maximum. Measured against exact maxima the closed form is within a few percent for n >= 100 at cs2 = 4 and 16, and useless at n = 10 for cs2 = 16 -- exactly what n* predicts.

AND WHEN TWO MOMENTS ARE NOT ENOUGH: below cs2 = 1 the maximum is genuinely family-dependent, an Erlang and a shifted exponential with the same two moments differing by tens of percent and diverging as n grows.

Port of MATLAB qsys_maxima_twomoment.m.

Reference: C. Crow, D. Goldberg, W. Whitt (2007). Two-moment approximations for maxima. Operations Research 55(3), 532-548.

Since:
LINE 3.1.0
  • Method Details

    • qsys_maxima_twomoment

      public static Map<String,Double> qsys_maxima_twomoment(int n, double mean, double cs2)
      The mean of the maximum.
      Parameters:
      n - the number of samples
      mean - the mean of the underlying law
      cs2 - its squared coefficient of variation
      Returns:
      map with value, slope, eta, threshold, reliable, exactFittedValue
    • qsys_maxima_twomoment

      public static Map<String,Double> qsys_maxima_twomoment(int n, double mean, double cs2, double q, boolean exactFitted)
      Parameters:
      n - the number of samples
      mean - the mean of the underlying law
      cs2 - its squared coefficient of variation
      q - a quantile level in (0,1); NaN returns the mean
      exactFitted - also compute the maximum exactly from the fitted law
      Returns:
      map with value, slope, eta, threshold, reliable (1 or 0) and, when requested, exactFittedValue