|
SSJ
3.3.1
Stochastic Simulation in Java
|
Extends RandomMultivariateGen for a Dirichlet [98] distribution. More...
Public Member Functions | |
| DirichletGen (RandomStream stream, double[] alphas) | |
Constructs a new Dirichlet generator with parameters \(\alpha_{i+1}=\) alphas[i], for \(i=0,…,k-1\), and the stream stream. More... | |
| double | getAlpha (int i) |
| Returns the \(\alpha_{i+1}\) parameter for this Dirichlet generator. More... | |
| void | nextPoint (double[] p) |
| Generates a point from the Dirichlet distribution. More... | |
Public Member Functions inherited from RandomMultivariateGen | |
| abstract void | nextPoint (double[] p) |
| Generates a random point \(p\) using the the stream contained in this object. | |
| void | nextArrayOfPoints (double[][] v, int start, int n) |
| Generates \(n\) random points. More... | |
| int | getDimension () |
| Returns the dimension of this multivariate generator (the dimension of the random points). | |
| RandomStream | getStream () |
| Returns the umontreal.ssj.rng.RandomStream used by this object. More... | |
| void | setStream (RandomStream stream) |
Sets the umontreal.ssj.rng.RandomStream used by this object to stream. | |
Static Public Member Functions | |
| static void | nextPoint (RandomStream stream, double[] alphas, double[] p) |
Generates a new point from the Dirichlet distribution with parameters alphas, using the stream stream. More... | |
Additional Inherited Members | |
Protected Attributes inherited from RandomMultivariateGen | |
| int | dimension |
| RandomStream | stream |
| RandomVariateGen | gen1 |
Extends RandomMultivariateGen for a Dirichlet [98] distribution.
This distribution uses the parameters \(\alpha_1,…,\alpha_k\), and has density
\[ f(x_1,…,x_k) = \frac{\Gamma(\alpha_0)\prod_{i=1}^k x_i^{\alpha_i - 1}}{\prod_{i=1}^k \Gamma(\alpha_i)} \]
where \(\alpha_0=\sum_{i=1}^k\alpha_i\).
Here, the successive coordinates of the Dirichlet vector are generated
via the class umontreal.ssj.randvar.GammaAcceptanceRejectionGen in package randvar, using the same stream for all the uniforms.
Note: when the shape parameters \(\alpha_i\) are all very small, the results may lose some numerical precision. For example, the value of the density function of the Dirichlet multivariate may return 0. Also, the generated \(x_i\) will often have one variate equals to 1, and all others set at (or near) 0.
| DirichletGen | ( | RandomStream | stream, |
| double [] | alphas | ||
| ) |
Constructs a new Dirichlet generator with parameters \(\alpha_{i+1}=\) alphas[i], for \(i=0,…,k-1\), and the stream stream.
| stream | the random number stream used to generate uniforms. |
| alphas | the \(\alpha_i\) parameters of the generated distribution. |
| IllegalArgumentException | if one \(\alpha_k\) is negative or 0. |
| NullPointerException | if any argument is null. |
| double getAlpha | ( | int | i | ) |
Returns the \(\alpha_{i+1}\) parameter for this Dirichlet generator.
| i | the index of the parameter. |
| ArrayIndexOutOfBoundsException | if i is negative or greater than or equal to getDimension. |
|
static |
Generates a new point from the Dirichlet distribution with parameters alphas, using the stream stream.
The generated values are placed into p.
| stream | the random number stream used to generate the uniforms. |
| alphas | the \(\alpha_i\) parameters of the distribution, for \(i=1,…,k\). |
| p | the array to be filled with the generated point. |
| void nextPoint | ( | double [] | p | ) |
Generates a point from the Dirichlet distribution.
| p | the array to be filled with the generated point. |
1.8.14