pcntoolkit.math_functions.shash
Sinh-Arcsinh (SHASH) Distribution Implementation Module.
This module implements the Sinh-Arcsinh (SHASH) distribution and its variants as described in Jones and Pewsey (2009) [1]. The SHASH distribution is a flexible distribution family that can model skewness and kurtosis through separate parameters.
The module provides:
Basic SHASH transformations (S, S_inv, C)
SHASH distribution (base implementation)
SHASHo distribution (location-scale variant)
SHASHo2 distribution (alternative parameterization)
SHASHb distribution (standardized variant)
References
Notes
The implementation uses PyMC and PyTensor for probabilistic programming capabilities. All distributions support random sampling and log-probability calculations.
Attributes
Classes
Functions
|
|
|
The P function as given in Jones et al. |
|
Sinh arcsinh transformation. |
|
Inverse sinh arcsinh transformation. |
|
The r'th uncentered moment as given in Jones et al. |
|
Module Contents
- class Kv
Bases:
pytensor.scalar.basic.BinaryScalarOp- grad(inputs: Sequence[pytensor.graph.basic.Variable[Any, Any]], output_gradients: Sequence[pytensor.graph.basic.Variable[Any, Any]]) List[pytensor.graph.basic.Variable]
- nfunc_spec = ('scipy.special.kv', 2, 1)
- class SHASH
Bases:
pymc.distributions.Continuous- classmethod dist(epsilon: pytensor.tensor.TensorLike, delta: pytensor.tensor.TensorLike, **kwargs: Any) Any
- my_K
- rv_op
- class SHASHb
Bases:
pymc.distributions.Continuous- classmethod dist(mu: pytensor.tensor.TensorLike, sigma: pytensor.tensor.TensorLike, epsilon: pytensor.tensor.TensorLike, delta: pytensor.tensor.TensorLike, **kwargs: Any) Any
- rv_op
- class SHASHbRV
Bases:
pytensor.tensor.random.op.RandomVariable- classmethod rng_fn(rng: numpy.random.Generator, mu: float, sigma: float, epsilon: float, delta: float, size: int | Tuple[int, Ellipsis] | None = None) numpy.typing.NDArray[numpy.float64]
- dtype = 'floatX'
- name = 'shashb'
- signature = '(),(),(),()->()'
- class SHASHo
Bases:
pymc.distributions.Continuous- classmethod dist(mu: pytensor.tensor.TensorLike, sigma: pytensor.tensor.TensorLike, epsilon: pytensor.tensor.TensorLike, delta: pytensor.tensor.TensorLike, **kwargs: Any) Any
- rv_op
- class SHASHo2
Bases:
pymc.distributions.Continuous- classmethod dist(mu: pytensor.tensor.TensorLike, sigma: pytensor.tensor.TensorLike, epsilon: pytensor.tensor.TensorLike, delta: pytensor.tensor.TensorLike, **kwargs: Any) Any
- rv_op
- class SHASHo2RV
Bases:
pytensor.tensor.random.op.RandomVariable- classmethod rng_fn(rng: numpy.random.Generator, mu: pytensor.tensor.TensorLike, sigma: pytensor.tensor.TensorLike, epsilon: pytensor.tensor.TensorLike, delta: pytensor.tensor.TensorLike, size: int | Tuple[int, Ellipsis] | None = None) numpy.typing.NDArray[numpy.float64]
- dtype = 'floatX'
- name = 'shasho2'
- signature = '(),(),(),()->()'
- class SHASHoRV
Bases:
pytensor.tensor.random.op.RandomVariable- classmethod rng_fn(rng: numpy.random.Generator, mu: pytensor.tensor.TensorLike, sigma: pytensor.tensor.TensorLike, epsilon: pytensor.tensor.TensorLike, delta: pytensor.tensor.TensorLike, size: int | Tuple[int, Ellipsis] | None = None) numpy.typing.NDArray[numpy.float64]
- dtype = 'floatX'
- name = 'shasho'
- signature = '(),(),(),()->()'
- class SHASHrv
Bases:
pytensor.tensor.random.op.RandomVariable- classmethod rng_fn(rng: numpy.random.Generator, epsilon: float, delta: float, size: int | Tuple[int, Ellipsis] | None = None) numpy.typing.NDArray[numpy.float64]
- dtype = 'floatX'
- name = 'shash'
- signature = '(),()->()'
- K(p, x, chunks=None)
- P(q: numpy.typing.NDArray[numpy.float64]) numpy.typing.NDArray[numpy.float64]
The P function as given in Jones et al.
- S(x: numpy.typing.NDArray[numpy.float64], e: numpy.typing.NDArray[numpy.float64], d: numpy.typing.NDArray[numpy.float64]) numpy.typing.NDArray[numpy.float64]
Sinh arcsinh transformation.
- S_inv(x: numpy.typing.NDArray[numpy.float64], e: numpy.typing.NDArray[numpy.float64], d: numpy.typing.NDArray[numpy.float64]) numpy.typing.NDArray[numpy.float64]
Inverse sinh arcsinh transformation.
- m(epsilon: numpy.typing.NDArray[numpy.float64], delta: numpy.typing.NDArray[numpy.float64], r: int) numpy.typing.NDArray[numpy.float64]
The r’th uncentered moment as given in Jones et al.
- CONST1
- CONST2
- KV_GRADIENT_DP = 1e-08
- kv
- shash
- shashb
- shasho
- shasho2