Multinomial probability distribution object
MultinomialDistribution object consists of parameters and
a model description for a multinomial probability distribution.
The multinomial distribution is a generalization of the binomial distribution. While the binomial distribution gives the probability of the number of “successes” in n independent trials of a two-outcome process, the multinomial distribution gives the probability of each combination of outcomes in n independent trials of a k-outcome process. The probability of each outcome in any one trial is given by the fixed probabilities p1, ..., pk.
The multinomial distribution uses the following parameter.
MultinomialDistribution probability distribution with
specified parameter values object using
Probabilities— Outcome probabilities
Outcome probabilities for the multinomial distribution, stored as a
vector of scalar values in the range
Probabilities must sum to 1.
|Cumulative distribution function|
|Inverse cumulative distribution function|
|Mean of probability distribution|
|Median of probability distribution|
|Probability density function|
|Standard deviation of probability distribution|
|Truncate probability distribution object|
|Variance of probability distribution|
Create a multinomial distribution object using the default parameter values.
pd = makedist('Multinomial')
pd = MultinomialDistribution Probabilities: 0.5000 0.5000
Create a multinomial distribution object for a distribution with three possible outcomes. Outcome 1 has a probability of 1/2, outcome 2 has a probability of 1/3, and outcome 3 has a probability of 1/6.
pd = makedist('Multinomial','Probabilities',[1/2 1/3 1/6])
pd = MultinomialDistribution Probabilities: 0.5000 0.3333 0.1667
Generate a random outcome from the distribution.
rng('default'); % for reproducibility r = random(pd)
r = 2
The result of this trial is outcome 2. By default, the number of trials in each experiment, , equals 1.
Generate random outcomes from the distribution when the number of trials in each experiment, , equals 1, and the experiment is repeated ten times.
rng('default'); % for reproducibility r = random(pd,10,1)
r = 10×1 2 3 1 3 2 1 1 2 3 3
Each element in the array is the outcome of an individual experiment that contains one trial.
Generate random outcomes from the distribution when the number of trials in each experiment, , equals 5, and the experiment is repeated ten times.
rng('default'); % for reproducibility r = random(pd,10,5)
r = 10×5 2 1 2 2 1 3 3 1 1 1 1 3 3 1 2 3 1 3 1 2 2 2 2 1 1 1 1 2 2 1 1 1 2 2 1 2 3 1 1 2 3 2 2 3 2 3 3 1 1 2
Each element in the resulting matrix is the outcome of one trial. The columns correspond to the five trials in each experiment, and the rows correspond to the ten experiments. For example, in the first experiment (corresponding to the first row), 2 of the 5 trials resulted in outcome 1, and 3 of the 5 trials resulted in outcome 2.