SSJ
3.3.1
Stochastic Simulation in Java
|
Implements the class DiscreteDistributionIntMulti for the negative multinomial distribution with parameters \(n > 0\) and ( \(p_1, …, p_d\)) such that all \(0<p_i<1\) and \(\sum_{i=1}^d p_i < 1\). More...
Public Member Functions | |
NegativeMultinomialDist (double n, double p[]) | |
Creates a NegativeMultinomialDist object with parameters \(n\) and ( \(p_1\), …, \(p_d\)) such that \(\sum_{i=1}^d p_i < 1\), as described above. More... | |
double | prob (int x[]) |
double [] | getMean () |
double [][] | getCovariance () |
double [][] | getCorrelation () |
double | getGamma () |
Returns the parameter \(n\) of this object. | |
double [] | getP () |
Returns the parameters ( \(p_1\), …, \(p_d\)) of this object. | |
void | setParams (double 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 (double n, double p[], int x[]) |
Computes the probability mass function ( fNegativeMultinomial ) of the negative multinomial distribution with parameters \(n\) and ( \(p_1\), …, \(p_d\)), evaluated at \(\mathbf{x}\). | |
static double | cdf (double n, double p[], int x[]) |
Computes the cumulative probability function \(F\) of the negative multinomial distribution with parameters \(n\) and ( \(p_1\), …, \(p_k\)), evaluated at \(\mathbf{x}\). | |
static double [] | getMean (double n, double p[]) |
Computes the mean \(E[X] = n p_i / p_0\) of the negative multinomial distribution with parameters \(n\) and ( \(p_1\), …, \(p_d\)). | |
static double [][] | getCovariance (double n, double p[]) |
Computes the covariance matrix of the negative multinomial distribution with parameters \(n\) and ( \(p_1\), …, \(p_d\)). | |
static double [][] | getCorrelation (double n, double[] p) |
Computes the correlation matrix of the negative multinomial distribution with parameters \(n\) and ( \(p_1\), …, \(p_d\)). | |
static double [] | getMLE (int x[][], int m, int d) |
Estimates and returns the parameters [ \(\hat{n}\), \(\hat{p}_1\), …, \(\hat{p}_d\)] of the negative multinomial distribution using the maximum likelihood method. More... | |
static double | getMLEninv (int x[][], int m, int d) |
Estimates and returns the parameter \(\nu= 1/\hat{n}\) of the negative multinomial distribution using the maximum likelihood method. More... | |
Protected Attributes | |
double | n |
double | p [] |
Protected Attributes inherited from DiscreteDistributionIntMulti | |
int | dimension |
Implements the class DiscreteDistributionIntMulti for the negative multinomial distribution with parameters \(n > 0\) and ( \(p_1, …, p_d\)) such that all \(0<p_i<1\) and \(\sum_{i=1}^d p_i < 1\).
The probability mass function is [97]
\[ P[X = (x_1, …,x_d)] = \frac{\Gamma\left(n + \sum_{i=1}^d x_i\right) p_0^n}{\Gamma(n)} \prod_{i=1}^d \frac{p_i^{x_i}}{x_i!} \tag{fNegativeMultinomial} \]
where \(p_0 = 1 - \sum_{i=1}^d p_i\).
NegativeMultinomialDist | ( | double | n, |
double | p[] | ||
) |
Creates a NegativeMultinomialDist
object with parameters \(n\) and ( \(p_1\), …, \(p_d\)) such that \(\sum_{i=1}^d p_i < 1\), as described above.
We have \(p_i = \) p[i-1]
.
|
static |
Estimates and returns the parameters [ \(\hat{n}\), \(\hat{p}_1\), …, \(\hat{p}_d\)] of the negative 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 in [97] :
\begin{align*} \sum_{s=1}^M \frac{F_s}{(\hat{n} + s - 1)} & = \ln\left(1 + \frac{1}{\hat{n} m} \sum_{j=1}^m \Upsilon_j \right) \\ p_i & = \frac{\lambda_i}{1 + \sum_{j=1}^d \lambda_j} \qquad\mbox{for } i=1, …,d \end{align*}
where
\begin{align*} \lambda_i & = \frac{\sum_{j=1}^m X_{i,j}}{\hat{n} m} \qquad\mbox{for } i=1, …,d \\ \Upsilon_j & = \sum_{i=1}^d X_{i,j} \qquad\mbox{for } j=1, …,m \\ F_s & = \frac{1}{m} \sum_{j=1}^m \mbox{\textbf{1}}\{\Upsilon_j \ge s\} \qquad\mbox{for } s=1, …,M \\ M & = \max_j \{\Upsilon_j\} \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 vector |
|
static |
Estimates and returns the parameter \(\nu= 1/\hat{n}\) of the negative 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 equation of maximum likelihood is defined as:
\[ \sum_{s=1}^M \frac{\nu F_s}{(1 + \nu(s - 1))} = \ln\left(1 + \frac{\nu}{m} \sum_{j=1}^m \Upsilon_j \right)\\ \]
where the symbols are defined as in getMLE(int[][],int,int).
x | the list of observations used to evaluate parameters |
m | the number of observations used to evaluate parameters |
d | the dimension of each vector |