SSJ
3.3.1
Stochastic Simulation in Java
|
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\). More... | |
double | prob (int x[]) |
double | cdf (int x[]) |
double [] | getMean () |
double [][] | getCovariance () |
double [][] | getCorrelation () |
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 DiscreteDistributionIntMulti | |
abstract 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]\). More... | |
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. More... | |
int | getDimension () |
Returns the dimension \(d\) of the distribution. | |
abstract double [] | getMean () |
Returns the mean vector of the distribution, defined as \(\mu_i = E[X_i]\). | |
abstract double [][] | getCovariance () |
Returns the variance-covariance matrix of the distribution, defined as \(\sigma_{ij} = E[(X_i - \mu_i)(X_j - \mu_j)]\). | |
abstract double [][] | getCorrelation () |
Returns the correlation matrix of the distribution, defined as \(\rho_{ij} = \sigma_{ij}/\sqrt{\sigma_{ii}\sigma_{jj}}\). | |
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. More... | |
Protected Attributes | |
int | n |
double | p [] |
Protected Attributes inherited from DiscreteDistributionIntMulti | |
int | dimension |
Implements the abstract class DiscreteDistributionIntMulti for the multinomial distribution with parameters \(n\) and ( \(p_1\), …, \(p_d\)).
The probability mass function is [97]
\[ 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\).
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]
.
|
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 |