Class StableSampler.CMSStableSampler

All Implemented Interfaces:
ContinuousSampler, SharedStateContinuousSampler, SharedStateSampler<SharedStateContinuousSampler>
Enclosing class:
StableSampler

static class StableSampler.CMSStableSampler extends StableSampler.WeronStableSampler
Implement the generic stable distribution case: alpha < 2 and beta != 0. This routine assumes alpha != 1.

Implements the Chambers-Mallows-Stuck (CMS) method from Chambers, et al (1976) A Method for Simulating Stable Random Variables. Journal of the American Statistical Association Vol. 71, No. 354, pp. 340-344.

The formula produces a stable deviate from the 0-parameterization that is continuous at alpha=1.

This is an implementation of the Fortran routine RSTAB. In the event the computation fails then an alternative computation is performed using the formula provided in Weron (1996) "On the Chambers-Mallows-Stuck method for simulating skewed stable random variables" Statistics & Probability Letters. 28 (2): 165–171. This method is easier to correct from infinite and NaN results. The error correction path is extremely unlikely to occur during use unless alpha -> 0. In general use it requires the random deviates w or u are extreme. See the unit tests for conditions that create them.

This produces non-NaN output for all parameters alpha, beta, u and w with the correct orientation for extremes of the distribution support. The formulas used are symmetric with regard to beta and u.

  • Field Details

    • HALF

      private static final double HALF
      1/2.
      See Also:
    • tau

      private final double tau
      Cache of expression value used in generation.
  • Constructor Details

    • CMSStableSampler

      CMSStableSampler(UniformRandomProvider rng, double alpha, double beta)
      Parameters:
      rng - Underlying source of randomness
      alpha - Stability parameter. Must be in the interval (0, 2].
      beta - Skewness parameter. Must be in the interval [-1, 1].
    • CMSStableSampler

      Parameters:
      rng - Underlying source of randomness
      source - Source to copy.
  • Method Details