SSJ
V. 2.6.

umontreal.iro.lecuyer.probdist
Class HypoExponentialDist

java.lang.Object
  extended by umontreal.iro.lecuyer.probdist.ContinuousDistribution
      extended by umontreal.iro.lecuyer.probdist.HypoExponentialDist
All Implemented Interfaces:
Distribution
Direct Known Subclasses:
HypoExponentialDistEqual, HypoExponentialDistQuick

public class HypoExponentialDist
extends ContinuousDistribution

This class implements the hypoexponential distribution, also called the generalized Erlang distribution. Let the Xj, j = 1,…, k, be k independent exponential random variables with different rates λj, i.e. assume that λjλi for ij. Then the sum j=1kXj is called a hypoexponential random variable.

Let the k×k upper triangular bidiagonal matrix

A = 1#1

with λj the rates of the k exponential random variables; then the cumulative complementary probability of the hypoexponential distribution is given by

bar(F)(x) = P[X1 + ... + Xk > x] = ∑j=1k(eAx)1j,

i.e., it is the sum of the elements of the first row of matrix eAx. The density of the hypoexponential distribution is

f (x) = (- eAxA)1k = λk(eAx)1k,

i.e., it is element (1, k) of matrix - eAxA. The distribution function is as usual F(x) = 1 - bar(F)(x).

See the class HypoExponentialDistQuick for alternative formulae for the probabilities.


Field Summary
 
Fields inherited from class umontreal.iro.lecuyer.probdist.ContinuousDistribution
decPrec
 
Constructor Summary
HypoExponentialDist(double[] lambda)
          Constructs a HypoExponentialDist object, with rates λi = lambda[i - 1], i = 1,…, k.
 
Method Summary
 double barF(double x)
          Returns the complementary distribution function.
static double barF(double[] lambda, double x)
          Computes the complementary distribution bar(F)(x), with λi = lambda[i - 1], i = 1,…, k.
 double cdf(double x)
          Returns the distribution function F(x).
static double cdf(double[] lambda, double x)
          Computes the distribution function F(x), with λi = lambda[i - 1], i = 1,…, k.
static double cdf2(double[] lambda, double x)
          Computes the distribution function F(x), with λi = lambda[i - 1], i = 1,…, k.
 double density(double x)
          Returns f (x), the density evaluated at x.
static double density(double[] lambda, double x)
          Computes the density function f (x), with λi = lambda[i - 1], i = 1,…, k.
 double[] getLambda()
          Returns the values λi for this object.
 double getMean()
          Returns the mean.
static double getMean(double[] lambda)
          Returns the mean, E[X] = ∑i=1k1/λi, of the hypoexponential distribution with rates λi = lambda[i - 1], i = 1,…, k.
 double[] getParams()
          Same as getLambda.
 double getStandardDeviation()
          Returns the standard deviation.
static double getStandardDeviation(double[] lambda)
          Returns the standard deviation of the hypoexponential distribution with rates λi = lambda[i - 1], i = 1,…, k.
 double getVariance()
          Returns the variance.
static double getVariance(double[] lambda)
          Returns the variance, Var[X] = ∑i=1k1/λi2, of the hypoexponential distribution with rates λi = lambda[i - 1], i = 1,…, k.
 double inverseF(double u)
          Returns the inverse distribution function x = F-1(u).
static double inverseF(double[] lambda, double u)
          Computes the inverse distribution function F-1(u), with λi = lambda[i - 1], i = 1,…, k.
 void setLambda(double[] lambda)
          Sets the values λi =lambda[i - 1], i = 1,…, k for this object.
 String toString()
           
 
Methods inherited from class umontreal.iro.lecuyer.probdist.ContinuousDistribution
getXinf, getXsup, inverseBisection, inverseBrent, setXinf, setXsup
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HypoExponentialDist

public HypoExponentialDist(double[] lambda)
Constructs a HypoExponentialDist object, with rates λi = lambda[i - 1], i = 1,…, k.

Parameters:
lambda - rates of the hypoexponential distribution
Method Detail

density

public double density(double x)
Description copied from class: ContinuousDistribution
Returns f (x), the density evaluated at x.

Specified by:
density in class ContinuousDistribution
Parameters:
x - value at which the density is evaluated
Returns:
density function evaluated at x

cdf

public double cdf(double x)
Description copied from interface: Distribution
Returns the distribution function F(x).

