Jump to: navigation, search

The DrawMultinomial function draws independent samples from a multinomial distribution.


Result = DrawMultinomial(NrOfSamples; Probabilities; PivotDim1= -1 ; PivotDim2= -1 )

Return Value

Number of successes corresponding to the position of probabilities



If you throw an honest dice then the probabilities of getting a certain number is 1/6. So the multinomial probabilities are for P(X=1)=1/6, P(X=2)=1/6, P(X=3)=1/6, �P(X=4)=1/6, P(X=5)=1/6 and P(X=6)=1/6. Suppose we want to draw once with 6 dices (= equal to drawing 6 times with one dice) than the outcome could be simulated with the statement

Success=DrawMultinomial(6; redim(1/6; 6)) with the result

1 0 2 1 0 2

(of course this results depents on the seeds and the number of times the function random() has been called.

Suppose the values on the dice are 1, 2, 3, 4, 5 and 6 than this outcome means 1 times 1, 2 times 3, 1 times 4, 2 times 6. The real series can be generated by

Select(Success; 1#6)

1 3 3 4 6 6

Suppose we want to draw 10 times with 6 dices than this could be done by the statement

Success=DrawMultinomial(redim(6; 10,1); redim(1/6; 6)) which results in a matrix of 10 x 6

As you can see the sum(Success; PivotDim1) is equal to the NrOfSamples.


The sum(Probabilities; PivotDim2) may be less than one, the sum(Success; PivotDim1) can than be less than NrOfSamples. The �missing numbers� are than assigned to the missing probabilities. This can be handy. For Instance if we are interested in the successes in a binomial (multinomial distribution with two probabilities only) only. Say we toss a coin 100 time and want to know the number of �heads� than

Success = DrawMultinomial(100; 0.5) could result in 47.

[[category:NSM functions]]