LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
fj_order_stat.h File Reference

CDF and expected value of the k-th order statistic of K i.i.d. More...

#include <functional>
#include "line/api/fj/fj_types.h"
#include "line/num/number.h"
#include "line/util/error.h"
Include dependency graph for fj_order_stat.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::fj

Functions

template<class T>
FJOrderStatResult< T > line::fj::fj_order_stat (const T &y, unsigned k, unsigned K, const std::function< T(const T &)> &F_X)
 CDF and expected value of the k-th order statistic of K i.i.d.

Detailed Description

CDF and expected value of the k-th order statistic of K i.i.d.

samples.

Templated port of matlab/src/api/fj/fj_order_stat.m. The JAR carries the same CDF in jline.api.fj.FJ_order_stat (identical).

F_{Y_k}(y) = sum_{j=k..K} C(K,j) F(y)^j (1 - F(y))^{K-j} F_{Y_K}(y) = F(y)^K (the maximum)

MIXED ARITHMETIC. The CDF is a polynomial in the value of the base CDF, so it is exact in any field once F(y) is known – and it satisfies the exact identity sum_{k=1..K} F_{Y_k} = K F, plus F_{Y_1} = 1 - (1-F)^K, both of which are bit-exact only in rational arithmetic.

The expected value is a quadrature. For k = 1 and k = K it integrates the survival function directly; for an interior k the MATLAB file differentiates the supplied CDF by a central difference with a fixed step 1e-8, which is a tolerance-driven approximation. Both are therefore produced only when T carries transcendental functions, and mean_available reports which branch ran. The truncation point follows MATLAB: double from 1 until F(u) >= 1-1e-6, at most 100 times.

Definition in file fj_order_stat.h.