## Types in MathNet.Numerics.Distributions

Type Multinomial

Namespace MathNet.Numerics.Distributions

Interfaces IDistribution

The distribution is parameterized by a vector of ratios: in other words, the parameter does not have to be normalized and sum to 1. The reason is that some vectors can't be exactly normalized to sum to 1 in floating point representation.

### Public Constructors

#### Multinomial(Double[] p, int n)

Initializes a new instance of the Multinomial class.
##### Parameters
###### `Double[]` p

An array of nonnegative ratios: this array does not need to be normalized as this is often impossible using floating point arithmetic.

###### `int` n

The number of trials.

#### Multinomial(Double[] p, int n, Random randomSource)

Initializes a new instance of the Multinomial class.
##### Parameters
###### `Double[]` p

An array of nonnegative ratios: this array does not need to be normalized as this is often impossible using floating point arithmetic.

###### `int` n

The number of trials.

###### `Random` randomSource

The random number generator which is used to draw random samples.

#### Multinomial(Histogram h, int n)

Initializes a new instance of the Multinomial class from histogram h. The distribution will not be automatically updated when the histogram changes.
##### Parameters
###### `Histogram` h

Histogram instance

###### `int` n

The number of trials.

### Public Static Functions

#### boolIsValidParameterSet(IEnumerable<double> p, int n)

Tests whether the provided values are valid parameters for this distribution.
##### Parameters
###### `IEnumerable<double>` p

An array of nonnegative ratios: this array does not need to be normalized as this is often impossible using floating point arithmetic.

###### `int` n

The number of trials.

##### Return
###### `bool`

If any of the probabilities are negative returns `false` , if the sum of parameters is 0.0, or if the number of trials is negative; otherwise `true`.

#### Int32[]Sample(Random rnd, Double[] p, int n)

Samples one multinomial distributed random variable.
##### Parameters
###### `Random` rnd

The random number generator to use.

###### `Double[]` p

An array of nonnegative ratios: this array does not need to be normalized as this is often impossible using floating point arithmetic.

###### `int` n

The number of trials.

##### Return
###### `Int32[]`

the counts for each of the different possible values.

#### IEnumerable<Int32[]>Samples(Random rnd, Double[] p, int n)

Samples a multinomially distributed random variable.
##### Parameters
###### `Random` rnd

The random number generator to use.

###### `Double[]` p

An array of nonnegative ratios: this array does not need to be normalized as this is often impossible using floating point arithmetic.

###### `int` n

The number of variables needed.

##### Return
###### `IEnumerable<Int32[]>`

a sequence of counts for each of the different possible values.

### Public Methods

#### doubleProbability(Int32[] x)

Computes values of the probability mass function.
##### Parameters
###### `Int32[]` x

Non-negative integers x1,..., xk

##### Return
###### `double`

The probability mass at location x.

#### doubleProbabilityLn(Int32[] x)

Computes values of the log probability mass function.
##### Parameters
###### `Int32[]` x

Non-negative integers x1,..., xk

##### Return
###### `double`

The log probability mass at location x.

#### Int32[]Sample()

Samples one multinomial distributed random variable.
##### Return
###### `Int32[]`

the counts for each of the different possible values.

#### IEnumerable<Int32[]>Samples()

Samples a sequence multinomially distributed random variables.
##### Return
###### `IEnumerable<Int32[]>`

a sequence of counts for each of the different possible values.

#### stringToString()

A string representation of the distribution.
##### Return
###### `string`

a string representation of the distribution.

### Public Properties

#### Vector<T>Mean get;

Gets the mean of the distribution.

#### intN get;

Gets the number of trials.

#### Double[]P get;

Gets the proportion of ratios.

#### RandomRandomSource get; set;

Gets or sets the random number generator which is used to draw random samples.

#### Vector<T>Skewness get;

Gets the skewness of the distribution.

#### Vector<T>Variance get;

Gets the variance of the distribution.