R/truncgamma.R

truncgamma <-
function (n = 1, shape, scale, l, u) 
{
    l1 <- pgamma(l, shape, scale = scale)
    u1 <- pgamma(u, shape, scale = scale)
    x <- runif(n, l1, u1)
    if (x == 0) {
        y = u
    }
    else {
        if (x == 1) {
            y = l
        }
        else {
            y = qgamma(p = x, shape = shape, scale = scale)
        }
    }
    return(y)
}

Try the HSROC package in your browser

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

HSROC documentation built on Sept. 19, 2019, 9:05 a.m.