# Hypo-Exponential Distribution

### Description

Density, distribution function, quantile function, random generation and
moment-generating function (and its first two derivatives) for the
hypo-exponential distribution with rates `rate`

.

### Usage

1 2 3 4 5 |

### Arguments

`x, q` |
vector of quantiles. |

`p` |
vector of probabilities. |

`n` |
number of observations. If |

`difforder` |
the order of derivative for the moment-generating function; currently only implemented for 0, 1, 2. |

`rate` |
vector of (unique) rates. |

`lower.tail` |
logical; if |

`log, log.p` |
logical; if |

`tailarea` |
logical; if |

`interval` |
Passed to |

### Details

The sum of *n* independent exponentially distributed random variables
*X_{i}* with rate parameters *λ_{i}* has a hypo-exponential
distribution with rate vector *(λ_{1}, …, λ_{n})*.

The hypo-exponential distribution is a generalization of the Erlang distribution (a Gamma distribution with an integer-valued shape parameter) and a special case of the phase-type distribution (see References section).

The quantile function is computed by numeric inversion (using
`uniroot`

).

### Value

`dhypoexp`

gives the density, `phypoexp`

gives the distribution
function (or the integrated tail area distribution function),
`qhypoexp`

gives the quantile function, `rhypoexp`

generates
random deviates and `mgfhypoexp`

gives the moment-generating function
(or its derivative up to the second order).

### Note

If `length(rate) == 1`

, `dhypoexp`

, `phypoexp`

and
`rhypoexp`

are equivalent to `dexp`

,
`pexp`

and `rexp`

with rate parameter
`rate`

and should, in fact, be replaced by the latter ones for
computation speed.

### References

Neuts, M. F. (1981) *Matrix-Geometric Solutions in Stochastic Models:
An Algorithmic Approach*, reprinted and corrected.

### See Also

`dexp`

, `dgamma`

### Examples

1 2 3 4 5 6 7 8 9 10 11 | ```
## Random generation
rhypoexp(10, c(3, 5))
## Mean
mu <- mgfhypoexp(0, c(3, 5), difforder = 1)
## Variance
mgfhypoexp(0, c(3, 5), difforder = 2) - mu^2
## Quantile
qhypoexp(0.5, c(3, 5))
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.