R/rdirichlet.R

rdirichlet <-
function (n, parms) 
{
# generate n random vectors from dirichlet
# rejection envelope

    l <- length(parms)
    x <- matrix(rgamma(l * n, parms), ncol = l, byrow = TRUE)
    sm <- x %*% rep(1, l)
    return(x/as.vector(sm))
}

Try the CARrampsOcl package in your browser

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

CARrampsOcl documentation built on May 2, 2019, 3:27 a.m.