This class is a subclass of HypoExponentialDist and also implements the hypoexponential distribution. More...
Public Member Functions | |
| HypoExponentialDistQuick (double[] lambda) | |
| Constructs a HypoExponentialDistQuick object, with rates. | |
| double | density (double x) |
| Returns \(f(x)\), the density evaluated at \(x\). | |
| double | cdf (double x) |
| Returns the distribution function \(F(x)\). | |
| double | barF (double x) |
| Returns the complementary distribution function. | |
| double | inverseF (double u) |
| Returns the inverse distribution function \(x = F^{-1}(u)\). | |
| void | setLambda (double[] lambda) |
| Sets the values \(\lambda_i =
\)lambda[ \(i-1\)], \(i = 1,…,k\) for this object. | |
| String | toString () |
| Returns a String containing information about the current distribution. | |
| Public Member Functions inherited from umontreal.ssj.probdist.HypoExponentialDist | |
| HypoExponentialDist (double[] lambda) | |
| Constructs a HypoExponentialDist object, with rates \(\lambda_i = \) lambda[ \(i-1\)], \(i = 1,…,k\). | |
| double | getMean () |
| Returns the mean. | |
| double | getVariance () |
| Returns the variance. | |
| double | getStandardDeviation () |
| Returns the standard deviation. | |
| double[] | getLambda () |
| Returns the values \(\lambda_i\) for this object. | |
| double[] | getParams () |
| Same as getLambda. | |
| Public Member Functions inherited from umontreal.ssj.probdist.ContinuousDistribution | |
| double | inverseBrent (double a, double b, double u, double tol) |
| Computes the inverse distribution function \(x = F^{-1}(u)\), using the Brent-Dekker method. | |
| double | inverseBisection (double u) |
| Computes and returns the inverse distribution function \(x = F^{-1}(u)\), using bisection. | |
| double | getXinf () |
| Returns \(x_a\) such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\). | |
| double | getXsup () |
| Returns \(x_b\) such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\). | |
| void | setXinf (double xa) |
| Sets the value \(x_a=\) xa, such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\). | |
| void | setXsup (double xb) |
| Sets the value \(x_b=\) xb, such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\). | |
Static Public Member Functions | |
| static double | density (double[] lambda, double x) |
| Computes the density function \(f(x)\), with \(\lambda_i = \) lambda[ \(i-1\)], \(i = 1,…,k\). | |
| static double | cdf (double[] lambda, double x) |
| Computes the distribution function \(F(x)\), with \(\lambda_i =
\) lambda[ \(i-1\)], \(i = 1,…,k\). | |
| static double | barF (double[] lambda, double x) |
| Computes the complementary distribution \(\bar{F}(x)\), with. | |
| static double | inverseF (double[] lambda, double u) |
| Computes the inverse distribution function \(F^{-1}(u)\), with. | |
| Static Public Member Functions inherited from umontreal.ssj.probdist.HypoExponentialDist | |
| static double | cdf2 (double[] lambda, double x) |
| Computes the distribution function \(F(x)\), with \(\lambda_i =
\) lambda[ \(i-1\)], \(i = 1,…,k\). | |
| static double | getMean (double[] lambda) |
| Returns the mean, \(E[X] = \sum_{i=1}^k 1/\lambda_i\), of the hypoexponential distribution with rates \(\lambda_i = \) lambda[ \(i-1\)], \(i = 1,…,k\). | |
| static double | getVariance (double[] lambda) |
| Returns the variance, \(\mbox{Var}[X] = \sum_{i=1}^k 1/\lambda_i^2\), of the hypoexponential distribution with rates. | |
| static double | getStandardDeviation (double[] lambda) |
| Returns the standard deviation of the hypoexponential distribution with rates \(\lambda_i = \) lambda[ \(i-1\)],. | |
This class is a subclass of HypoExponentialDist and also implements the hypoexponential distribution.
It uses different algorithms to compute the probabilities. The formula ( tail-hypoexp ) for the complementary distribution is mathematically equivalent to (see [pROS07b] (page 299) and
[66] (Appendix B))
\[ \bar{F}(x) = \mathbb P\left[X_1 + \cdots+ X_k > x \right] = \sum_{i=1}^k e^{-\lambda_i x} \prod_{\substack {j=1\\j\not i}}^k \frac{\lambda_j}{\lambda_j - \lambda_i}. \tag{convolution-hypo} \]
The expression ( convolution-hypo ) is much faster to compute than the matrix exponential formula ( tail-hypoexp ), but it becomes numerically unstable when \(k\) gets large and/or the differences between the \(\lambda_i\) are too small, because it is an alternating sum with relatively large terms of similar size. When the \(\lambda_i\) are close, many of the factors \(\lambda_j - \lambda_i\) in ( convolution-hypo ) are small, and the effect of this is amplified when \(k\) is large. This gives rise to large terms of opposite sign in the sum and the formula becomes unstable due to subtractive cancellation. For example, with the computations done in standard 64-bit floating-point arithmetic, if the \(\lambda_i\) are regularly spaced with differences of \(\lambda_{i+1} - \lambda_i = 0.1\) for all \(i\), the formula ( convolution-hypo ) breaks down already for \(k \approx15\), while if the differences \(\lambda_{i+1} - \lambda_i = 3\), it gives a few decimal digits of precision for \(k\) up to \(\approx300\).
The formula ( fhypoexp ) for the density is mathematically equivalent to the much faster formula
\[ f(x) = \sum_{i=1}^k\lambda_i e^{-\lambda_i x} \prod_{\substack {j=1\\j\not i}}^k \frac{\lambda_j}{\lambda_j - \lambda_i}, \tag{fhypoexp2} \]
which is also numerically unstable when \(k\) gets large and/or the differences between the \(\lambda_i\) are too small.
Definition at line 82 of file HypoExponentialDistQuick.java.
| umontreal.ssj.probdist.HypoExponentialDistQuick.HypoExponentialDistQuick | ( | double[] | lambda | ) |
Constructs a HypoExponentialDistQuick object, with rates.
\(\lambda_i = \) lambda[ \(i-1\)], \(i = 1,…,k\).
| lambda | rates of the hypoexponential distribution |
Definition at line 170 of file HypoExponentialDistQuick.java.
| double umontreal.ssj.probdist.HypoExponentialDistQuick.barF | ( | double | x | ) |
Returns the complementary distribution function.
The default implementation computes \(\bar{F}(x) = 1 - F(x)\).
| x | value at which the complementary distribution function is evaluated |
Reimplemented from umontreal.ssj.probdist.HypoExponentialDist.
Definition at line 186 of file HypoExponentialDistQuick.java.
|
static |
Computes the complementary distribution \(\bar{F}(x)\), with.
\(\lambda_i = \) lambda[ \(i-1\)], \(i = 1,…,k\).
| lambda | rates of the hypoexponential distribution |
| x | value at which the complementary distribution is evaluated |
Reimplemented from umontreal.ssj.probdist.HypoExponentialDist.
Definition at line 230 of file HypoExponentialDistQuick.java.
| double umontreal.ssj.probdist.HypoExponentialDistQuick.cdf | ( | double | x | ) |
Returns the distribution function \(F(x)\).
| x | value at which the distribution function is evaluated |
Reimplemented from umontreal.ssj.probdist.HypoExponentialDist.
Definition at line 182 of file HypoExponentialDistQuick.java.
|
static |
Computes the distribution function \(F(x)\), with \(\lambda_i = \) lambda[ \(i-1\)], \(i = 1,…,k\).
| lambda | rates of the hypoexponential distribution |
| x | value at which the distribution is evaluated |
Reimplemented from umontreal.ssj.probdist.HypoExponentialDist.
Definition at line 216 of file HypoExponentialDistQuick.java.
| double umontreal.ssj.probdist.HypoExponentialDistQuick.density | ( | double | x | ) |
Returns \(f(x)\), the density evaluated at \(x\).
| x | value at which the density is evaluated |
Reimplemented from umontreal.ssj.probdist.HypoExponentialDist.
Definition at line 178 of file HypoExponentialDistQuick.java.
|
static |
Computes the density function \(f(x)\), with \(\lambda_i = \) lambda[ \(i-1\)], \(i = 1,…,k\).
| lambda | rates of the hypoexponential distribution |
| x | value at which the density is evaluated |
Reimplemented from umontreal.ssj.probdist.HypoExponentialDist.
Definition at line 202 of file HypoExponentialDistQuick.java.
| double umontreal.ssj.probdist.HypoExponentialDistQuick.inverseF | ( | double | u | ) |
Returns the inverse distribution function \(x = F^{-1}(u)\).
Restrictions: \(u \in[0,1]\).
| u | value at which the inverse distribution function is evaluated |
| IllegalArgumentException | if \(u\) is not in the interval \([0,1]\) |
Reimplemented from umontreal.ssj.probdist.HypoExponentialDist.
Definition at line 190 of file HypoExponentialDistQuick.java.
|
static |
Computes the inverse distribution function \(F^{-1}(u)\), with.
\(\lambda_i = \) lambda[ \(i-1\)], \(i = 1,…,k\).
| lambda | rates of the hypoexponential distribution |
| u | value at which the inverse distribution is evaluated |
Reimplemented from umontreal.ssj.probdist.HypoExponentialDist.
Definition at line 244 of file HypoExponentialDistQuick.java.
| void umontreal.ssj.probdist.HypoExponentialDistQuick.setLambda | ( | double[] | lambda | ) |
Sets the values \(\lambda_i = \)lambda[ \(i-1\)], \(i = 1,…,k\) for this object.
Reimplemented from umontreal.ssj.probdist.HypoExponentialDist.
Definition at line 276 of file HypoExponentialDistQuick.java.
| String umontreal.ssj.probdist.HypoExponentialDistQuick.toString | ( | ) |
Returns a String containing information about the current distribution.
Reimplemented from umontreal.ssj.probdist.HypoExponentialDist.
Definition at line 283 of file HypoExponentialDistQuick.java.