Dirichlet {MiSPU} | R Documentation |
The Dirichlet Distribution
Description
Density function and random number generation for the Dirichlet distribution
Usage
rdirichlet(n, alpha)
Arguments
n |
number of random observations to draw |
alpha |
the Dirichlet distribution's parameters. Can be a vector (one set of parameters for all observations) or a matrix (a different set of parameters for each observation), see “Details” |
Details
The Dirichlet distribution is a multidimensional generalization of the Beta distribution where each dimension is governed by an \alpha
-parameter.
Formally this is
%
\mathcal{D}(\alpha_i)=\left[\left.\Gamma(\sum_{i}\alpha_i)\right/\prod_i\Gamma(\alpha_i)\right]\prod_{i}y_i^{\alpha_i-1}%
Usually, alpha
is a vector thus the same parameters will be used for all observations.
If alpha
is a matrix, a complete set of \alpha
-parameters must be supplied for each observation.
Value
returns a matrix with random numbers according to the supplied alpha vector or matrix.
Author(s)
Chong Wu
Examples
X1 <- rdirichlet(100, c(5, 5, 10))
X1