public abstract class StableSampler extends Object implements SharedStateContinuousSampler
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(\alpha, \beta, \gamma, \delta; 0) \) if its characteristic function is given by:
\[ E(e^{iuX}) = \begin{cases} \exp \left (- \gamma^\alpha |u|^\alpha \left [1 - i \beta (\tan \frac{\pi \alpha}{2})(\text{sgn}(u)) \right ] + i \delta u \right ) & \alpha \neq 1 \\ \exp \left (- \gamma |u| \left [1 + i \beta \frac{2}{\pi} (\text{sgn}(u)) \log |u| \right ] + i \delta u \right ) & \alpha = 1 \end{cases} \]
The function is continuous with respect to all the parameters; the parameters \( \alpha \) and \( \beta \) determine the shape and the parameters \( \gamma \) and \( \delta \) determine the scale and location. The support of the distribution is:
\[ \text{support} f(x|\alpha,\beta,\gamma,\delta; 0) = \begin{cases} [\delta - \gamma \tan \frac{\pi \alpha}{2}, \infty) & \alpha \lt 1\ and\ \beta = 1 \\ (-\infty, \delta + \gamma \tan \frac{\pi \alpha}{2}] & \alpha \lt 1\ and\ \beta = -1 \\ (-\infty, \infty) & otherwise \end{cases} \]
The implementation uses the Chambers-Mallows-Stuck (CMS) method as described in:
Modifier and Type | Method and Description |
---|---|
static StableSampler |
of(UniformRandomProvider rng,
double alpha,
double beta)
Creates a standardized sampler of a stable distribution with zero location and unit scale.
|
static StableSampler |
of(UniformRandomProvider rng,
double alpha,
double beta,
double gamma,
double delta)
Creates a sampler of a stable distribution.
|
abstract double |
sample()
Generate a sample from a stable distribution.
|
String |
toString() |
abstract StableSampler |
withUniformRandomProvider(UniformRandomProvider rng)
Create a new instance of the sampler with the same underlying state using the given
uniform random provider as the source of randomness.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
samples, samples
public abstract double sample()
The distribution uses the 0-parameterization: S(alpha, beta, gamma, delta; 0).
sample
in interface ContinuousSampler
public abstract StableSampler withUniformRandomProvider(UniformRandomProvider rng)
withUniformRandomProvider
in interface SharedStateSampler<SharedStateContinuousSampler>
rng
- Generator of uniformly distributed random numbers.public static StableSampler of(UniformRandomProvider rng, double alpha, double beta)
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)
.
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]
.IllegalArgumentException
- if 1 - alpha < -1
; or 1 - alpha >= 1
;
or beta < -1
; or beta > 1
.public static StableSampler of(UniformRandomProvider rng, double alpha, double beta, double gamma, double delta)
The random variable \( X \) has the stable distribution \( S(\alpha, \beta, \gamma, \delta; 0) \) if:
\[ X = \gamma Z_0 + \delta \]
where \( Z_0 = S(\alpha, \beta; 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)
.
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.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.of(UniformRandomProvider, double, double)
Copyright © 2016–2022 The Apache Software Foundation. All rights reserved.