View source: R/dist_dirichlet.R
| dist_dirichlet | R Documentation |
The Dirichlet distribution is a multivariate generalisation of the Beta
distribution. It is the conjugate prior of the Categorical and Multinomial
distributions, and describes a probability distribution over the
(k-1)-simplex — the set of k-dimensional vectors whose
components are non-negative and sum to one.
dist_dirichlet(alpha)
alpha |
A list of positive numeric concentration vectors. |
We recommend reading this documentation on pkgdown which renders math nicely. https://pkg.mitchelloharawild.com/distributional/reference/dist_dirichlet.html
In the following, let \mathbf{X} = (X_1, \ldots, X_k) be a
Dirichlet random variable with concentration parameter
alpha = \boldsymbol{\alpha} = (\alpha_1, \ldots, \alpha_k),
where each \alpha_i > 0.
Support: \mathbf{x} on the (k-1)-simplex,
i.e. x_i \geq 0 and \sum_{i=1}^k x_i = 1.
Mean: E(X_i) = \frac{\alpha_i}{\alpha_0} where
\alpha_0 = \sum_{i=1}^k \alpha_i.
Variance:
\mathrm{Var}(X_i) = \frac{\alpha_i(\alpha_0 - \alpha_i)}{\alpha_0^2(\alpha_0 + 1)}
Covariance:
\mathrm{Cov}(X_i, X_j) = \frac{-\alpha_i \alpha_j}{\alpha_0^2(\alpha_0 + 1)}, \quad i \neq j
Probability density function (p.d.f):
f(\mathbf{x}) = \frac{1}{B(\boldsymbol{\alpha})}
\prod_{i=1}^k x_i^{\alpha_i - 1}
where B(\boldsymbol{\alpha}) = \frac{\prod_{i=1}^k \Gamma(\alpha_i)}{\Gamma(\alpha_0)}
is the multivariate Beta function.
LaplacesDemon::ddirichlet(), LaplacesDemon::rdirichlet()
dist <- dist_dirichlet(alpha = list(c(2, 5, 3)))
dist
mean(dist)
variance(dist)
support(dist)
generate(dist, 10)
density(dist, cbind(0.2, 0.5, 0.3))
density(dist, cbind(0.2, 0.5, 0.3), log = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.