Description Usage Arguments Details References Examples
Density function, cumulative distribution function and random generation for the Dirichlet distribution.
1 2 3 | ddirichlet(x, alpha, log = FALSE)
rdirichlet(n, alpha)
|
x |
k-column matrix of quantiles. |
alpha |
k-values vector or k-column matrix; concentration parameter. Must be positive. |
log |
logical; if TRUE, probabilities p are given as log(p). |
n |
number of observations. If |
Probability density function
f(x) = Γ(sum(α[k])) / prod(Γ(α[k])) * prod(x[k]^{k-1})
Devroye, L. (1986). Non-Uniform Random Variate Generation. Springer-Verlag.
1 2 3 4 5 6 7 8 9 10 | # Generating 10 random draws from Dirichlet distribution
# parametrized using a vector
rdirichlet(10, c(1, 1, 1, 1))
# or parametrized using a matrix where each row
# is a vector of parameters
alpha <- matrix(c(1, 1, 1, 1:3, 7:9), ncol = 3, byrow = TRUE)
rdirichlet(10, alpha)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.