Tools for Phase-Type Distributions (butools.ph)

To load this package, either start the BuToolsInit script, or execute

addpath('butools/ph') in Matlab,
<<"BuTools`PH` in Mathematica,
from butools.ph import * in Python/Numpy.

Phase-type and matrix-exponential distributions

Continuous time phase-type (PH) distributions are characterized by two parameters, the initial probability vector \(\alpha\) and the transient generator matrix of a continuous time (transient) Markov chain \(\alpha\). The PH distribution represents the absorption time of this transient Markov chain starting from \(\alpha\). The cummulative distribution function (cdf) of PH distributions is

\[F_{PH}(t) = 1-\alpha e^{A\,t} \mathbf{1},\]

where \(\mathbf{1}\) is the column vector of ones.

Matrix exponential (ME) distributions are the generalizations of PH distributions. Formally, the cdf and all the related formulas for the statistical quantities are very similar to the ones of PH distributions

\[F_{ME}(t) = 1-\mathbf{b} e^{B\,t} \mathbf{e},\]

however, \(\mathbf{b},B\) and \(\mathbf{e}\) can hold general numbers, the entries do not have to be valid probabilities or transition rates. ME distributions therefore lack the simple stochastic interpretation that PH distributions have. Vector \(\mathbf{b}\) is called “starting operator”, matrix \(B\) is the “process rate operator” and vector \(\mathbf{e}\) is the “summing operator” [1].

BuTools provides several tools for both distribution classes in the ph package. However, BuTools uses a special form of ME distributions, where the summing operator is a vector of ones, thus \(\mathbf{e}=\mathbf{1}\). This is not a restriction, as all ME distributions defined with general summing operator can be easily transformed to this representation. Assume we have an ME distribution in the general form with parameters \(\mathbf{b}, B, \mathbf{e}\). The necessary similarity transform is obtained by calling the T = TransformToOnes(e) procedure of the BuTools reptrans package. The parameters of the ME distribution used by all related BuTools tools can be calculated by \(\mathbf{b'}=\mathbf{b}T^{-1}\) and \(B'=T\,B\,T^{-1}\).

Simple statistical properties and tools

MomentsFromME Returns the moments of a matrix-exponential distribution.
MomentsFromPH Returns the moments of a continuous phase-type distribution.
CdfFromME Returns the cummulative distribution function of a matrix-exponential distribution.
CdfFromPH Returns the cummulative distribution function of a continuous phase-type distribution.
PdfFromME Returns the probability density function of a matrix-exponential distribution.
PdfFromPH Returns the probability density function of a continuous phase-type distribution.
IntervalPdfFromPH Returns the approximate probability density function of a continuous phase-type distribution, based on the probability of falling into intervals.
RandomPH Returns a random phase-type distribution with a given order.
CheckPHRepresentation Checks if the given vector and matrix define a valid phase-type representation.
CheckMERepresentation Checks if the given vector and matrix define a valid matrix-exponential representation.
CheckMEPositiveDensity Checks if the given matrix-exponential distribution has positive density.
SamplesFromPH Generates random samples from a phase-type distribution.
ImageFromPH Depicts the given phase-type distribution, and either displays it or saves it to file.

Inverse characterization tools

APHFrom2Moments Returns an acyclic PH which has the same 2 moments as given.
APHFrom3Moments Returns an acyclic PH which has the same 3 moments as given.
PH2From3Moments Returns a PH(2) which has the same 3 moments as given.
PH3From5Moments Returns a PH(3) which has the same 5 moments as given.
MEFromMoments Creates a matrix-exponential distribution that has the same moments as given.
APH2ndMomentLowerBound Returns the lower bound of the second moment of acyclic phase-type (APH) distributions of order n.
APH3rdMomentLowerBound Returns the lower bound of the third moment of acyclic phase-type (APH) distributions of order n.
APH3rdMomentUpperBound Returns the upper bound of the third moment of acyclic phase-type (APH) distributions of order n.

Representation transformation methods

CanonicalFromPH2 Returns the canonical form of an order-2 phase-type distribution.
CanonicalFromPH3 Returns the canonical form of an order-3 phase-type distribution.
AcyclicPHFromME Transforms an arbitrary matrix-exponential representation to an acyclic phase-type representation.
MonocyclicPHFromME Transforms an arbitrary matrix-exponential representation to a Markovian monocyclic representation.
PHFromME Obtains a Markovian representation of a matrix exponential distribution of the same size, if possible.

Minimal representations

MEOrder Returns the order of the ME distribution (which is not necessarily equal to the size of the representation).
MEOrderFromMoments Returns the order of ME distribution that can realize the given moments.
MinimalRepFromME Returns the minimal representation of the given ME distribution.

References

[1]
  1. Lipsky, Queueing Theory: A Linear Algebraic Approach, MacMillan, New York, 1992.