SSJ
3.3.1
Stochastic Simulation in Java
|
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 [215] . More...
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) |
double | nextDouble () |
Public Member Functions inherited from 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 \(h = \alpha_k h_0\) with the \(\alpha_k\) suggested in Table kernels for the gaussian distribution. More... | |
void | setBandwidth (double h) |
Sets the bandwidth to h . | |
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. More... | |
double | nextDouble () |
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 | |
double | sigmak2 |
double | mean |
double | invSigmae |
Protected Attributes inherited from KernelDensityGen | |
RandomVariateGen | kernelGen |
double | bandwidth |
boolean | positive |
Protected Attributes inherited from RandomVariateGen | |
RandomStream | stream |
Distribution | dist |
Additional Inherited Members | |
Static Public Member Functions inherited from KernelDensityGen | |
static double | getBaseBandwidth (EmpiricalDist dist) |
Computes and returns the value of \(h_0\) in ( bandwidth0 ). | |
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 [215] .
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.