umontreal.iro.lecuyer.randvar
Class KernelDensityVarCorrectGen
- java.lang.Object
-
- umontreal.iro.lecuyer.randvar.RandomVariateGen
-
- umontreal.iro.lecuyer.randvar.KernelDensityGen
-
- umontreal.iro.lecuyer.randvar.KernelDensityVarCorrectGen
-
public class KernelDensityVarCorrectGen extends KernelDensityGen
This class is a variant ofKernelDensityGen, 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 Silverman.Let bar(x)n and sn2 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/σe, where σe2 = 1 + (hσk/sn)2. The constant σk2 must be passed to the constructor. Its value can be found in the Table in
KernelDensityGenfor some popular kernels.
-
-
Constructor Summary
Constructors Constructor and Description KernelDensityVarCorrectGen(RandomStream s, EmpiricalDist dist, NormalGen kGen)This constructor uses a gaussian kernel and the default bandwidth suggested in Table for the gaussian distribution.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 σk2 = sigmak2 used for the variance correction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublenextDouble()Generates a random number from the continuous distribution contained in this object.voidsetBandwidth(double h)Sets the bandwidth to h.-
Methods inherited from class umontreal.iro.lecuyer.randvar.KernelDensityGen
getBaseBandwidth, setPositiveReflection
-
Methods inherited from class umontreal.iro.lecuyer.randvar.RandomVariateGen
getDistribution, getStream, nextArrayOfDouble, setStream, toString
-
-
-
-
Constructor Detail
-
KernelDensityVarCorrectGen
public 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 σk2 = sigmak2 used for the variance correction.
-
KernelDensityVarCorrectGen
public KernelDensityVarCorrectGen(RandomStream s, EmpiricalDist dist, NormalGen kGen)
This constructor uses a gaussian kernel and the default bandwidth suggested in Table for the gaussian distribution.
-
-
Method Detail
-
setBandwidth
public void setBandwidth(double h)
Description copied from class:KernelDensityGenSets the bandwidth to h.- Overrides:
setBandwidthin classKernelDensityGen
-
nextDouble
public double nextDouble()
Description copied from class:RandomVariateGenGenerates a random number from the continuous distribution contained in this object. By default, this method uses inversion by calling theinverseFmethod of the distribution object. Alternative generating methods are provided in subclasses.- Overrides:
nextDoublein classKernelDensityGen- Returns:
- the generated value
-
-
DMelt 3.0 © DataMelt by jWork.ORG