0

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)
  • For the Dirichlet, look at the package `gtools` and the `rdirichlet` and `ddirichlet` functions. – nicola Jul 08 '17 at 17:48
  • Reason for close vote: failure to do (or at least to report difficulties in doing so) the obvious search on google with "r package dirichlet random". (Multiple packages found.) – IRTFM Jul 08 '17 at 20:20

0 Answers0