Main Content

MultinomialDistribution

Multinomial probability distribution object

Description

AMultinomialDistributionobject 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” innindependent trials of a two-outcome process, the multinomial distribution gives the probability of each combination of outcomes innindependent trials of ak-outcome process. The probability of each outcome in any one trial is given by the fixed probabilitiesp1, ...,pk.

The multinomial distribution uses the following parameters.

Parameter Description 金宝app
probabilities Outcome probabilities 0 probabilities ( i ) 1 ; all ( i ) probabilities ( i ) = 1

Creation

Create aMultinomialDistributionprobability distribution with specified parameter values object usingmakedist.

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 inprobabilitiesmust sum to 1.

Data Types:single|double

Distribution Characteristics

This property is read-only.

Logical flag for truncated distribution, specified as a logical value. IfIsTruncatedequals0, the distribution is not truncated. IfIsTruncatedequals1, 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.

Data Types:single|double

This property is read-only.

Truncation interval for the probability distribution, specified as a vector 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

cdf Cumulative distribution function
icdf Inverse cumulative distribution function
iqr Interquartile range
mean Mean of probability distribution
median Median of probability distribution
pdf Probability density function
random Random numbers
std Standard deviation of probability distribution
truncate Truncate probability distribution object
var Variance 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

创建一个多项分布对象说tribution 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 reproducibilityr = 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 reproducibilityr = random(pd,10,1)
r =10×12 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 reproducibilityr = random(pd,10,5)
r =10×52 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.

Introduced in R2013a