Simplex Distributions
The simplex probabilities have support on the unit
Dirichlet distribution
Probability density function
If
Warning: If any of the components of
Meaning of Dirichlet parameters
A symmetric Dirichlet prior is
data {
int<lower=1> K;
real<lower=0> alpha;
}generated quantities {
vector[K] theta = dirichlet_rng(rep_vector(alpha, K));
}
Taking
1) 0.17 0.05 0.07 0.17 0.03 0.13 0.03 0.03 0.27 0.05
2) 0.08 0.02 0.12 0.07 0.52 0.01 0.07 0.04 0.01 0.06
3) 0.02 0.03 0.22 0.29 0.17 0.10 0.09 0.00 0.05 0.03
4) 0.04 0.03 0.21 0.13 0.04 0.01 0.10 0.04 0.22 0.18
5) 0.11 0.22 0.02 0.01 0.06 0.18 0.33 0.04 0.01 0.01
That does not mean it’s uniform over the marginal probabilities of each element. As the size of the simplex grows, the marginal draws become more and more concentrated below (not around)
When the
1) 3e-203 0e+00 2e-298 9e-106 1e+000 0e+00 0e+000 1e-047 0e+00 4e-279
2) 1e+000 0e+00 5e-279 2e-014 1e-275 0e+00 3e-285 9e-147 0e+00 0e+000
3) 1e-308 0e+00 1e-213 0e+000 0e+000 8e-75 0e+000 1e+000 4e-58 7e-112
4) 6e-166 5e-65 3e-068 3e-147 0e+000 1e+00 3e-249 0e+000 0e+00 0e+000
5) 2e-091 0e+00 0e+000 0e+000 1e-060 0e+00 4e-312 1e+000 0e+00 0e+000
Each row denotes a draw. Each draw has a single value that rounds to one and other values that are very close to zero or rounded down to zero.
As
1) 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10
2) 0.10 0.10 0.09 0.10 0.10 0.10 0.11 0.10 0.10 0.10
3) 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10
4) 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10
5) 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10 0.10
Distribution statement
theta ~
dirichlet
(alpha)
Increment target log probability density with dirichlet_lupdf(theta | alpha)
.
Stan functions
The Dirichlet probability functions are overloaded to allow the simplex
real
dirichlet_lpdf
(vectors theta | vectors alpha)
The log of the Dirichlet density for simplex(es) theta
given prior counts (plus one) alpha
real
dirichlet_lupdf
(vectors theta | vectors alpha)
The log of the Dirichlet density for simplex(es) theta
given prior counts (plus one) alpha
dropping constant additive terms
vector
dirichlet_rng
(vector alpha)
Generate a Dirichlet variate with prior counts (plus one) alpha
; may only be used in transformed data and generated quantities blocks