Simulation and maximum-likelihood estimation of jump-diffusion processes with pluggable asymmetric, heavy-tailed jump distributions, plus likelihood-based inference and a test for the presence of jumps.
Project description
Jump-Diffusion Parameter Estimation
A comprehensive Python library for simulating and estimating parameters of jump-diffusion processes with asymmetric jump distributions.
🚀 Features
- Flexible Simulation: Generate jump-diffusion paths with customizable parameters
- Maximum Likelihood Estimation: Robust parameter estimation using mixture distributions
- Pluggable Jump Distributions: Skew-normal, Normal (Merton), and the Skewed Generalized Error Distribution (SGED) built in, with a simple interface (
jump_distribution=) to add more - Goodness-of-Fit Comparison: Rank candidate jump distributions on the same data via AIC/BIC and a simulation-based Kolmogorov-Smirnov test
- Validation Tools: Monte Carlo experiments for method validation
- Extensible Architecture: Easy to add new models, jump distributions, and estimation methods
- Educational Focus: Comprehensive documentation and tutorials
📊 Model
Our implementation focuses on jump-diffusion processes of the form:
dX_t = μ dt + σ dW_t + J_t dN_t
Where:
μ: drift parameterσ: diffusion volatilityW_t: Brownian motionJ_t: jump sizes (asymmetrically distributed)N_t: jump arrival times (Bernoulli approximation)
🛠️ Installation
# Install from PyPI
pip install jump-diffusion-estimation
Or install the latest development version from source:
git clone https://github.com/jdospina/jump-diffusion-estimation.git
cd jump-diffusion-estimation
pip install -e .
🎯 Quick Start
import numpy as np
from jump_diffusion import JumpDiffusionSimulator, JumpDiffusionEstimator
# Create simulator
simulator = JumpDiffusionSimulator(
mu=0.05, # 5% annual drift
sigma=0.2, # 20% annual volatility
jump_prob=0.1, # 10% jump probability per period
jump_scale=0.15, # jump magnitude scale
jump_skew=2.0 # positive skewness
)
# Simulate a path
times, path, jumps = simulator.simulate_path(T=1.0, n_steps=252)
# Estimate parameters
increments = np.diff(path)
dt = times[1] - times[0]
estimator = JumpDiffusionEstimator(increments, dt)
results = estimator.estimate()
print(f"Estimated drift: {results['parameters']['mu']:.4f}")
print(f"Estimated volatility: {results['parameters']['sigma']:.4f}")
Using a different jump distribution
Jumps follow a skew-normal distribution by default. Other distributions can be plugged in via jump_distribution, both when simulating and when estimating:
from jump_diffusion.distributions import SGEDJump
simulator = JumpDiffusionSimulator(
mu=0.05, sigma=0.2, jump_prob=0.1,
jump_distribution=SGEDJump(),
jump_loc=0.0, jump_scale=0.15, jump_nu=1.5, jump_xi=2.0,
)
times, path, jumps = simulator.simulate_path(T=1.0, n_steps=252)
increments = np.diff(path)
dt = times[1] - times[0]
estimator = JumpDiffusionEstimator(increments, dt, jump_distribution=SGEDJump())
results = estimator.estimate()
Distributions without a known closed-form likelihood (like SGED) fall back to a generic FFT-based convolution to approximate the mixture density, so adding a new distribution only requires implementing its pdf.
Robust estimation with differential evolution
The default L-BFGS-B optimizer needs a reasonable initial guess and can stall on harder mixture likelihoods (SGED in particular). Differential evolution searches globally instead, needing no initial guess — the applied finding of the thesis this library is based on:
results = estimator.estimate(method="differential_evolution", seed=42)
It costs thousands of likelihood evaluations (seconds instead of milliseconds), with defaults ported from the thesis (rand/1 strategy, DEoptim-style population sizing, early stopping on convergence).
Standard errors via Likelihood Profiling
In complex jump-diffusion mixture models, the numerical Hessian is often unstable or ill-conditioned. Standard errors and 95% confidence intervals can be robustly calculated using Profile Likelihood. After estimating the parameters (preferably with global optimization), you can run:
# Compute standard errors and confidence intervals using a Wilks' theorem threshold
se_results = estimator.estimate_standard_errors(n_points=5, confidence_level=0.95)
# The results table now includes standard errors and CI bounds
estimator.diagnostics()
# Visualize the profile log-likelihood curves
estimator.plot_profiles()
Comparing jump distributions
JumpDistributionComparison fits several candidate jump distributions to the same data and ranks them by AIC/BIC plus a simulation-based Kolmogorov-Smirnov test:
from jump_diffusion.distributions import NormalJump, SGEDJump, SkewNormalJump
from jump_diffusion.validation import JumpDistributionComparison
comparison = JumpDistributionComparison(increments, dt)
comparison.fit("Normal", NormalJump())
comparison.fit("SkewNormal", SkewNormalJump())
comparison.fit("SGED", SGEDJump())
print(comparison.compare()) # ranked by AIC, includes KS statistic/p-value
comparison.plot_comparison()
📚 Examples
Ready-to-run scripts live in the examples/ directory:
- basic_usage.py – demonstrates basic library usage
- validation_experiment.py – runs Monte Carlo validation experiments
Interactive notebooks live in the notebooks/ directory. Every notebook is available in English and in Spanish (suffix _spanish):
- getting_started.ipynb
– The canonical end-to-end tutorial: simulate, estimate (L-BFGS-B and Differential Evolution), quantify uncertainty via the three inference routes (profile / Wald / bootstrap), test for jumps, and compare jump distributions. Start here.
- 🇪🇸 getting_started_spanish.ipynb
– Tutorial completo de principio a fin: simulación, estimación (L-BFGS-B y Evolución Diferencial), inferencia por tres rutas (perfil / Wald / bootstrap), contraste de saltos y comparación de distribuciones.
- 🇪🇸 getting_started_spanish.ipynb
- jump_diffusion_playground.ipynb
– Interactive playground: pick a jump distribution (Normal, Skew-Normal, SGED, Kou, Student-t), wiggle the sliders, simulate, and play the "guess the parameters" game.
- 🇪🇸 jump_diffusion_playground_spanish.ipynb
– Laboratorio interactivo: elige una distribución de saltos, mueve los controles, simula y juega a adivinar los parámetros.
- 🇪🇸 jump_diffusion_playground_spanish.ipynb
- differential_evolution_showcase.ipynb
– Differential Evolution vs. L-BFGS-B on the multimodal mixture likelihood of the SGED jump-diffusion model.
- 🇪🇸 differential_evolution_showcase_spanish.ipynb
– Evolución Diferencial frente a L-BFGS-B sobre la verosimilitud multimodal del modelo de difusión con saltos SGED.
- 🇪🇸 differential_evolution_showcase_spanish.ipynb
- sp500_case_study.ipynb
– Real S&P 500 data: parameter estimation, simulated-vs-real comparison, and a ranking of all five jump distributions by AIC/BIC and bootstrap KS.
- 🇪🇸 sp500_case_study_spanish.ipynb
– Datos reales del S&P 500: estimación de parámetros, comparación simulado-vs-real y ranking de las cinco distribuciones de salto por AIC/BIC y KS bootstrap.
- 🇪🇸 sp500_case_study_spanish.ipynb
Notebook setup
Install optional dependencies and launch Jupyter to explore the notebooks:
pip install notebook ipywidgets matplotlib
jupyter notebook
📖 Academic References
The numerical methods and statistical models implemented in this library build on the following literature:
-
Calibration with Differential Evolution and the SGED:
- Ospina Arango, J. D. (2009). MSc thesis. Universidad Nacional de Colombia. (Foundations of applying the SGED and Differential Evolution to jump-diffusion processes.)
- Ardia, D., Ospina, J. D., & Giraldo, N. D. (2011). Jump-diffusion calibration using differential evolution. Wilmott, 2011(55), 76-79.
- Storn, R., & Price, K. (1997). Differential evolution–a simple and efficient heuristic for global optimization over continuous spaces. Journal of global optimization, 11(4), 341-359.
-
Jump-diffusion models and distributions:
- Merton, R. C. (1976). Option pricing when underlying stock returns are discontinuous. Journal of financial economics, 3(1-2), 125-144.
- Theodossiou, P. (2015). Skewed Generalized Error Distribution of Financial Assets and Option Pricing. Multinational Finance Journal, 19(4), 223-266.
-
Statistical inference (likelihood profiling):
- Wilks, S. S. (1938). The large-sample distribution of the likelihood ratio for testing composite hypotheses. The Annals of Mathematical Statistics, 9(1), 60-62.
🤝 Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Inspired by classical jump-diffusion literature
- Built with love for the quantitative finance community
- Special thanks to contributors and users
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jump_diffusion_estimation-0.2.2.tar.gz.
File metadata
- Download URL: jump_diffusion_estimation-0.2.2.tar.gz
- Upload date:
- Size: 44.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d06027b9baf9811da4eceefe943175af45fb8cb112db07e948ba27aa4e09ed4
|
|
| MD5 |
2b4ff78c70acc6f1b36f94694db2cc8d
|
|
| BLAKE2b-256 |
daa36542edde90aabe7f1d22cc980386c77c43889bd1c5e561494e803759e44a
|
Provenance
The following attestation bundles were made for jump_diffusion_estimation-0.2.2.tar.gz:
Publisher:
publish.yml on jdospina/jump-diffusion-estimation
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jump_diffusion_estimation-0.2.2.tar.gz -
Subject digest:
5d06027b9baf9811da4eceefe943175af45fb8cb112db07e948ba27aa4e09ed4 - Sigstore transparency entry: 2168145106
- Sigstore integration time:
-
Permalink:
jdospina/jump-diffusion-estimation@e24d3d3cb59ed5ff296f3aaec3430b443d892231 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/jdospina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e24d3d3cb59ed5ff296f3aaec3430b443d892231 -
Trigger Event:
release
-
Statement type:
File details
Details for the file jump_diffusion_estimation-0.2.2-py3-none-any.whl.
File metadata
- Download URL: jump_diffusion_estimation-0.2.2-py3-none-any.whl
- Upload date:
- Size: 49.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa765722754db37583515af45a8a3152754f11f7bb8e4a039876de801d5ca928
|
|
| MD5 |
01a4da1cff72d40ce91550b347321e75
|
|
| BLAKE2b-256 |
7c2d4514b22938c8d5a3d75e6b8b2f483b6296018cf0b16d2487a83b78e86f62
|
Provenance
The following attestation bundles were made for jump_diffusion_estimation-0.2.2-py3-none-any.whl:
Publisher:
publish.yml on jdospina/jump-diffusion-estimation
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jump_diffusion_estimation-0.2.2-py3-none-any.whl -
Subject digest:
fa765722754db37583515af45a8a3152754f11f7bb8e4a039876de801d5ca928 - Sigstore transparency entry: 2168145120
- Sigstore integration time:
-
Permalink:
jdospina/jump-diffusion-estimation@e24d3d3cb59ed5ff296f3aaec3430b443d892231 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/jdospina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e24d3d3cb59ed5ff296f3aaec3430b443d892231 -
Trigger Event:
release
-
Statement type: