R/rdirichlet.R

`rdirichlet` <-
function (n, alpha) 

{

    l <- length(alpha)

    x <- matrix(rgamma(l * n, alpha), ncol = l, byrow = TRUE)

    sm <- x %*% rep(1, l)

    return(x/as.vector(sm))

}

Try the BGSIMD package in your browser

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

BGSIMD documentation built on May 2, 2019, 5:12 a.m.