# Hypoexponential distribution

In probability theory the hypoexponential distribution or the generalized Erlang distribution is a continuous distribution, that has found use in the same fields as the Erlang distribution, such as queueing theory, teletraffic engineering and more generally in stochastic processes. It is called the hypoexponetial distribution as it has a coefficient of variation less than one, compared to the hyper-exponential distribution which has coefficient of variation greater than one and the exponential distribution which has coefficient of variation of one.

## Overview

The Erlang distribution is a series of k exponential distributions all with rate $\lambda$. The hypoexponential is a series of k exponential distributions each with their own rate $\lambda _{i}$, the rate of the $i^{th}$ exponential distribution. If we have k independently distributed exponential random variables ${\boldsymbol {X}}_{i}$, then the random variable,
    ${\boldsymbol {X}}=\sum _{i=1}^{k}{\boldsymbol {X}}_{i}$
is hypoexponentially distributed. The hypoexponential has a minimum coefficient of variation of $1/k$.

### Relation to the phase-type distribution

As a result of the definition it is easier to consider this distribution as a special case of the phase-type distribution. The phase-type distribution is the time to absorption of a finite state Markov process. If we have a k+1 state process, where the first k states are transient and the state k+1 is an absorbing state, then the distribution of time from the start of the process until the absorbing state is reached is phase-type distributed. This becomes the hypoexponential if we start in the first 1 and move skip-free from state i to i+1 with rate $\lambda _{i}$ until state k transitions with rate $\lambda _{k}$ to the absorbing state k+1. This can be written in the form of a subgenerator matrix,
    $\left[{\begin{matrix}-\lambda _{1}&\lambda _{1}&0&\dots &0&0\\0&-\lambda _{2}&\lambda _{2}&\ddots &0&0\\\vdots &\ddots &\ddots &\ddots &\ddots &\vdots \\0&0&\ddots &-\lambda _{k-2}&\lambda _{k-2}&0\\0&0&\dots &0&-\lambda _{k-1}&\lambda _{k-1}\\0&0&\dots &0&0&-\lambda _{k}\end{matrix}}\right]\;.$
For simplicity denote the above matrix $\Theta \equiv \Theta (\lambda _{1},\dots ,\lambda _{k})$. If the probability of starting in each of the k states is
    ${\boldsymbol {\alpha }}=(1,0,\dots ,0)$
then $Hypo(\lambda _{1},\dots ,\lambda _{k})=PH({\boldsymbol {\alpha }},\Theta ).$

## Two parameter case

Where the distribution has two parameters ($\lambda _{1}\neq \lambda _{2}$) the explicit forms of the probability functions and the associated statistics are:
CDF: $F(x)=1-{\frac {\lambda _{2}}{\lambda _{2}-\lambda _{1}}}e^{-\lambda _{1}x}-{\frac {\lambda _{1}}{\lambda _{1}-\lambda _{2}}}e^{-\lambda _{2}x}$
PDF: $f(x)={\frac {\lambda _{1}\lambda _{2}}{\lambda _{1}-\lambda _{2}}}(e^{-x\lambda _{2}}-e^{-x\lambda _{1}})$
Mean: ${\frac {1}{\lambda _{1}}}+{\frac {1}{\lambda _{2}}}$
Variance: ${\frac {1}{\lambda _{1}^{2}}}+{\frac {1}{\lambda _{2}^{2}}}$
Coefficient of variation: ${\frac {\sqrt {\lambda _{1}^{2}+\lambda _{2}^{2}}}{\lambda _{1}+\lambda _{2}}}$
The coefficient of variation is always less than 1.
Given the sample mean (${\bar {x}}$) and sample coefficient of variation ($c$), the parameters $\lambda _{1}$ and $\lambda _{2}$ can be estimated as follows:
$\lambda _{1}={\frac {2}{\bar {x}}}\left[1+{\sqrt {1+2(c^{2}-1)}}\right]^{-1}$
$\lambda _{2}={\frac {2}{\bar {x}}}\left[1-{\sqrt {1+2(c^{2}-1)}}\right]^{-1}$
These estimators can be derived from the methods of moments by setting ${\frac {1}{\lambda _{1}}}+{\frac {1}{\lambda _{2}}}={\bar {x}}$ and ${\frac {\sqrt {\lambda _{1}^{2}+\lambda _{2}^{2}}}{\lambda _{1}+\lambda _{2}}}=c$.
The resulting parameters $\lambda _{1}$ and $\lambda _{2}$ are real values if $c^{2}\in [0.5,1]$.

## Characterization

A random variable ${\boldsymbol {X}}\sim Hypo(\lambda _{1},\dots ,\lambda _{k})$ has cumulative distribution function given by,
    $F(x)=1-{\boldsymbol {\alpha }}e^{x\Theta }{\boldsymbol {1}}$
and density function,
    $f(x)=-{\boldsymbol {\alpha }}e^{x\Theta }\Theta {\boldsymbol {1}}\;,$
where ${\boldsymbol {1}}$ is a column vector of ones of the size k and $e^{A}$ is the matrix exponential of A. When $\lambda _{i}\neq \lambda _{j}$ for all $i\neq j$, the density function can be written as
    $f(x)=\sum _{i=1}^{k}\lambda _{i}e^{-x\lambda _{i}}\left(\prod _{j=1,j\neq i}^{k}{\frac {\lambda _{j}}{\lambda _{j}-\lambda _{i}}}\right)=\sum _{i=1}^{k}\ell _{i}(0)\lambda _{i}e^{-x\lambda _{i}}$
where $\ell _{1}(x),\dots ,\ell _{k}(x)$ are the Lagrange basis polynomials associated with the points $\lambda _{1},\dots ,\lambda _{k}$.
The distribution has Laplace transform of
    ${\mathcal {L}}\{f(x)\}=-{\boldsymbol {\alpha }}(sI-\Theta )^{-1}\Theta {\boldsymbol {1}}$
Which can be used to find moments,
    $E[X^{n}]=(-1)^{n}n!{\boldsymbol {\alpha }}\Theta ^{-n}{\boldsymbol {1}}\;.$

## General case

In the general case where there are $a$ distinct sums of exponential distributions with rates $\lambda _{1},\lambda _{2},\cdots ,\lambda _{a}$ and a number of terms in each sum equals to $r_{1},r_{2},\cdots ,r_{a}$ respectively. The cumulative distribution function for $t\geq 0$ is given by
    $F(t)=1-\left(\prod _{j=1}^{a}\lambda _{j}^{r_{j}}\right)\sum _{k=1}^{a}\sum _{l=1}^{r_{k}}{\frac {\Psi _{k,l}(-\lambda _{k})t^{r_{k}-l}\exp(-\lambda _{k}t)}{(r_{k}-l)!(l-1)!}},$
with
    $\Psi _{k,l}(x)=-{\frac {\partial ^{l-1}}{\partial x^{l-1}}}\left(\prod _{j=0,j\neq k}^{a}\left(\lambda _{j}+x\right)^{-r_{j}}\right).$
with the additional convention $\lambda _{0}=0,r_{0}=1$.

## Uses

This distribution has been used in population genetics, cell biology, and queuing theory.