% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dist_dirichlet.R
\name{dist_dirichlet}
\alias{dist_dirichlet}
\title{The Dirichlet distribution}
\usage{
dist_dirichlet(alpha)
}
\arguments{
\item{alpha}{A list of positive numeric concentration vectors.}
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}

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
\eqn{(k-1)}-simplex — the set of \eqn{k}-dimensional vectors whose
components are non-negative and sum to one.
}
\details{
We recommend reading this documentation on \href{https://pkg.mitchelloharawild.com/distributional/reference/dist_dirichlet.html}{pkgdown} which renders math nicely.
\url{https://pkg.mitchelloharawild.com/distributional/reference/dist_dirichlet.html}

In the following, let \eqn{\mathbf{X} = (X_1, \ldots, X_k)} be a
Dirichlet random variable with concentration parameter
\code{alpha} = \eqn{\boldsymbol{\alpha} = (\alpha_1, \ldots, \alpha_k)},
where each \eqn{\alpha_i > 0}.

\strong{Support}: \eqn{\mathbf{x}} on the \eqn{(k-1)}-simplex,
i.e. \eqn{x_i \geq 0} and \eqn{\sum_{i=1}^k x_i = 1}.

\strong{Mean}: \eqn{E(X_i) = \frac{\alpha_i}{\alpha_0}} where
\eqn{\alpha_0 = \sum_{i=1}^k \alpha_i}.

\strong{Variance}:

\deqn{
    \mathrm{Var}(X_i) = \frac{\alpha_i(\alpha_0 - \alpha_i)}{\alpha_0^2(\alpha_0 + 1)}
  }{
    Var(X_i) = alpha_i * (alpha_0 - alpha_i) / (alpha_0^2 * (alpha_0 + 1))
  }

\strong{Covariance}:

\deqn{
    \mathrm{Cov}(X_i, X_j) = \frac{-\alpha_i \alpha_j}{\alpha_0^2(\alpha_0 + 1)}, \quad i \neq j
  }{
    Cov(X_i, X_j) = -alpha_i * alpha_j / (alpha_0^2 * (alpha_0 + 1)), i != j
  }

\strong{Probability density function (p.d.f)}:

\deqn{
    f(\mathbf{x}) = \frac{1}{B(\boldsymbol{\alpha})}
    \prod_{i=1}^k x_i^{\alpha_i - 1}
  }{
    f(x) = 1 / B(alpha) * prod(x_i^(alpha_i - 1))
  }

where \eqn{B(\boldsymbol{\alpha}) = \frac{\prod_{i=1}^k \Gamma(\alpha_i)}{\Gamma(\alpha_0)}}
is the multivariate Beta function.
}
\examples{
dist <- dist_dirichlet(alpha = list(c(2, 5, 3)))
dist

\dontshow{if (requireNamespace("LaplacesDemon", quietly = TRUE)) withAutoprint(\{ # examplesIf}
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)
\dontshow{\}) # examplesIf}
}
\seealso{
\code{\link[LaplacesDemon:dist.Dirichlet]{LaplacesDemon::ddirichlet()}}, \code{\link[LaplacesDemon:dist.Dirichlet]{LaplacesDemon::rdirichlet()}}
}
