SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | Protected Attributes | List of all members

This class implements random variate generators for a mixture distribution. More...

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

Public Member Functions

 MixtureGen (RandomStream s, Distribution[] dists, double[] weights)
 Creates a new mixture distribution generator defined by the given Distribution and weights, using the random stream s. More...
 
double nextDouble ()
 
Mixture distribution parameters
Distribution getDistribution ()
 This method is not supported, it will throw an UnsupportedOperationException. More...
 
Distribution [] getDistributions ()
 Returns the distributions of this mixture. More...
 
double [] getWeights ()
 Returns the probability associated with each distribution of the mixture. More...
 
- Public Member Functions inherited from RandomVariateGen
 RandomVariateGen (RandomStream s, Distribution dist)
 Creates a new random variate generator from the distribution dist, using stream s. More...
 
double nextDouble ()
 Generates a random number from the continuous distribution contained in this object. More...
 
void nextArrayOfDouble (double[] v, int start, int n)
 Generates n random numbers from the continuous distribution contained in this object. More...
 
double [] nextArrayOfDouble (int n)
 Generates n random numbers from the continuous distribution contained in this object, and returns them in a new array of size n. More...
 
RandomStream getStream ()
 Returns the umontreal.ssj.rng.RandomStream used by this generator. More...
 
void setStream (RandomStream stream)
 Sets the umontreal.ssj.rng.RandomStream used by this generator to stream.
 
Distribution getDistribution ()
 Returns the umontreal.ssj.probdist.Distribution used by this generator. More...
 
String toString ()
 Returns a String containing information about the current generator.
 

Protected Attributes

Distribution [] dists
 The different distributions that compose this mixture.
 
DiscreteDistribution weightsDist
 The discrete distribution that is used to select randomly a distribution from the mixture when generating a random variate.
 
double [] weights
 The probability of each distribution that compose this mixture, see variable dists .
 
- Protected Attributes inherited from RandomVariateGen
RandomStream stream
 
Distribution dist
 

Detailed Description

This class implements random variate generators for a mixture distribution.

Consider a random variable \(X\) defined by a mixture of \(k\) distributions. Let \(f_i(x)\) be the density or probability mass function of the \(i\)-th distribution with associated weight \(w_i \in [0, 1]\). The sum of the \(k\) weights must equal to 1, i.e., \(\sum_{i=1}^k w_i = 1\).

The density or probability mass function \(f(x)\) of \(X\) is then

\[ f(x) = \sum_{i=1}^k f_i(x). \]

In the class constructor, the user must give an array of size \(k\) of umontreal.ssj.probdist.Distribution and an array of double of same length for the associated weights \(w_i\). To generate a random variate, the implementation of this class will first select randomly (and proportionally to the weights \(w_i\)) a distribution \(D_i\) from the mixture. Then, it will generate a random variate by inversion by calling the method Distribution.inverseF.

Constructor & Destructor Documentation

◆ MixtureGen()

MixtureGen ( RandomStream  s,
Distribution []  dists,
double []  weights 
)

Creates a new mixture distribution generator defined by the given Distribution and weights, using the random stream s.

The list of distributions and associated weights are given by arguments dists and weights. The weights must be non-negative, and they must sum to 1.

Parameters
sthe random stream that will be used to generate the random variates
diststhe distributions that define the mixture
weightsthe probability to select each distribution in the mixture

Member Function Documentation

◆ getDistribution()

Distribution getDistribution ( )

This method is not supported, it will throw an UnsupportedOperationException.

Use method getDistributions instead.

Exceptions
UnsupportedOperationExceptionthis method is not supported

◆ getDistributions()

Distribution [] getDistributions ( )

Returns the distributions of this mixture.

See also getWeights .

◆ getWeights()

double [] getWeights ( )

Returns the probability associated with each distribution of the mixture.

See also getDistributions .


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