| dirichlet | R Documentation |
Density and and random generation for the Dirichlet distribution.
ddirichlet(x, alpha, log = FALSE)
rdirichlet(n, alpha)
x |
vector or matrix of quantiles. If |
alpha |
vector or matrix of positive shape parameters |
log |
logical; if |
n |
number of random values to return. |
This implementation of ddirichlet allows for automatic differentiation with RTMB.
ddirichlet gives the density, rdirichlet generates random deviates.
# single alpha
alpha <- c(1,2,3)
x <- rdirichlet(1, alpha)
d <- ddirichlet(x, alpha)
# vectorised over alpha
alpha <- rbind(alpha, 2*alpha)
x <- rdirichlet(2, alpha)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.