R/rhypoexp.R

Defines functions rhypoexp

Documented in rhypoexp

rhypoexp <- function(n = 1L, rate = 1.0) {

    if ((rlen <- length(rate)) == 1L) {
        return(rexp(n = n, rate = rate))   
    }

    if ((nlen <- length(n)) > 1L) {
        n <- nlen
    }

#     rowSums(matrix(vapply(X         = rate,
#                           FUN       = rexp,
#                           FUN.VALUE = numeric(n),
#                           n         = n),
#                    nrow = n,
#                    ncol = length(rate)))

    colSums(matrix(data = rexp(n    = n * rlen,
                               rate = rate),
                   nrow = rlen,
                   ncol = n))
}

Try the sdprisk package in your browser

Any scripts or data that you put into this service are public.

sdprisk documentation built on May 1, 2019, 7:50 p.m.