# Bug (or missed opportunity) in MarginalDistribution?

Observe:

dist = MultivariateHypergeometricDistribution[k, Range@5];
Tr@Range@5
MarginalDistribution[dist, {1}]
MarginalDistribution[dist, {1, 2}]
First@%


15

TransformedDistribution[{[FormalX]},[FormalX][Distributed]HypergeometricDistribution[k,1,15]]

MarginalDistribution[MultivariateHypergeometricDistribution[k,{1,2,12}],{1,2}]

MultivariateHypergeometricDistribution[k,{1,2,12}]

Note that the single dimension marginal is correct (though a bit weird it's returned as a transformed distribution, vs just the Hypergeometric distribution).

Adding dimensions returns unevaluated. Yet, the contents within the head are correct.

I'd venture the optimizations made to this family of distributions in 10.x has something that slipped through the cracks.

Mathematica makes distinction between $X$ and $\{X\}$ by design:

dist = MultivariateHypergeometricDistribution[k, Range@5];
{MarginalDistribution[dist, {1}], MarginalDistribution[dist, 1]}


{ TransformedDistribution[{[FormalX]}, [FormalX] [Distributed] HypergeometricDistribution[k, 1, 15]], HypergeometricDistribution[k, 1, 15]}

this is needed for internal consistency.

The marginal $1,2$ retains head MarginalDistribution because it can not be expressed through any simpler distribution. The marginal is 2D distribution, while MultivariateHypergeometricDistribution[k, {1, 2, 12}] is 3D distribution.

• Are you commenting as either a Wolfram engineer that knows this as fact, or have an authoritative source to that effect ("...by design.")? Because in fact the contents are a simplified distribution, that can be used in any dimension <= the expression, e.g., d = First@ MarginalDistribution[ MultivariateHypergeometricDistribution[10, Range@5], {1, 2}]; Probability[x >= 1, {x} \[Distributed] d] does precisely what's intended (and what the changes in this family exhibit when probability queries involve less than the whole set of categories).
– ciao
Apr 11 '16 at 4:40