Parameters:
x - value at which the distribution function is evaluated
Returns:
distribution function evaluated at x

barF

public double barF(double x)
Description copied from class: ContinuousDistribution
Returns the complementary distribution function. The default implementation computes bar(F)(x) = 1 - F(x).

Specified by:
barF in interface Distribution
Overrides:
barF in class ContinuousDistribution
Parameters:
x - value at which the complementary distribution function is evaluated
Returns:
complementary distribution function evaluated at x

inverseF

public double inverseF(double u)
Description copied from class: ContinuousDistribution
Returns the inverse distribution function x = F-1(u). Restrictions: u∈[0, 1].

Specified by:
inverseF in interface Distribution
Overrides:
inverseF in class ContinuousDistribution
Parameters:
u - value at which the inverse distribution function is evaluated
Returns:
the inverse distribution function evaluated at u

getMean

public double getMean()
Description copied from class: ContinuousDistribution
Returns the mean.

Specified by:
getMean in interface Distribution
Overrides:
getMean in class ContinuousDistribution
Returns:
the mean

getVariance

public double getVariance()
Description copied from class: ContinuousDistribution
Returns the variance.

Specified by:
getVariance in interface Distribution
Overrides:
getVariance in class ContinuousDistribution
Returns:
the variance

getStandardDeviation

public double getStandardDeviation()
Description copied from class: ContinuousDistribution
Returns the standard deviation.

Specified by:
getStandardDeviation in interface Distribution
Overrides:
getStandardDeviation in class ContinuousDistribution
Returns:
the standard deviation

density

public static double density(double[] lambda,
                             double x)
Computes the density function f (x), with λi = lambda[i - 1], i = 1,…, k.

Parameters:
lambda - rates of the hypoexponential distribution
x - value at which the density is evaluated
Returns:
density at x

cdf

public static double cdf(double[] lambda,
                         double x)
Computes the distribution function F(x), with λi = lambda[i - 1], i = 1,…, k.

Parameters:
lambda - rates of the hypoexponential distribution
x - value at which the distribution is evaluated
Returns:
distribution at x

cdf2

public static double cdf2(double[] lambda,
                          double x)
Computes the distribution function F(x), with λi = lambda[i - 1], i = 1,…, k. Returns 1 -barF(lambda, x), which is much faster than cdf but loses precision in the lower tail.

Parameters:
lambda - rates of the hypoexponential distribution
x - value at which the distribution is evaluated
Returns:
distribution at x

barF

public static double barF(double[] lambda,
                          double x)
Computes the complementary distribution bar(F)(x), with λi = lambda[i - 1], i = 1,…, k.

Parameters:
lambda - rates of the hypoexponential distribution
x - value at which the complementary distribution is evaluated
Returns:
complementary distribution at x

inverseF

public static double inverseF(double[] lambda,
                              double u)
Computes the inverse distribution function F-1(u), with λi = lambda[i - 1], i = 1,…, k.

Parameters:
lambda - rates of the hypoexponential distribution
u - value at which the inverse distribution is evaluated
Returns:
inverse distribution at u

getMean

public static double getMean(double[] lambda)
Returns the mean, E[X] = ∑i=1k1/λi, of the hypoexponential distribution with rates λi = lambda[i - 1], i = 1,…, k.

Parameters:
lambda - rates of the hypoexponential distribution
Returns:
mean of the hypoexponential distribution

getVariance

public static double getVariance(double[] lambda)
Returns the variance, Var[X] = ∑i=1k1/λi2, of the hypoexponential distribution with rates λi = lambda[i - 1], i = 1,…, k.

Parameters:
lambda - rates of the hypoexponential distribution
Returns:
variance of the hypoexponential distribution

getStandardDeviation

public static double getStandardDeviation(double[] lambda)
Returns the standard deviation of the hypoexponential distribution with rates λi = lambda[i - 1], i = 1,…, k.

Parameters:
lambda - rates of the hypoexponential distribution
Returns:
standard deviation of the hypoexponential distribution

getLambda

public double[] getLambda()
Returns the values λi for this object.


setLambda

public void setLambda(double[] lambda)
Sets the values λi =lambda[i - 1], i = 1,…, k for this object.


getParams

public double[] getParams()
Same as getLambda.


toString

public String toString()
Overrides:
toString in class Object

SSJ
V. 2.6.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.