R/rdirichlet.R

Defines functions rdirichlet

Documented in rdirichlet

rdirichlet=function(n, shape){
#Dirichlet generator
  d = length(shape)
  x = rgamma(n*d, rep(shape, n))
  x = matrix(x, nrow = d)
  t(sweep(x, 2, apply(x, 2, sum), "/"))
  }

Try the mcsm package in your browser

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

mcsm documentation built on May 2, 2019, 10:16 a.m.