362ae1c3创建于 2022年6月24日历史提交

Multinomial distribution

A multinomial random variable.

Notes

The probability mass function for multinomial is:

.. math::

f(x)=\frac{n!}{x_1!\dots x_k!} p_1^{x_1} \dots  p_k^{x_k}

where :math:n should be a positive integer, each element of :math:p should be in the interval :math:[0, 1] and the elements should sum to 1, and each :math:x_i is a nonnegative integer and their sum is each :math:n.

Examples

::

let x = vector([1, 3, 4])
let p = vector([0.3, 0.2, 0.5])
multinomialLogPMF(x, 8, p)