dirichlet-distribution | R Documentation |
Density and random generation for the Dirichlet distribution.
ddirichlet(probabilities, nu, logscale = FALSE)
rdirichlet(n, nu)
probabilities |
A vector representing a discrete probability distribution, or a matrix where each row is a discrete probability distribution. Zero probabilities are not allowed. |
nu |
The parameters of the Dirichlet distribution. This can be a
vector of positive numbers, interpretable as prior counts, of length
matching the dimension of probabilities. If |
logscale |
Logical. If TRUE then return the density on the log scale. Otherwise return the density on the raw scale. |
n |
The number of desired draws. |
The Dirichlet distribution is a generalization of the beta distribution. Whereas beta distribution is a model for probabilities, the Dirichlet distribution is a model for discrete distributions with several possible outcome values.
Let \pi
denote a discrete probability distribution (a vector
of positive numbers summing to 1), and let \nu
be a vector
of positive numbers (the parameters of the Dirichlet distribution),
which can be thought of as prior counts. Then the density of the
Dirichlet distribution can be written
f(\pi) = \frac{\Gamma(\sum_i\nu_i)}{\prod_i \Gamma(\nu_i)}
\prod_i \pi_i^{\nu_i-1}.
ddirichlet
returns a vector of density values, with one
entry per row in probabilities
. rdirichlet
returns a
matrix (if n > 1
) or a vector (if n==1
) containing the
draws from the Dirichlet distribution with the specified parameters.
Steven L. Scott steve.the.bayesian@gmail.com
Gelman, Carlin, Stern, Rubin (2003), "Bayesian Data Analysis", Chapman and Hall.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.