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

.

1 2 3 4 5 |

`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 |

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`

).

`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).

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.

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

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))
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.