Documentation Center

  • Trial Software
  • Product Updates

prob.MultinomialDistribution class

Package: prob
Superclasses: prob.ParametricTruncatableDistribution

Multinomial probability distribution object

Description

prob.MultinomialDistribution is an object consisting of parameters and a model description for a multinomial probability distribution. Create a probability distribution object with specified parameters using makedist.

Construction

pd = makedist('Multinomial') creates a multinomial probability distribution object using the default parameter values.

pd = makedist('Multinomial','Probabilities',probabilities) creates a multinomial distribution object using the specified parameter value.

Input Arguments

expand all

probabilities — outcome probabilities[0.500 0.500] (default) | vector of scalar values in the range [0,1]

Outcome probabilities, specified as a vector of scalar values in the range [0,1]. Each vector element is the probability that a multinomial trial has a particular corresponding outcome. The values in probabilities must sum to 1.

Data Types: single | double

Properties

expand all

probabilities — outcome probabilitiesvector of scalar values in the range [0,1]

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

DistributionName — Probability distribution nameprobability distribution name string

Probability distribution name, stored as a valid probability distribution name string. This property is read-only.

Data Types: char

IsTruncated — Logical flag for truncated distribution0 | 1

Logical flag for truncated distribution, stored as a logical value. If IsTruncated equals 0, the distribution is not truncated. If IsTruncated equals 1, the distribution is truncated. This property is read-only.

Data Types: logical

NumParameters — Number of parameterspositive integer value

Number of parameters for the probability distribution, stored as a positive integer value. This property is read-only.

Data Types: single | double

ParameterDescription — Distribution parameter descriptionscell array of strings

Distribution parameter descriptions, stored as a cell array of strings. Each cell contains a short description of one distribution parameter. This property is read-only.

Data Types: char

ParameterNames — Distribution parameter namescell array of strings

Distribution parameter names, stored as a cell array of strings. This property is read-only.

Data Types: char

ParameterValues — Distribution parameter valuesvector of scalar values

Distribution parameter values, stored as a vector. This property is read-only.

Data Types: single | double

Truncation — Truncation intervalvector of scalar values

Truncation interval for the probability distribution, stored as a vector containing the lower and upper truncation boundaries. This property is read-only.

Data Types: single | double

Methods

Inherited Methods

cdf Cumulative distribution function of probability distribution object
icdfInverse cumulative distribution function of probability distribution object
iqrInterquartile range of probability distribution object
median Median of probability distribution object
pdfProbability density function of probability distribution object
randomGenerate random numbers from probability distribution object
truncateTruncate probability distribution object
meanMean of probability distribution object
std Standard deviation of probability distribution object
varVariance of probability distribution object

Definitions

Multinomial 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 parameters.

ParameterDescriptionSupport
probabilitiesOutcome probabilities

The probability density function (pdf) is

where x = (x1,...,xk) gives the number of each k outcome in n trials of a process with fixed probabilities p = (p1,...,pk) of individual outcomes in any one trial.

Examples

expand all

Create a Multinomial Distribution Object Using Default Parameters

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 Using Specified Parameters

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 =

     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 =

     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.

See Also

More About

Was this topic helpful?