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

This class implements methods for generating random variates from the Student distribution with \(n>0\) degrees of freedom. More...

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

Public Member Functions

 StudentGen (RandomStream s, int n)
 Creates a Student random variate generator with \(n\) degrees of freedom, using stream s.
 
 StudentGen (RandomStream s, StudentDist dist)
 Creates a new generator for the Student distribution dist and stream s.
 
int getN ()
 Returns the value of \(n\) for this object.
 
- 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.
 

Static Public Member Functions

static double nextDouble (RandomStream s, int n)
 Generates a new variate from the Student distribution with \(n = \) n degrees of freedom, using stream s.
 

Protected Member Functions

void setN (int nu)
 

Protected Attributes

int n = -1
 
- Protected Attributes inherited from RandomVariateGen
RandomStream stream
 
Distribution dist
 

Detailed Description

This class implements methods for generating random variates from the Student distribution with \(n>0\) degrees of freedom.

Its density function is

\[ f (x) = \frac{\Gamma\left((n + 1)/2 \right)}{\Gamma(n/2) \sqrt{\pi n}} \left[1 + \frac{x^2}{n}\right]^{-(n+1)/2} \qquad\qquad\mbox{for } -\infty< x < \infty, \tag{fstudent} \]

where \(\Gamma(x)\) is the gamma function defined in ( Gamma ).

The nextDouble method simply calls inverseF on the distribution.

The following table gives the CPU time needed to generate \(10^7\) Student random variates using the different implementations available in SSJ. The second test (Q) was made with the inverse in umontreal.ssj.probdist.StudentDistQuick, while the first test was made with the inverse in umontreal.ssj.probdist.StudentDist. These tests were made on a machine with processor AMD Athlon 4000, running Red Hat Linux, with clock speed at 2400 MHz.

Generator time in seconds
StudentGen 22.4
StudentGen(Q)  6.5
StudentPolarGen  1.4

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