dhyperdirichlet(c(1,4,3,2)/10, dirichlet(1:4))
rhyperdirichlet(20, dirichlet(1:3))
diff(c(0,sort(runif(9)),1)) # random sample drawn from dirichlet(rep(1,10))
# how to draw a single observation from the hyperdirichlet:
f <- function(HD,n,...){rhyperdirichlet(n,HD=HD,...)[n,,drop=TRUE]}
f(dirichlet(1:3),n=100)
f(dirichlet(1:3),n=100)
f(dirichlet(1:3),n=100)
# Note, n=100 might not be enough burn-in.
Run the code above in your browser using DataLab