Class StableSampler

  • All Implemented Interfaces:
    ContinuousSampler, SharedStateContinuousSampler, SharedStateSampler<SharedStateContinuousSampler>

    public abstract class StableSampler
    extends Object
    implements SharedStateContinuousSampler
    Samples from a stable distribution.

    Several different parameterizations exist for the stable distribution. This sampler uses the 0-parameterization distribution described in Nolan (2020) "Univariate Stable Distributions: Models for Heavy Tailed Data". Springer Series in Operations Research and Financial Engineering. Springer. Sections 1.7 and 3.3.3.

    The random variable X has the stable distribution S(α,β,γ,δ;0) if its characteristic function is given by:

    E(eiuX)={exp(γα|u|α[1iβ(tanπα2)(sgn(u))]+iδu)α1exp(γ|u|[1+iβ2π(sgn(u))log|u|]+iδu)α=1

    The function is continuous with respect to all the parameters; the parameters α and β determine the shape and the parameters γ and δ determine the scale and location. The support of the distribution is:

    supportf(x|α,β,γ,δ;0)={[δγtanπα2,)α<1 and β=1(,δ+γtanπα2]α<1 and β=1(,)otherwise

    The implementation uses the Chambers-Mallows-Stuck (CMS) method as described in:

    • Chambers, Mallows & Stuck (1976) "A Method for Simulating Stable Random Variables". Journal of the American Statistical Association. 71 (354): 340–344.
    • Weron (1996) "On the Chambers-Mallows-Stuck method for simulating skewed stable random variables". Statistics & Probability Letters. 28 (2): 165–171.
    Since:
    1.4
    See Also:
    Stable distribution (Wikipedia), Nolan (2020) Univariate Stable Distributions, Chambers et al (1976) JOASA 71: 340-344, Weron (1996). Statistics & Probability Letters. 28 (2): 165–171.
    • Method Detail

      • sample

        public abstract double sample()
        Generate a sample from a stable distribution.

        The distribution uses the 0-parameterization: S(alpha, beta, gamma, delta; 0).

        Specified by:
        sample in interface ContinuousSampler
        Returns:
        a sample.
      • of

        public static StableSampler of​(UniformRandomProvider rng,
                                       double alpha,
                                       double beta)
        Creates a standardized sampler of a stable distribution with zero location and unit scale.

        Special cases:

        • alpha=2 returns a Gaussian distribution sampler with mean=0 and variance=2 (Note: beta has no effect on the distribution).
        • alpha=1 and beta=0 returns a Cauchy distribution sampler with location=0 and scale=1.
        • alpha=0.5 and beta=1 returns a Levy distribution sampler with location=-1 and scale=1. This location shift is due to the 0-parameterization of the stable distribution.

        Note: To allow the computation of the stable distribution the parameter alpha is validated using 1 - alpha in the interval [-1, 1).

        Parameters:
        rng - Generator of uniformly distributed random numbers.
        alpha - Stability parameter. Must be in the interval (0, 2].
        beta - Skewness parameter. Must be in the interval [-1, 1].
        Returns:
        the sampler
        Throws:
        IllegalArgumentException - if 1 - alpha < -1; or 1 - alpha >= 1; or beta < -1; or beta > 1.
      • of

        public static StableSampler of​(UniformRandomProvider rng,
                                       double alpha,
                                       double beta,
                                       double gamma,
                                       double delta)
        Creates a sampler of a stable distribution. This applies a transformation to the standardized sampler.

        The random variable X has the stable distribution S(α,β,γ,σ;0) if:

        X=γZ0+δ

        where Z0=S(α,β;0) is a standardized stable distribution.

        Note: To allow the computation of the stable distribution the parameter alpha is validated using 1 - alpha in the interval [-1, 1).

        Parameters:
        rng - Generator of uniformly distributed random numbers.
        alpha - Stability parameter. Must be in the interval (0, 2].
        beta - Skewness parameter. Must be in the interval [-1, 1].
        gamma - Scale parameter. Must be strictly positive and finite.
        delta - Location parameter. Must be finite.
        Returns:
        the sampler
        Throws:
        IllegalArgumentException - if 1 - alpha < -1; or 1 - alpha >= 1; or beta < -1; or beta > 1; or gamma <= 0; or gamma or delta are not finite.
        See Also:
        of(UniformRandomProvider, double, double)