Class InverseTransformSamplingTruncatedNormalRNG

java.lang.Object
dev.nm.stat.random.rng.univariate.normal.truncated.InverseTransformSamplingTruncatedNormalRNG
All Implemented Interfaces:
RandomGammaGenerator, RandomNumberGenerator, Seedable

public class InverseTransformSamplingTruncatedNormalRNG extends Object implements RandomGammaGenerator
A random variate x defined as \[ x = \Phi^{-1}( \Phi(\alpha) + U\cdot(\Phi(\beta)-\Phi(\alpha)))\sigma + \mu \] with \(\Phi\) the cumulative distribution function and \(\Phi^{-1}\) its inverse, U a uniform random number on (0, 1), follows the distribution truncated to the range (a, b). This method is theoretically the best, however the simulation of random variables from \(\Phi\) and \(\Phi^{-1}\) may imply numerical errors; thus practically one has to find other implementations.
See Also:
  • Constructor Details

    • InverseTransformSamplingTruncatedNormalRNG

      public InverseTransformSamplingTruncatedNormalRNG(double mu, double sigma, double a, double b, RandomLongGenerator uniform)
      Construct a rng that samples from a truncated Normal distribution using inverse sampling technique.
      Parameters:
      mu - the mean
      sigma - the standard deviation
      a - the lower bound
      b - the upper bound
      uniform - a uniform rlg
    • InverseTransformSamplingTruncatedNormalRNG

      public InverseTransformSamplingTruncatedNormalRNG(double mu, double sigma, double a, double b)
      Construct a rng that samples from a truncated Normal distribution using inverse sampling technique.
      Parameters:
      mu - the mean
      sigma - the standard deviation
      a - the lower bound
      b - the upper bound
    • InverseTransformSamplingTruncatedNormalRNG

      public InverseTransformSamplingTruncatedNormalRNG(double a, double b)
      Construct a rng that samples from a truncated standard Normal distribution using inverse sampling technique.
      Parameters:
      a - the lower bound
      b - the upper bound
  • Method Details

    • nextDouble

      public double nextDouble()
      Description copied from interface: RandomNumberGenerator
      Get the next random double.
      Specified by:
      nextDouble in interface RandomNumberGenerator
      Returns:
      the next random number
    • seed

      public void seed(long... seeds)
      Description copied from interface: Seedable
      Seed the random number/vector/scenario generator to produce repeatable experiments.
      Specified by:
      seed in interface Seedable
      Parameters:
      seeds - the seeds