I'd like to compute the density of a multivariate dirichlet distribution and to generate random realizations from such a distribution. Like what the function dmvnorm does with the multivariate normal distribution. I found this for the normal distribution and i would like to know if there is a function that could do this for the Dirichlet and Gamma distribution :
g <- expand.grid(x = seq(-2,2,0.05), y = seq(-2,2,0.05)) ## x and y are the 2 normal distributions.
g$z <- dmvnorm(x=cbind(g$x,g$y),mean = c(0,0),sigma = diag(2),log = FALSE)