### Function Reference: `mnpdf`

statistics: y = mnpdf (x, pk)

Multinomial probability density function (PDF).

### Arguments

- x is vector with a single sample of a multinomial distribution with parameter pk or a matrix of random samples from multinomial distributions. In the latter case, each row of x is a sample from a multinomial distribution with the corresponding row of pk being its parameter.
- pk is a vector with the probabilities of the categories or a matrix with each row containing the probabilities of a multinomial sample.

### Return values

- y is a vector of probabilites of the random samples x from the multinomial distribution with corresponding parameter pk. The parameter n of the multinomial distribution is the sum of the elements of each row of x. The length of y is the number of columns of x. If a row of pk does not sum to `1`, then the corresponding element of y will be `NaN`.

### Examples

     x = [1, 4, 2];
     pk = [0.2, 0.5, 0.3];
     y = mnpdf (x, pk);
     x = [1, 4, 2; 1, 0, 9];
     pk = [0.2, 0.5, 0.3; 0.1, 0.1, 0.8];
     y = mnpdf (x, pk);

### References

1. Wendy L. Martinez and Angel R. Martinez. Computational Statistics Handbook with MATLAB. Appendix E, pages 547-557, Chapman & Hall/CRC, 2001.
2. Merran Evans, Nicholas Hastings and Brian Peacock. Statistical Distributions. pages 134-136, Wiley, New York, third edition, 2000.

See also: mnrnd

Source Code: mnpdf