distribution
Simulation algorithms and tools for sampling of univariates and variates
levycopula
Lévy Copula
For general definitions and properties, see the seminal paper ‘Characterization of dependence of multidimensional Lévy processes using Lévy copulas’ by Kallsen and Tankov
- class LevyCopula[source]
Bases:
objectLévy copula function
- class ClaytonCopula(theta: float, eta: float)[source]
Bases:
LevyCopulaThe Clayton copula function is parametrised by theta and eta. See formula (7) in ‘Lévy copulas: review of recent results’ by Peter Tankov
- property theta
- class IndependentComponentsCopula[source]
Bases:
LevyCopulaIn this case, the margins are independent, see formula (4.2) in ‘Characterization of dependence of multidimensional Lévy processes using Lévy copulas’ by Kallsen and Tankov
- class DependentComponentsCopula[source]
Bases:
LevyCopulaIn this case, the margins are completely dependent, see formula (4.3) in ‘Characterization of dependence of multidimensional Lévy processes using Lévy copulas’ by Kallsen and Tankov
pairing
Definition of pairing functions and their inverse
A pairing function is a bijection between integers and \(N^k\), see https://en.wikipedia.org/wiki/Pairing_function for more details and also the paper “The Rosenberg-Strong Pairing Function” by Matthew P. Szudzik (https://arxiv.org/abs/1706.04129)
Here we define extend the pairing functions to Z
- class HyperbolicPairing[source]
Bases:
PairingFrom ‘Managing storage for extendible arrays’ by Rosenberg
- class PairingToZd(pairing: Pairing, dimension: int = 2, omit_zero: bool = True)[source]
Bases:
objectPairing \(\mathbb{N}\) with \(\mathbb{Z}^d\)
- class PairingToZ1d(interval: tuple[int, int], omit_zero: bool = True)[source]
Bases:
objectMapping 0, 1, 2, 3,… to the states in an interval \([-L, R], L>0, R>0, L\neq R\)
- class Boundary[source]
Bases:
objectBoundary for a domain, the default is that there is no boundary
- class Domain(boundary: Boundary, grid: CTMCGrid, pairing: PairingToZd)[source]
Bases:
object- A domain D is a “regular” volume which meets the following assumptions:
it contains the origin
there is point \(z = (z_1, z_2, ...., z_n)\) in D such that \(|z_i| > |x_i|\) where \(x_i\) is the i-th coordinate in \((0,0,..., 0, x_i, 0, ..., 0)\) which is the boundary on the i-th axis of D
all hyperplanes are convex
- __init__(boundary: Boundary, grid: CTMCGrid, pairing: PairingToZd)[source]
- outside(x: Coordinates) bool[source]
- class StatesManager(pairing: PairingToZd, domain: Domain, grid: CTMCGrid)[source]
Bases:
object- __init__(pairing: PairingToZd, domain: Domain, grid: CTMCGrid)[source]
- Parameters
pairing – pairing object
domain – domain of the admissible states
grid – discretisation grid
- project_index_to_state_increment(x: int, max_logged: int = -1) tuple[tuple[int, ...], bool][source]
Return the state increment and a boolean which is True if we have exhausted all the states in the domain
- Parameters
x – current index to be mapped to a state increment
max_logged – max logged index
- Returns
the state increment and a break condition
sampling
Generic sampling class for continuous or discrete probability distributions
- class SamplingMethod(value)[source]
Bases:
EnumSampling method type
- ALIAS = 1
- TABLE = 2
- BINARYSEARCHTREE = 3
- HUFFMANNTREE = 4
- INVERSION = 5
- BINARYSEARCHTREEADAPTED = 6
- BINARYSEARCHTREEADAPTED1D = 7
samplingfactory
Simple factory function to create a sampling method
- compute_intensity_of_jumps(model: Union[LevyModel, LevyCopulaModel], grid: CTMCGrid)[source]
- create_q_vector(levy_measure: LevyMeasure, grid: CTMCGrid) array[source]
- create_sampling_method(model, levy_measure, method: SamplingMethod, grid: CTMCGrid, is_levy_copula: bool, intensity_of_jumps: float)[source]