Under the name of mmcdara (unfortunately inaccessible since the major July 2025 Mapleprimes outage, and probably lost forever, God rest his soul.) I published two years ago a post about Multivariate Normal Distribution.

The current post continues in the same vein and presents the construction of a few new Multivariate Random Variables (MRV for short) named Multinomial (see for instance this recent question), Dirichlet, Categorical and related compound distributions.
I advice the interested readers to give a quick look to these names on Wikipedia).

As I explained (in fact it was my alter ego who did it) in Multivariate Normal Distribution, the Statistics package is limited to univariate random variable  and thus implementing some requires a little cunning.
A very simple example will help you understand where problems lie:

Whereas the expectation (sometimes named "mean") of a univariate random variable is a number or an expression, the expectation of a Multivariate Random Variable is a vector (or a list, a n-uple, ...) of numbers or expressions.
So far, so good, except that the Mean attribute of Distribution only accepts scalar quantities. So if you want to assign a vector to Mean you have to code it some way and do something like Decode(Mean(My_MRV)) to get the expectation in a vector form.

 

The Variance case is even more tricky because the variance of a MRV is no longer a scalar quantity but a matrix.
Beyond this some very useful attributes like ParentName and Parameters cannot be instanciated in the definition of MRVs, implying here again some bit of gymnastics to, if not instantiate these attributes, at least be able to retrieve them when needed.
Finally, last but not least, the RandomSample is not appropriated to sample MRVs.

The file attached to this post contains more than 20 procedures enabling the definition of the studied MRVs, the decoding of the coded attributes, the visualization (which is not that immediate because the supports of the MRVs I foccus on are simplexes), the parameter estimations against empirical observations (frequentist and bayesian points of view), and so on.

Nevertheless, there is still a lot missing, but at some point I believe we need to decide that the work is over*


Multinomial_Dirichlet_and_so_on.mw

* difficult to part with your baby though, not sure I won't add a few little things I have up my sleeve.


Please Wait...