## Class MultinomialDistribution

• java.lang.Object
• dev.nm.stat.distribution.multivariate.MultinomialDistribution
• All Implemented Interfaces:
MultivariateProbabilityDistribution

public class MultinomialDistribution
extends Object
implements MultivariateProbabilityDistribution
Wikipedia: Multinomial distribution
• ### Constructor Summary

Constructors
Constructor Description
MultinomialDistribution​(int n, double... p)
Constructs an instance of a Multinomial distribution.
• ### Method Summary

All Methods
Modifier and Type Method Description
double cdf​(Vector x)
Gets the cumulative probability F(x) = Pr(X ≤ x).
Matrix covariance()
Gets the covariance matrix of this distribution.
double density​(Vector x)
The density function, which, if exists, is the derivative of F.
double entropy()
Gets the entropy of this distribution.
Vector mean()
Gets the mean of this distribution.
Vector mode()
Gets the mode of this distribution.
double moment​(Vector t)
The moment generating function is the expected value of etX.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### MultinomialDistribution

public MultinomialDistribution​(int n,
double... p)
Constructs an instance of a Multinomial distribution.
Parameters:
n - the number of trials
p - the event probabilities; the sum of them equals 1
• ### Method Detail

• #### density

public double density​(Vector x)
Description copied from interface: MultivariateProbabilityDistribution
The density function, which, if exists, is the derivative of F. It describes the density of probability at each point in the sample space.
f(x) = dF(X) / dx
This may not always exist.

For the discrete cases, this is the probability mass function. It gives the probability that a discrete random variable is exactly equal to some value.

Specified by:
density in interface MultivariateProbabilityDistribution
Parameters:
x - x
Returns:
f(x)
• #### cdf

public double cdf​(Vector x)
Description copied from interface: MultivariateProbabilityDistribution
Gets the cumulative probability F(x) = Pr(X ≤ x).
Specified by:
cdf in interface MultivariateProbabilityDistribution
Parameters:
x - x
Returns:
F(x) = Pr(X ≤ x)
• #### mean

public Vector mean()
Description copied from interface: MultivariateProbabilityDistribution
Gets the mean of this distribution.
Specified by:
mean in interface MultivariateProbabilityDistribution
Returns:
the mean
• #### mode

public Vector mode()
Description copied from interface: MultivariateProbabilityDistribution
Gets the mode of this distribution.
Specified by:
mode in interface MultivariateProbabilityDistribution
Returns:
the mean
• #### covariance

public Matrix covariance()
Description copied from interface: MultivariateProbabilityDistribution
Gets the covariance matrix of this distribution.
Specified by:
covariance in interface MultivariateProbabilityDistribution
Returns:
the covariance
• #### entropy

public double entropy()
Description copied from interface: MultivariateProbabilityDistribution
Gets the entropy of this distribution.
Specified by:
entropy in interface MultivariateProbabilityDistribution
Returns:
the entropy
Wikipedia: Entropy (information theory)
• #### moment

public double moment​(Vector t)
Description copied from interface: MultivariateProbabilityDistribution
The moment generating function is the expected value of etX. That is,
E(etX)
This may not always exist.
Specified by:
moment in interface MultivariateProbabilityDistribution
Parameters:
t - t
Returns:
E(exp(tX))