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

Fitting a hyperexponential to a long-tail distribution. More...

#include <cmath>
#include <cstddef>
#include <functional>
#include <vector>
#include "line/num/number.h"
#include "line/util/error.h"
Include dependency graph for hyperexp_fit_longtail.h:

Go to the source code of this file.

Classes

struct  line::mam::HyperexpLongtailResult< T >
 Outcome of the long-tail hyperexponential fit. More...

Namespaces

namespace  line
namespace  line::mam

Functions

template<class T, class Ccdf>
HyperexpLongtailResult< T > line::mam::hyperexp_fit_longtail_k (Ccdf &&ccdf, std::size_t k, const T &c1, const T &b, const T &decade)
 The recursion at a fixed component count.
template<class T, class Ccdf>
HyperexpLongtailResult< T > line::mam::hyperexp_fit_longtail (Ccdf &&ccdf, const T &b=num_traits< T >::from_rational(3, 2), const T &decade=num_traits< T >::from_int(4))
 The fit with the component count chosen automatically: one per decade between the 0.9 quantile and the 1e-6 quantile, retrying with fewer when the recursion runs out of probability near the body.

Detailed Description

Fitting a hyperexponential to a long-tail distribution.

Templated port of matlab/src/api/mam/hyperexp_fit_longtail.m, cross-checked against jar/src/main/java/jline/api/mam/HyperexpFitLongtail.java.

WHY MOMENTS ARE THE WRONG HANDLE. A Pareto law with tail index below 2 has infinite variance, so no two- or three-moment fit exists at all; and even when the moments are finite, matching them says nothing about the several ORDERS OF MAGNITUDE of time scale over which a long-tail law acts. This procedure matches the CCDF ITSELF at points spread across those decades.

THE RECURSION, with lambda_1 < ... < lambda_k. In the far tail only the slowest component survives, so it can be fitted there alone:

lambda_1 = ln(F^c(c_1)/F^c(b c_1))/((b-1)c_1) (4.4) p_1 = F^c(c_1) exp(lambda_1 c_1) (4.5)

subtract it and repeat one decade lower (4.6)-(4.11); the last component takes the remaining probability, p_k = 1 - sum_{j<k} p_j, and its rate follows from the ccdf at c_k (4.12)-(4.14). This is Prony's method applied to a ccdf.

DEFAULTS. (b, decade) = (1.5, 4) rather than the paper's illustrative (2, 10): the fit is exact AT the fitting arguments and free between them, and measured on a Weibull(0.3) the tighter grid cuts the worst between-point error from about 54% to 12%, at the cost of more components.

ARITHMETIC. Logarithms and exponentials throughout: transcendental only.

Reference: A. Feldmann, W. Whitt (1998). Fitting mixtures of exponentials to long-tail distributions to analyze network performance models. Performance Evaluation 31, 245-279, Section 4.

Definition in file hyperexp_fit_longtail.h.