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):
-
Each row → one experiment of
ntrials -
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 * pvalsas number of experiments increases
🧠Summary Table
| Function | Parameters | Description |
|---|---|---|
np.random.multinomial() |
n, pvals, size | Generates counts per category in multinomial experiments |
n |
Number of trials | Total trials per experiment |
pvals |
List of probabilities | Must sum to 1 |
size |
Number of experiments | Rows in the output array |
🎯 Practice Exercises
-
Roll a 6-sided dice 10 times, repeat 1000 experiments, and plot average counts.
-
Simulate drawing balls from a bag with 3 colors (probabilities
[0.1,0.3,0.6]) for 20 draws and 5 experiments. -
Verify that the sum of counts per row always equals
n.
