Main Content

MultinomialDistribution

Multinomial probability distribution object

Description

A 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.

ParameterDescriptionSupport
ProbabilitiesOutcome probabilities0Probabilities(i)1;all(i)Probabilities(i)=1

Creation

Create a MultinomialDistribution probability distribution object with specified parameter values by using makedist.

Properties

expand all

Distribution Parameter

Outcome probabilities for the multinomial distribution, stored as a vector of scalar values in the range [0,1]. The values in Probabilities must sum to 1.

Data Types: single | double

Distribution Characteristics

This property is read-only.

Logical flag for truncated distribution, specified as a logical value. If IsTruncated equals 0, the distribution is not truncated. If IsTruncated equals 1, the distribution is truncated.

Data Types: logical

This property is read-only.

Number of parameters for the probability distribution, specified as a positive integer value.

Data Types: double

This property is read-only.

Distribution parameter values, specified as a vector of scalar values.

Data Types: single | double

This property is read-only.

Truncation interval for the probability distribution, specified as a vector of scalar values containing the lower and upper truncation boundaries.

Data Types: single | double

Other Object Properties

This property is read-only.

Probability distribution name, specified as a character vector.

Data Types: char

This property is read-only.

Distribution parameter descriptions, specified as a cell array of character vectors. Each cell contains a short description of one distribution parameter.

Data Types: char

This property is read-only.

Distribution parameter names, specified as a cell array of character vectors.

Data Types: char

Object Functions

cdfCumulative distribution function
icdfInverse cumulative distribution function
iqrInterquartile range of probability distribution
meanMean of probability distribution
medianMedian of probability distribution
pdfProbability density function
plotPlot probability distribution object
randomRandom numbers
stdStandard deviation of probability distribution
truncateTruncate probability distribution object
varVariance of probability distribution

Examples

collapse all

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, n, equals 1.

Generate random outcomes from the distribution when the number of trials in each experiment, n, 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, n, 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.

Version History

Introduced in R2013a