# Dirichlet marginals - why does Mathematica not give the *Kth* marginal?

Observe:

MarginalDistribution[DirichletDistribution[{a, b, c, d}], #] & /@ Range@4


{BetaDistribution[a, b + c + d], BetaDistribution[b, a + c + d],
BetaDistribution[c, a + b + d],
MarginalDistribution[DirichletDistribution[{a, b, c, d}], 4]}

The marginal of d is clearly BetaDistribution[d, a + b + c], unless I'm having a brain spasm. Why does Mathematica not output this?

• I don't know. Might it have to do with the fact that the DirichletDistribution has k+1 shape parameters but only k dimensions? – Sjoerd C. de Vries Jul 10 '15 at 9:57
• As a follow up to the previous comment: With four arguments, the PDF of a DirichletDistribution is a three dimensional function, so it can have only three marginals. – Sjoerd C. de Vries Jul 10 '15 at 10:46
• @SjoerdC.deVries: Well, unless I'm misinterpreting what you're getting at, that's just plain wrong w/r to number of marginals: any of the concentrations can be marginalized out, giving* four* possible simple marginal distributions, and of course any combination of concentrations can be marginalized. I guess it comes down to how MMA defines the arguments of the MarginalDistribution function, which I find unsatisfying in this case: I have to manually create the MD for the Kth paramter. – ciao Jul 10 '15 at 22:28
• I'm decidedly not an expert in this area, but reading MMA's documentation and other sources like Wikipedia it really looks like that the number of independent dimensions is one less than the number of alphas. Do you at least agree that the number of marginals should be equal to the number of dimensions of the PDF? – Sjoerd C. de Vries Jul 11 '15 at 21:21
• I saw that definition but it did not help me as it describes a single marginal and does not tell how many there are. Also, the PDF on the same page clearly has k-1 random variables. Given that the marginal of a PDF is usually defined in terms of integrating away the other variables it is then understandable that there are only k-1 in mma. HOWEVER, given the k dimensional embedding, and the fact that the dependency of the kth variable on all the others holds for any of the others I fully agree with you that there should be four marginals in this case. The Dirichlet distribution is weird... – Sjoerd C. de Vries Jul 12 '15 at 7:56

It is a matter of definition, of course. Mathematica defines DirichletDistribution[{a1, a2, a3, a4}] to be a 3D distribution, compatible with 3D Lebesgue measure.

The definition you have in mind is

DirichletDistribution2[avec_List] :=
Block[{x, n = Length[avec] - 1},
TransformedDistribution[Append[Array[x, n], 1 - Total[Array[x, n]]],
Distributed[Array[x, n], DirichletDistribution[avec]]]]


That is

In[249]:= DirichletDistribution2[{a, b, c, d}]

Out[249]= TransformedDistribution[{x1, x2, x3, 1 - x1 - x2 - x3},
{x1, x2, 3} ~Distributed~ DirichletDistribution[{a, b, c, d}]]


The marginal distribution then works as you would expect, however the transformed distribution does not recognize the 4-th marginal as a beta distribution out of the box:

In[242]:= Table[
MarginalDistribution[DirichletDistribution2[{a, b, c, d}], k], {k, 4}]

Out[242]= {BetaDistribution[a, b + c + d],
BetaDistribution[b, a + c + d], BetaDistribution[c, a + b + d],
TransformedDistribution[
1 - x1 - x2 - x3, {x1, x2, x3} ~Distributed~
DirichletDistribution[{a, b, c, d}]]}


This can be determined by a method of moments, for example:

In[257]:=
m4moments =
Table[Moment[
TransformedDistribution[
1 - x1 - x2 - x3, {x1, x2, x3} \[Distributed]
DirichletDistribution[{a, b, c, d}]], r], {r, 4}];

In[258]:=
betamoments = Table[Moment[BetaDistribution[alpha, beta], r], {r, 4}];

In[259]:= Solve[
FunctionExpand[m4moments] == FunctionExpand[betamoments], {alpha,
beta}]

Out[259]= {{alpha -> d, beta -> a + b + c}}

• That's a nice post, +1 – ciao Jul 13 '15 at 22:47

As was noted by Sjoerd C. de Vries in the comments, DirichletDistribution[{a, b, c, d}] is a three-dimensional distribution:

DistributionDomain@DirichletDistribution[{a, b, c, d}]

(* {Interval[{0, 1}], Interval[{0, 1}], Interval[{0, 1}]} *)


and therefore asking for the fourth marginal isn't defined.

• Hi Stefan, could you please comment on the above comments? – Sjoerd C. de Vries Jul 12 '15 at 8:54