SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.randvar.KernelDensityVarCorrectGen Class Reference

This class is a variant of KernelDensityGen, but with a rescaling of the empirical distribution so that the variance of the density used to generate the random variates is equal to the empirical variance, as suggested by [207] . More...

Inheritance diagram for umontreal.ssj.randvar.KernelDensityVarCorrectGen:
umontreal.ssj.randvar.KernelDensityGen umontreal.ssj.randvar.RandomVariateGen

Public Member Functions

 KernelDensityVarCorrectGen (RandomStream s, EmpiricalDist dist, RandomVariateGen kGen, double h, double sigmak2)
 Creates a new generator for a kernel density estimated from the observations given by the empirical distribution dist, using stream s to select the observations, generator kGen to generate the added noise from the kernel density, bandwidth h, and \(\sigma_k^2 =\) sigmak2 used for the variance correction.
 KernelDensityVarCorrectGen (RandomStream s, EmpiricalDist dist, NormalGen kGen)
 This constructor uses a gaussian kernel and the default bandwidth suggested in Table  kernels for the gaussian distribution.
void setBandwidth (double h)
 Sets the bandwidth to h.
double nextDouble ()
 Generates a random number from the continuous distribution contained in this object.
Public Member Functions inherited from umontreal.ssj.randvar.KernelDensityGen
 KernelDensityGen (RandomStream s, EmpiricalDist dist, RandomVariateGen kGen, double h)
 Creates a new generator for a kernel density estimated from the observations given by the empirical distribution dist, using stream s to select the observations, generator kGen to generate the added noise from the kernel density, and bandwidth h.
 KernelDensityGen (RandomStream s, EmpiricalDist dist, NormalGen kGen)
 This constructor uses a gaussian kernel and the default bandwidth.
void setPositiveReflection (boolean reflect)
 After this method is called with true, the generator will produce only positive values, by using the reflection method: replace all negative values by their absolute values.
Public Member Functions inherited from umontreal.ssj.randvar.RandomVariateGen
 RandomVariateGen (RandomStream s, Distribution dist)
 Creates a new random variate generator from the distribution dist, using stream s.
void nextArrayOfDouble (double[] v, int start, int n)
 Generates n random numbers from the continuous distribution contained in this object.
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.
RandomStream getStream ()
 Returns the umontreal.ssj.rng.RandomStream used by this generator.
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.
String toString ()
 Returns a String containing information about the current generator.

Additional Inherited Members

static double getBaseBandwidth (EmpiricalDist dist)
 Computes and returns the value of \(h_0\) in ( bandwidth0 ).

Detailed Description

This class is a variant of KernelDensityGen, but with a rescaling of the empirical distribution so that the variance of the density used to generate the random variates is equal to the empirical variance, as suggested by [207] .

Let \(\bar{x}_n\) and \(s_n^2\) be the sample mean and sample variance of the observations. The distance between each generated random variate and the sample mean \(\bar{x}_n\) is multiplied by the correcting factor

\(1/\sigma_e\), where \(\sigma_e^2 = 1 + (h\sigma_k/s_n)^2\). The constant \(\sigma_k^2\) must be passed to the constructor. Its value can be found in Table  kernels for some popular kernels.

Definition at line 51 of file KernelDensityVarCorrectGen.java.

Constructor & Destructor Documentation

◆ KernelDensityVarCorrectGen() [1/2]

umontreal.ssj.randvar.KernelDensityVarCorrectGen.KernelDensityVarCorrectGen ( RandomStream s,
EmpiricalDist dist,
RandomVariateGen kGen,
double h,
double sigmak2 )

Creates a new generator for a kernel density estimated from the observations given by the empirical distribution dist, using stream s to select the observations, generator kGen to generate the added noise from the kernel density, bandwidth h, and \(\sigma_k^2 =\) sigmak2 used for the variance correction.

Definition at line 64 of file KernelDensityVarCorrectGen.java.

◆ KernelDensityVarCorrectGen() [2/2]

umontreal.ssj.randvar.KernelDensityVarCorrectGen.KernelDensityVarCorrectGen ( RandomStream s,
EmpiricalDist dist,
NormalGen kGen )

This constructor uses a gaussian kernel and the default bandwidth suggested in Table  kernels for the gaussian distribution.

Definition at line 78 of file KernelDensityVarCorrectGen.java.

Member Function Documentation

◆ nextDouble()

double umontreal.ssj.randvar.KernelDensityVarCorrectGen.nextDouble ( )

Generates a random number from the continuous distribution contained in this object.

By default, this method uses inversion by calling the umontreal.ssj.probdist.ContinuousDistribution.inverseF method of the distribution object. Alternative generating methods are provided in subclasses.

Returns
the generated value

Reimplemented from umontreal.ssj.randvar.KernelDensityGen.

Definition at line 90 of file KernelDensityVarCorrectGen.java.

◆ setBandwidth()

void umontreal.ssj.randvar.KernelDensityVarCorrectGen.setBandwidth ( double h)

Sets the bandwidth to h.

Reimplemented from umontreal.ssj.randvar.KernelDensityGen.

Definition at line 82 of file KernelDensityVarCorrectGen.java.


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