Implements the abstract class DiscreteDistributionIntMulti for the multinomial distribution with parameters \(n\) and ( \(p_1\), …, \(p_d\)). More...
Public Member Functions | |
| MultinomialDist (int n, double p[]) | |
| Creates a MultinomialDist object with parameters \(n\) and ( \(p_1\),…, \(p_d\)) such that \(\sum_{i=1}^d p_i = 1\). | |
| double | prob (int x[]) |
| Returns the probability mass function \(p(x_1, x_2, …, x_d)\), which should be a real number in \([0,1]\). | |
| double | cdf (int x[]) |
| Computes the cumulative probability function \(F\) of the distribution evaluated at x, assuming the lowest values start at 0, i.e. | |
| double[] | getMean () |
| Returns the mean vector of the distribution, defined as \(\mu_i = E[X_i]\). | |
| double[][] | getCovariance () |
| Returns the variance-covariance matrix of the distribution, defined as \(\sigma_{ij} = E[(X_i - \mu_i)(X_j - \mu_j)]\). | |
| double[][] | getCorrelation () |
| Returns the correlation matrix of the distribution, defined as. | |
| int | getN () |
| Returns the parameter \(n\) of this object. | |
| double[] | getP () |
| Returns the parameters ( \(p_1\),…, \(p_d\)) of this object. | |
| void | setParams (int n, double p[]) |
| Sets the parameters \(n\) and ( \(p_1\),…, \(p_d\)) of this object. | |
| Public Member Functions inherited from umontreal.ssj.probdistmulti.DiscreteDistributionIntMulti | |
| int | getDimension () |
| Returns the dimension \(d\) of the distribution. | |
Static Public Member Functions | |
| static double | prob (int n, double p[], int x[]) |
Computes the probability mass function ( fMultinomial ) of the multinomial distribution with parameters \(n\) and ( \(p_1\),…, \(p_d\)) evaluated at \(x\). | |
| static double | cdf (int n, double p[], int x[]) |
| Computes the function \(F\) of the multinomial distribution with parameters \(n\) and ( \(p_1\),…, \(p_d\)) evaluated at \(x\). | |
| static double[] | getMean (int n, double[] p) |
| Computes the mean \(E[X_i] = np_i\) of the multinomial distribution with parameters \(n\) and ( \(p_1\),…, \(p_d\)). | |
| static double[][] | getCovariance (int n, double[] p) |
| Computes the covariance matrix of the multinomial distribution with parameters \(n\) and ( \(p_1\),…, \(p_d\)). | |
| static double[][] | getCorrelation (int n, double[] p) |
| Computes the correlation matrix of the multinomial distribution with parameters \(n\) and ( \(p_1\),…, \(p_d\)). | |
| static double[] | getMLE (int x[][], int m, int d, int n) |
| Estimates and returns the parameters [ \(\hat{p_i}\),…, \(\hat{p_d}\)] of the multinomial distribution using the maximum likelihood method. | |
Implements the abstract class DiscreteDistributionIntMulti for the multinomial distribution with parameters \(n\) and ( \(p_1\), …, \(p_d\)).
The probability mass function is [93]
\[ P[X = (x_1,…,x_d)] = {n!} \prod_{i=1}^d\frac{p_i^{x_i}}{x_i!}, \tag{fMultinomial} \]
where \(\sum_{i=1}^d x_i = n\) and \(\sum_{i=1}^d p_i = 1\).
Definition at line 43 of file MultinomialDist.java.
| umontreal.ssj.probdistmulti.MultinomialDist.MultinomialDist | ( | int | n, |
| double | p[] ) |
Creates a MultinomialDist object with parameters \(n\) and ( \(p_1\),…, \(p_d\)) such that \(\sum_{i=1}^d p_i = 1\).
We have \(p_i = \) p[i-1].
Definition at line 52 of file MultinomialDist.java.
|
static |
Computes the function \(F\) of the multinomial distribution with parameters \(n\) and ( \(p_1\),…, \(p_d\)) evaluated at \(x\).
Definition at line 160 of file MultinomialDist.java.
| double umontreal.ssj.probdistmulti.MultinomialDist.cdf | ( | int | x[] | ) |
Computes the cumulative probability function \(F\) of the distribution evaluated at x, assuming the lowest values start at 0, i.e.
computes
\[ F (x_1, x_2, …, x_d) = \sum_{s_1=0}^{x_1} \sum_{s_2=0}^{x_2} \cdots\sum_{s_d=0}^{x_d} p(s_1, s_2, …, s_d). \]
Uses the naive implementation, is very inefficient and may underflows.
Reimplemented from umontreal.ssj.probdistmulti.DiscreteDistributionIntMulti.
Definition at line 60 of file MultinomialDist.java.
| double[][] umontreal.ssj.probdistmulti.MultinomialDist.getCorrelation | ( | ) |
Returns the correlation matrix of the distribution, defined as.
\(\rho_{ij} = \sigma_{ij}/\sqrt{\sigma_{ii}\sigma_{jj}}\).
Reimplemented from umontreal.ssj.probdistmulti.DiscreteDistributionIntMulti.
Definition at line 72 of file MultinomialDist.java.
|
static |
Computes the correlation matrix of the multinomial distribution with parameters \(n\) and ( \(p_1\),…, \(p_d\)).
Definition at line 220 of file MultinomialDist.java.
| double[][] umontreal.ssj.probdistmulti.MultinomialDist.getCovariance | ( | ) |
Returns the variance-covariance matrix of the distribution, defined as
\(\sigma_{ij} = E[(X_i - \mu_i)(X_j - \mu_j)]\).
Reimplemented from umontreal.ssj.probdistmulti.DiscreteDistributionIntMulti.
Definition at line 68 of file MultinomialDist.java.
|
static |
Computes the covariance matrix of the multinomial distribution with parameters \(n\) and ( \(p_1\),…, \(p_d\)).
Definition at line 200 of file MultinomialDist.java.
| double[] umontreal.ssj.probdistmulti.MultinomialDist.getMean | ( | ) |
Returns the mean vector of the distribution, defined as \(\mu_i = E[X_i]\).
Reimplemented from umontreal.ssj.probdistmulti.DiscreteDistributionIntMulti.
Definition at line 64 of file MultinomialDist.java.
|
static |
Computes the mean \(E[X_i] = np_i\) of the multinomial distribution with parameters \(n\) and ( \(p_1\),…, \(p_d\)).
Definition at line 178 of file MultinomialDist.java.
|
static |
Estimates and returns the parameters [ \(\hat{p_i}\),…, \(\hat{p_d}\)] of the multinomial distribution using the maximum likelihood method.
It uses the \(m\) observations of \(d\) components in table \(x[i][j]\), \(i = 0, 1, …, m-1\) and \(j = 0, 1, …, d-1\). The equations of the maximum likelihood are defined as
\begin{align*} \hat{p}_i = \frac{\bar{X_i}}{N}. \end{align*}
| x | the list of observations used to evaluate parameters |
| m | the number of observations used to evaluate parameters |
| d | the dimension of each observation |
| n | the number of independant trials for each series |
Definition at line 240 of file MultinomialDist.java.
| int umontreal.ssj.probdistmulti.MultinomialDist.getN | ( | ) |
Returns the parameter \(n\) of this object.
Definition at line 273 of file MultinomialDist.java.
| double[] umontreal.ssj.probdistmulti.MultinomialDist.getP | ( | ) |
Returns the parameters ( \(p_1\),…, \(p_d\)) of this object.
Definition at line 280 of file MultinomialDist.java.
|
static |
Computes the probability mass function ( fMultinomial ) of the multinomial distribution with parameters \(n\) and ( \(p_1\),…, \(p_d\)) evaluated at \(x\).
Definition at line 118 of file MultinomialDist.java.
| double umontreal.ssj.probdistmulti.MultinomialDist.prob | ( | int | x[] | ) |
Returns the probability mass function \(p(x_1, x_2, …, x_d)\), which should be a real number in \([0,1]\).
| x | value at which the mass function must be evaluated |
Reimplemented from umontreal.ssj.probdistmulti.DiscreteDistributionIntMulti.
Definition at line 56 of file MultinomialDist.java.
| void umontreal.ssj.probdistmulti.MultinomialDist.setParams | ( | int | n, |
| double | p[] ) |
Sets the parameters \(n\) and ( \(p_1\),…, \(p_d\)) of this object.
Definition at line 287 of file MultinomialDist.java.