<< distfun_mnrnd Multinomial Multivariate Normal >>

Distfun >> Distfun > Multinomial > distfun_mnstat

distfun_mnstat

Multinomial mean and covariance

Calling Sequence

M = distfun_mnstat(n,P)
[M,C] = distfun_mnstat(n,P)

Parameters

n :

a 1-by-1 matrix of doubles, integer value, positive, the number of trials

P :

a 1-by-k matrix of doubles, positive, sum to 1, the probability of the k categories

M :

a 1-by-1 matrix of doubles, the mean

C :

a k-by-k matrix of doubles, the variance-covariance matrix

Description

Computes statistics from the multinomial distribution. On input, we assume that sum(P)==1.

The Mean and Covariance matrix of the Multinomial Distribution is:

Examples

n = 10
P = [0.3 0.4 0.3]
[M,C] = distfun_mnstat(n,P)
Mexpected = [3 4 3]
Cexpected = [
2.1  -1.2  -0.9
-1.2   2.4  -1.2
-0.9  -1.2   2.1
]

Authors

Bibliography

Wikipedia, Multinomial distribution function, http://en.wikipedia.org/wiki/Multinomial_distribution


Report an issue
<< distfun_mnrnd Multinomial Multivariate Normal >>