R/random.R

Defines functions rllogis rgompertz

## Drop-in replacement functions (not exported)
rgompertz = function(n, shape, rate) {
    u <- 1-runif(n)
    i <- shape >= 0 | u>=exp(rate/shape)
    y <- rep(Inf, n)
    if (any(i))
        y[i] <- log(1 - shape*log(u[i])/rate) / shape
    y
}
rllogis = function(n, shape, scale) {
    u <- runif(n)
    scale*(u/(1-u))^(1/shape)
}

Try the rstpm2 package in your browser

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

rstpm2 documentation built on March 31, 2023, 8:22 p.m.