SSJ  3.3.1
Stochastic Simulation in Java
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
DirichletDist Class Reference

Implements the abstract class ContinuousDistributionMulti for the Dirichlet distribution with parameters ( \(\alpha_1\),…, \(\alpha_d\)), \(\alpha_i > 0\). More...

Inheritance diagram for DirichletDist:
[legend]
Collaboration diagram for DirichletDist:
[legend]

Public Member Functions

 DirichletDist (double[] alpha)
 
double density (double[] x)
 
double [] getMean ()
 
double [][] getCovariance ()
 
double [][] getCorrelation ()
 
double [] getAlpha ()
 Returns the parameters ( \(\alpha_1\), …, \(\alpha_d\)) of this object.
 
double getAlpha (int i)
 Returns the \(i\)th component of the alpha vector.
 
void setParams (double[] alpha)
 Sets the parameters ( \(\alpha_1\), …, \(\alpha_d\)) of this object.
 
- Public Member Functions inherited from ContinuousDistributionMulti
abstract double density (double[] x)
 Returns \(f(x_1, x_2, …, x_d)\), the probability density of \(X\) evaluated at the point \(x\), where \(x = \{x_1, x_2, …, x_d\}\). 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 density (double[] alpha, double[] x)
 Computes the density ( fDirichlet ) of the Dirichlet distribution with parameters ( \(\alpha_1\), …, \(\alpha_d\)).
 
static double [][] getCovariance (double[] alpha)
 Computes the covariance matrix of the Dirichlet distribution with parameters ( \(\alpha_1\), …, \(\alpha_d\)).
 
static double [][] getCorrelation (double[] alpha)
 Computes the correlation matrix of the Dirichlet distribution with parameters ( \(\alpha_1\), …, \(\alpha_d\)).
 
static double [] getMLE (double[][] x, int n, int d)
 Estimates the parameters [ \(\hat{\alpha_1},…,\hat{\alpha_d}\)] of the Dirichlet distribution using the maximum likelihood method. More...
 
static double [] getMean (double[] alpha)
 Computes the mean \(E[X] = \alpha_i / \alpha_0\) of the Dirichlet distribution with parameters ( \(\alpha_1\), …, \(\alpha_d\)), where \(\alpha_0 = \sum_{i=1}^d \alpha_i\).
 

Protected Attributes

double [] alpha
 
- Protected Attributes inherited from ContinuousDistributionMulti
int dimension
 

Detailed Description

Implements the abstract class ContinuousDistributionMulti for the Dirichlet distribution with parameters ( \(\alpha_1\),…, \(\alpha_d\)), \(\alpha_i > 0\).

The probability density is

\[ f(x_1,…, x_d) = \frac{\Gamma(\alpha_0) \prod_{i=1}^d x_i^{\alpha_i - 1}}{\prod_{i=1}^d \Gamma(\alpha_i)} \tag{fDirichlet} \]

where \(x_i \ge0\), \(\sum_{i=1}^d x_i = 1\), \(\alpha_0 = \sum_{i=1}^d \alpha_i\), and \(\Gamma\) is the Gamma function.

Member Function Documentation

◆ getMLE()

static double [] getMLE ( double  x[][],
int  n,
int  d 
)
static

Estimates the parameters [ \(\hat{\alpha_1},…,\hat{\alpha_d}\)] of the Dirichlet distribution using the maximum likelihood method.

It uses the \(n\) observations of \(d\) components in table \(x[i][j]\), \(i = 0, 1, …, n-1\) and \(j = 0, 1, …, d-1\). The equations of the maximum likelihood are defined in [12]  (Technical appendix)

\begin{align*} L(\hat{\alpha}_1,\hat{\alpha}_2,…,\hat{\alpha}_k) & = n \left( G(\alpha_0) - \sum_{i=1}^k G(\hat{\alpha}_i) \right) + \sum_{i=1}^k (\hat{\alpha}_i - 1) Z_i \end{align*}

where \(G\) is the logarithm of the gamma function and

\begin{align*} \alpha_0 & = \sum_{i=1}^k \hat{\alpha}_i \\ Z_i & = \sum_{j=1}^n \ln(X_{i,j}) \qquad\mbox{for }i=1,…,k. \end{align*}

Parameters
xthe list of observations to use to evaluate parameters
nthe number of observations to use to evaluate parameters
dthe dimension of each vector
Returns
returns the parameter [ \(\hat{\alpha_1},…,\hat{\alpha_d}\)]

The documentation for this class was generated from the following file: