SSJ
V. labo.

umontreal.iro.lecuyer.probdistmulti
Class MultinomialDist

java.lang.Object
  extended by umontreal.iro.lecuyer.probdistmulti.DiscreteDistributionIntMulti
      extended by umontreal.iro.lecuyer.probdistmulti.MultinomialDist

public class MultinomialDist
extends DiscreteDistributionIntMulti

MultinomialDist

Implements the abstract class DiscreteDistributionIntMulti for the multinomial distribution with parameters n and (p1, ...,pd). The probability mass function is[#!tJOH69a!#]

P[X = (x1,..., xd)] = n!$\displaystyle \htprod_{{i=1}}^{{d}}$pixi/xi!,

where $ \htsum_{{i=1}}^{{d}}$xi = n and [tex2html_wrap_inline238]pi = 1.


Constructor Summary
MultinomialDist(int n, double[] p)
          .
 
Method Summary
 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.
static double cdf(int n, double[] p, int[] x)
          .
 double[][] getCorrelation()
          Returns the correlation matrix of the distribution, defined as ρij = σij/(σ_iiσ_jj)1/2.
static double[][] getCorrelation(int n, double[] p)
          .
 double[][] getCovariance()
          Returns the variance-covariance matrix of the distribution, defined as
σij = E[(Xi - μi)(Xj - μj)].
static double[][] getCovariance(int n, double[] p)
          .
 double[] getMean()
          Returns the mean vector of the distribution, defined as μi = E[Xi].
static double[] getMean(int n, double[] p)
          .
static double[] getMLE(int[][] x, int m, int d, int n)
          .
 int getN()
          .
 double[] getP()
          .
 double prob(int[] x)
          Returns the probability mass function p(x1, x2,…, xd), which should be a real number in [0, 1].
static double prob(int n, double[] p, int[] x)
          .
 void setParams(int n, double[] p)
          .
 
Methods inherited from class umontreal.iro.lecuyer.probdistmulti.DiscreteDistributionIntMulti
getDimension
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultinomialDist

public MultinomialDist(int n,
                       double[] p)
. \begin{tabb}
 Creates a \texttt{MultinomialDist} object with parameters $n$\ and...
 ... that $\htsum_{i=1}^{d} p_i = 1$. We have
 $p_i = $\ \texttt{p[i-1]}.
 \end{tabb}

Method Detail

prob

public double prob(int[] x)
Description copied from class: DiscreteDistributionIntMulti
Returns the probability mass function p(x1, x2,…, xd), which should be a real number in [0, 1].

Specified by:
prob in class DiscreteDistributionIntMulti
Parameters:
x - value at which the mass function must be evaluated
Returns:
the mass function evaluated at x

cdf

public double cdf(int[] x)
Description copied from class: DiscreteDistributionIntMulti
Computes the cumulative probability function F of the distribution evaluated at x, assuming the lowest values start at 0, i.e. computes

F(x1, x2,…, xd) = ∑s1=0x1s2=0x2 ... sd=0xdp(s1, s2,…, sd).

Uses the naive implementation, is very inefficient and may underflows.

Overrides:
cdf in class DiscreteDistributionIntMulti

getMean

public double[] getMean()
Description copied from class: DiscreteDistributionIntMulti
Returns the mean vector of the distribution, defined as μi = E[Xi].

Specified by:
getMean in class DiscreteDistributionIntMulti

getCovariance

public double[][] getCovariance()
Description copied from class: DiscreteDistributionIntMulti
Returns the variance-covariance matrix of the distribution, defined as
σij = E[(Xi - μi)(Xj - μj)].

Specified by:
getCovariance in class DiscreteDistributionIntMulti

getCorrelation

public double[][] getCorrelation()
Description copied from class: DiscreteDistributionIntMulti
Returns the correlation matrix of the distribution, defined as ρij = σij/(σ_iiσ_jj)1/2.

Specified by:
getCorrelation in class DiscreteDistributionIntMulti

prob

public static double prob(int n,
                          double[] p,
                          int[] x)
. \begin{tabb}
 Computes the probability mass function
 of the multinomial distribution with parameters $n$\ and
 ($p_1$,\ldots,$p_d$) evaluated at $x$.
 \end{tabb}


cdf

public static double cdf(int n,
                         double[] p,
                         int[] x)
. \begin{tabb}
 Computes the function $F$\ of the multinomial distribution with
 parameters $n$\ and ($p_1$,\ldots,$p_d$) evaluated at $x$.
 \end{tabb}


getMean

public static double[] getMean(int n,
                               double[] p)
. \begin{tabb}
 Computes the mean $E[X_i] = np_i$\ of the multinomial distribution
 with parameters $n$\ and ($p_1$,\ldots,$p_d$).
 \end{tabb}


getCovariance

public static double[][] getCovariance(int n,
                                       double[] p)
. \begin{tabb}
 Computes the covariance matrix of the multinomial distribution
 with parameters $n$\ and ($p_1$,\ldots,$p_d$).
 \end{tabb}


getCorrelation

public static double[][] getCorrelation(int n,
                                        double[] p)
. \begin{tabb}
 Computes the correlation matrix of the multinomial distribution
 with parameters $n$\ and ($p_1$,\ldots,$p_d$).
 \end{tabb}


getMLE

public static double[] getMLE(int[][] x,
                              int m,
                              int d,
                              int n)
. \begin{tabb}
 Estimates and returns the parameters [$\hat{p_i}$,\ldots,$\hat{p_d...
 ...y*}
 \hat p_i = \frac{\bar{X_i}}{N}.
 \end{eqnarray*} \end{detailed}%
 \end{tabb}
xthe list of observations used to evaluate parameters mthe number of observations used to evaluate parameters dthe dimension of each observation nthe number of independant trials for each series returns the parameters [$ \hat{{p_i}}$,...,$ \hat{{p_d}}$]


getN

public int getN()
. \begin{tabb}
 Returns the parameter $n$\ of this object.
 \end{tabb}


getP

public double[] getP()
. \begin{tabb}
 Returns the parameters ($p_1$,\ldots,$p_d$) of this object.
 \end{tabb}


setParams

public void setParams(int n,
                      double[] p)
. \begin{tabb}
 Sets the parameters $n$\ and ($p_1$,\ldots,$p_d$) of this object.
 \end{tabb}


SSJ
V. labo.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.