![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Normal and Student t quantiles used by the output-analysis routines. More...
#include <cmath>#include <limits>#include <boost/math/special_functions/beta.hpp>#include <boost/math/special_functions/erf.hpp>#include "line/util/error.h"Go to the source code of this file.
Namespaces | |
| namespace | line |
| namespace | line::sim |
Functions | |
| double | line::sim::sim_normcdf (double z) |
| Standard normal cumulative distribution function. | |
| double | line::sim::sim_norminv (double p) |
| Standard normal quantile function. | |
| double | line::sim::sim_tinv (double p, double nu) |
| Quantile function of Student's t distribution. | |
Normal and Student t quantiles used by the output-analysis routines.
Port of matlab/src/api/sim/sim_normcdf.m, sim_norminv.m and sim_tinv.m, which are grouped here as the JAR groups them in jline.api.sim.SimDist and native Python in line_solver.api.sim.dist. The four codebases reach the same values through four different libraries – MATLAB through erfc/erfinv/betaincinv to avoid a toolbox dependency, the JAR through commons-math3, Python through SciPy and this port through Boost.Math – and agree to within 1e-10.
These are deliberately plain doubles rather than templates on T. A quantile order p and a significance level alpha are doubles at every call site in this family, so the quantile they determine carries double information and no more; see the arithmetic note in sim_types.h.
The t quantile follows the MATLAB identity rather than a distribution object, so the branch structure is comparable line by line with the reference: P(|T| > t) = betainc(nu/(nu+t^2), nu/2, 1/2), inverted for the two-sided tail 2(1-p) and mapped back with t = sqrt(nu (1-z)/z), z = betaincinv(2(1-p), nu/2, 1/2). MATLAB's betaincinv(y, a, b) is Boost's ibeta_inv(a, b, y): both invert the REGULARIZED incomplete beta, and getting the argument order wrong here is a silently plausible wrong number rather than an error.
Definition in file sim_dist.h.