Multinomial Distribution

🎲 Multinomial Distribution in Python

The Multinomial Distribution generalizes the binomial distribution to more than two outcomes per trial.
It models the number of occurrences of each outcome in a fixed number of independent trials.


 1. Characteristics of Multinomial Distribution

  • n → number of trials

  • pvals → list of probabilities for each category (sum must = 1)

  • size → number of experiments / samples

  • Returns counts of outcomes for each category

Example Use Cases:

  • Rolling a dice multiple times

  • Drawing colored balls from a bag

  • Simulating categorical outcomes


 2. Generate Multinomial Data Using NumPy


 

Output (example):

[[2 3 5]
[1 3 6]
[3 2 5]
[0 4 6]
[2 2 6]]
  • Each row → one experiment of n trials

  • Each column → counts of a category

  • Sum of each row = n


 3. Visualize Multinomial Distribution

Example: 3 categories


 

  • Shows total occurrences per category across all experiments


 4. Change Probabilities or Trials

  • Probabilities and number of trials directly influence the counts

  • Sum of counts per row always = n


 5. Compare Multiple Experiments


 

  • Average counts approach n * pvals as number of experiments increases


🧠 Summary Table

FunctionParametersDescription
np.random.multinomial()n, pvals, sizeGenerates counts per category in multinomial experiments
nNumber of trialsTotal trials per experiment
pvalsList of probabilitiesMust sum to 1
sizeNumber of experimentsRows in the output array

🎯 Practice Exercises

  1. Roll a 6-sided dice 10 times, repeat 1000 experiments, and plot average counts.

  2. Simulate drawing balls from a bag with 3 colors (probabilities [0.1,0.3,0.6]) for 20 draws and 5 experiments.

  3. Verify that the sum of counts per row always equals n.

You may also like...