jump-diffusion-estimation 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. jump_diffusion_estimation-0.2.0/LICENSE +25 -0
  2. jump_diffusion_estimation-0.2.0/PKG-INFO +241 -0
  3. jump_diffusion_estimation-0.2.0/README.md +188 -0
  4. jump_diffusion_estimation-0.2.0/pyproject.toml +84 -0
  5. jump_diffusion_estimation-0.2.0/requirements.txt +7 -0
  6. jump_diffusion_estimation-0.2.0/setup.cfg +4 -0
  7. jump_diffusion_estimation-0.2.0/src/jump_diffusion/__init__.py +40 -0
  8. jump_diffusion_estimation-0.2.0/src/jump_diffusion/distributions/__init__.py +22 -0
  9. jump_diffusion_estimation-0.2.0/src/jump_diffusion/distributions/base.py +152 -0
  10. jump_diffusion_estimation-0.2.0/src/jump_diffusion/distributions/kou.py +104 -0
  11. jump_diffusion_estimation-0.2.0/src/jump_diffusion/distributions/normal.py +73 -0
  12. jump_diffusion_estimation-0.2.0/src/jump_diffusion/distributions/sged.py +113 -0
  13. jump_diffusion_estimation-0.2.0/src/jump_diffusion/distributions/skew_normal.py +97 -0
  14. jump_diffusion_estimation-0.2.0/src/jump_diffusion/distributions/student_t.py +86 -0
  15. jump_diffusion_estimation-0.2.0/src/jump_diffusion/estimation/__init__.py +19 -0
  16. jump_diffusion_estimation-0.2.0/src/jump_diffusion/estimation/base_estimator.py +62 -0
  17. jump_diffusion_estimation-0.2.0/src/jump_diffusion/estimation/maximum_likelihood.py +1239 -0
  18. jump_diffusion_estimation-0.2.0/src/jump_diffusion/models/__init__.py +14 -0
  19. jump_diffusion_estimation-0.2.0/src/jump_diffusion/models/base_model.py +93 -0
  20. jump_diffusion_estimation-0.2.0/src/jump_diffusion/models/jump_diffusion.py +168 -0
  21. jump_diffusion_estimation-0.2.0/src/jump_diffusion/scripts/__init__.py +3 -0
  22. jump_diffusion_estimation-0.2.0/src/jump_diffusion/scripts/benchmark.py +10 -0
  23. jump_diffusion_estimation-0.2.0/src/jump_diffusion/scripts/validate.py +74 -0
  24. jump_diffusion_estimation-0.2.0/src/jump_diffusion/simulation/__init__.py +14 -0
  25. jump_diffusion_estimation-0.2.0/src/jump_diffusion/simulation/base_simulator.py +51 -0
  26. jump_diffusion_estimation-0.2.0/src/jump_diffusion/simulation/jump_diffusion_simulator.py +264 -0
  27. jump_diffusion_estimation-0.2.0/src/jump_diffusion/validation/__init__.py +14 -0
  28. jump_diffusion_estimation-0.2.0/src/jump_diffusion/validation/distribution_comparison.py +270 -0
  29. jump_diffusion_estimation-0.2.0/src/jump_diffusion/validation/monte_carlo.py +349 -0
  30. jump_diffusion_estimation-0.2.0/src/jump_diffusion_estimation.egg-info/PKG-INFO +241 -0
  31. jump_diffusion_estimation-0.2.0/src/jump_diffusion_estimation.egg-info/SOURCES.txt +34 -0
  32. jump_diffusion_estimation-0.2.0/src/jump_diffusion_estimation.egg-info/dependency_links.txt +1 -0
  33. jump_diffusion_estimation-0.2.0/src/jump_diffusion_estimation.egg-info/entry_points.txt +3 -0
  34. jump_diffusion_estimation-0.2.0/src/jump_diffusion_estimation.egg-info/not-zip-safe +1 -0
  35. jump_diffusion_estimation-0.2.0/src/jump_diffusion_estimation.egg-info/requires.txt +31 -0
  36. jump_diffusion_estimation-0.2.0/src/jump_diffusion_estimation.egg-info/top_level.txt +1 -0
@@ -0,0 +1,25 @@
1
+ # ==========================================
2
+ # LICENSE
3
+ # ==========================================
4
+
5
+ MIT License
6
+
7
+ Copyright (c) 2024 Juan David OSPINA ARANGO and Jump-Diffusion Estimation Contributors
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
@@ -0,0 +1,241 @@
1
+ Metadata-Version: 2.4
2
+ Name: jump-diffusion-estimation
3
+ Version: 0.2.0
4
+ Summary: 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.
5
+ Author-email: Juan David Ospina Arango <jdospina@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/jdospina/jump-diffusion-estimation
8
+ Project-URL: Bug Tracker, https://github.com/jdospina/jump-diffusion-estimation/issues
9
+ Project-URL: Documentation, https://jump-diffusion-estimation.readthedocs.io/
10
+ Keywords: jump-diffusion,stochastic-processes,maximum-likelihood,differential-evolution,profile-likelihood,parametric-bootstrap,quantitative-finance,parameter-estimation
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Intended Audience :: Financial and Insurance Industry
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
22
+ Classifier: Topic :: Office/Business :: Financial
23
+ Requires-Python: >=3.8
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: numpy>=1.20.0
27
+ Requires-Dist: scipy>=1.7.0
28
+ Requires-Dist: matplotlib>=3.3.0
29
+ Requires-Dist: seaborn>=0.11.0
30
+ Requires-Dist: pandas>=1.3.0
31
+ Requires-Dist: scikit-learn>=1.0.0
32
+ Requires-Dist: tqdm>=4.60.0
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest>=6.0; extra == "dev"
35
+ Requires-Dist: pytest-cov; extra == "dev"
36
+ Requires-Dist: black; extra == "dev"
37
+ Requires-Dist: flake8; extra == "dev"
38
+ Requires-Dist: mypy; extra == "dev"
39
+ Requires-Dist: jupyter; extra == "dev"
40
+ Requires-Dist: sphinx; extra == "dev"
41
+ Requires-Dist: sphinx-rtd-theme; extra == "dev"
42
+ Requires-Dist: pandas-stubs; python_version >= "3.10" and extra == "dev"
43
+ Requires-Dist: scipy-stubs; python_version >= "3.10" and extra == "dev"
44
+ Provides-Extra: tutorials
45
+ Requires-Dist: jupyter; extra == "tutorials"
46
+ Requires-Dist: matplotlib; extra == "tutorials"
47
+ Requires-Dist: seaborn; extra == "tutorials"
48
+ Requires-Dist: plotly; extra == "tutorials"
49
+ Provides-Extra: docs
50
+ Requires-Dist: sphinx; extra == "docs"
51
+ Requires-Dist: sphinx-rtd-theme; extra == "docs"
52
+ Dynamic: license-file
53
+
54
+ # Jump-Diffusion Parameter Estimation
55
+
56
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.21305522.svg)](https://doi.org/10.5281/zenodo.21305522)
57
+
58
+ A comprehensive Python library for simulating and estimating parameters of jump-diffusion processes with asymmetric jump distributions.
59
+
60
+ ## 🚀 Features
61
+
62
+ - **Flexible Simulation**: Generate jump-diffusion paths with customizable parameters
63
+ - **Maximum Likelihood Estimation**: Robust parameter estimation using mixture distributions
64
+ - **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
65
+ - **Goodness-of-Fit Comparison**: Rank candidate jump distributions on the same data via AIC/BIC and a simulation-based Kolmogorov-Smirnov test
66
+ - **Validation Tools**: Monte Carlo experiments for method validation
67
+ - **Extensible Architecture**: Easy to add new models, jump distributions, and estimation methods
68
+ - **Educational Focus**: Comprehensive documentation and tutorials
69
+
70
+ ## 📊 Model
71
+
72
+ Our implementation focuses on jump-diffusion processes of the form:
73
+
74
+ ```
75
+ dX_t = μ dt + σ dW_t + J_t dN_t
76
+ ```
77
+
78
+ Where:
79
+ - `μ`: drift parameter
80
+ - `σ`: diffusion volatility
81
+ - `W_t`: Brownian motion
82
+ - `J_t`: jump sizes (asymmetrically distributed)
83
+ - `N_t`: jump arrival times (Bernoulli approximation)
84
+
85
+ ## 🛠️ Installation
86
+
87
+ ```bash
88
+ # Clone the repository
89
+ git clone https://github.com/jdospina/jump-diffusion-estimation.git
90
+ cd jump-diffusion-estimation
91
+
92
+ # Install the package
93
+ pip install -e .
94
+
95
+ # Or install from PyPI (when available)
96
+ pip install jump-diffusion-estimation
97
+ ```
98
+
99
+ ## 🎯 Quick Start
100
+
101
+ ```python
102
+ import numpy as np
103
+ from jump_diffusion import JumpDiffusionSimulator, JumpDiffusionEstimator
104
+
105
+ # Create simulator
106
+ simulator = JumpDiffusionSimulator(
107
+ mu=0.05, # 5% annual drift
108
+ sigma=0.2, # 20% annual volatility
109
+ jump_prob=0.1, # 10% jump probability per period
110
+ jump_scale=0.15, # jump magnitude scale
111
+ jump_skew=2.0 # positive skewness
112
+ )
113
+
114
+ # Simulate a path
115
+ times, path, jumps = simulator.simulate_path(T=1.0, n_steps=252)
116
+
117
+ # Estimate parameters
118
+ increments = np.diff(path)
119
+ dt = times[1] - times[0]
120
+ estimator = JumpDiffusionEstimator(increments, dt)
121
+ results = estimator.estimate()
122
+
123
+ print(f"Estimated drift: {results['parameters']['mu']:.4f}")
124
+ print(f"Estimated volatility: {results['parameters']['sigma']:.4f}")
125
+ ```
126
+
127
+ ### Using a different jump distribution
128
+
129
+ Jumps follow a skew-normal distribution by default. Other distributions can be plugged in via `jump_distribution`, both when simulating and when estimating:
130
+
131
+ ```python
132
+ from jump_diffusion.distributions import SGEDJump
133
+
134
+ simulator = JumpDiffusionSimulator(
135
+ mu=0.05, sigma=0.2, jump_prob=0.1,
136
+ jump_distribution=SGEDJump(),
137
+ jump_loc=0.0, jump_scale=0.15, jump_nu=1.5, jump_xi=2.0,
138
+ )
139
+ times, path, jumps = simulator.simulate_path(T=1.0, n_steps=252)
140
+
141
+ increments = np.diff(path)
142
+ dt = times[1] - times[0]
143
+ estimator = JumpDiffusionEstimator(increments, dt, jump_distribution=SGEDJump())
144
+ results = estimator.estimate()
145
+ ```
146
+
147
+ 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`.
148
+
149
+ ### Robust estimation with differential evolution
150
+
151
+ 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:
152
+
153
+ ```python
154
+ results = estimator.estimate(method="differential_evolution", seed=42)
155
+ ```
156
+
157
+ 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).
158
+
159
+ ### Standard errors via Likelihood Profiling
160
+
161
+ 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:
162
+
163
+ ```python
164
+ # Compute standard errors and confidence intervals using a Wilks' theorem threshold
165
+ se_results = estimator.estimate_standard_errors(n_points=5, confidence_level=0.95)
166
+
167
+ # The results table now includes standard errors and CI bounds
168
+ estimator.diagnostics()
169
+
170
+ # Visualize the profile log-likelihood curves
171
+ estimator.plot_profiles()
172
+ ```
173
+
174
+ ### Comparing jump distributions
175
+
176
+ `JumpDistributionComparison` fits several candidate jump distributions to the same data and ranks them by AIC/BIC plus a simulation-based Kolmogorov-Smirnov test:
177
+
178
+ ```python
179
+ from jump_diffusion.distributions import NormalJump, SGEDJump, SkewNormalJump
180
+ from jump_diffusion.validation import JumpDistributionComparison
181
+
182
+ comparison = JumpDistributionComparison(increments, dt)
183
+ comparison.fit("Normal", NormalJump())
184
+ comparison.fit("SkewNormal", SkewNormalJump())
185
+ comparison.fit("SGED", SGEDJump())
186
+
187
+ print(comparison.compare()) # ranked by AIC, includes KS statistic/p-value
188
+ comparison.plot_comparison()
189
+ ```
190
+
191
+ ## 📚 Examples
192
+
193
+ Ready-to-run scripts are available in the `examples/` directory:
194
+
195
+ - **[tutorial_completo.ipynb](notebooks/tutorial_completo.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/jdospina/jump-diffusion-estimation/blob/main/notebooks/tutorial_completo.ipynb) (español) · [tutorial_completo_en.ipynb](notebooks/tutorial_completo_en.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/jdospina/jump-diffusion-estimation/blob/main/notebooks/tutorial_completo_en.ipynb) (English) – the canonical, end-to-end tutorial: simulate, estimate (L-BFGS-B and Differential Evolution), quantify uncertainty via all three inference routes (profile / Wald / bootstrap), test for jumps, and compare jump distributions. Start here.**
196
+ - [basic_usage.py](examples/basic_usage.py) – demonstrates basic library usage
197
+ - [validation_experiment.py](examples/validation_experiment.py) – runs Monte Carlo validation experiments
198
+ - [jump_diffusion_playground.ipynb](notebooks/jump_diffusion_playground.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/jdospina/jump-diffusion-estimation/blob/main/notebooks/jump_diffusion_playground.ipynb) – interactive playground: pick a jump distribution (Normal, Skew-Normal, SGED, Kou, Student-t), simulate, and try the "guess the parameters" game
199
+ - [differential_evolution_showcase.ipynb](notebooks/differential_evolution_showcase.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/jdospina/jump-diffusion-estimation/blob/main/notebooks/differential_evolution_showcase.ipynb) – showcases the power of Differential Evolution (DE) compared to L-BFGS-B on the multimodal mixture likelihood of the SGED jump-diffusion model
200
+ - [sp500_jump_diffusion_example.ipynb](notebooks/sp500_jump_diffusion_example.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/jdospina/jump-diffusion-estimation/blob/main/notebooks/sp500_jump_diffusion_example.ipynb) – applies the model to real S&P 500 data: parameter estimation, simulated-vs-real comparison, and ranking all five jump distributions by AIC/BIC/KS
201
+
202
+ 🌐 **Language / Idioma:** every notebook has an English counterpart with the `_en` suffix — [`jump_diffusion_playground_en.ipynb`](notebooks/jump_diffusion_playground_en.ipynb), [`differential_evolution_showcase_en.ipynb`](notebooks/differential_evolution_showcase_en.ipynb), [`sp500_jump_diffusion_example_en.ipynb`](notebooks/sp500_jump_diffusion_example_en.ipynb). Cada notebook tiene su versión en español (sin sufijo).
203
+
204
+ ### Notebook setup
205
+
206
+ Install optional dependencies and launch Jupyter to explore the notebook:
207
+
208
+ ```bash
209
+ pip install notebook ipywidgets matplotlib
210
+ jupyter notebook
211
+ ```
212
+
213
+ ## 📖 Referencias Académicas
214
+
215
+ Los métodos numéricos y modelos estadísticos implementados en esta librería están fundamentados en la siguiente literatura:
216
+
217
+ 1. **Calibración con Evolución Diferencial y SGED:**
218
+ - Ospina Arango, J. D. (2009). *Tesis de Maestría*. Universidad Nacional de Colombia. (Fundamentos de la aplicación de SGED y Evolución Diferencial a procesos de Salto-Difusión).
219
+ - Ardia, D., Ospina, J. D., & Giraldo, N. D. (2011). *Jump-diffusion calibration using differential evolution.* Wilmott, 2011(55), 76-79.
220
+ - 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.
221
+
222
+ 2. **Modelos de Salto-Difusión y Distribuciones:**
223
+ - Merton, R. C. (1976). *Option pricing when underlying stock returns are discontinuous.* Journal of financial economics, 3(1-2), 125-144.
224
+ - Theodossiou, P. (2015). *Skewed Generalized Error Distribution of Financial Assets and Option Pricing.* Multinational Finance Journal, 19(4), 223-266.
225
+
226
+ 3. **Inferencia Estadística (Perfilado de Verosimilitud):**
227
+ - 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.
228
+
229
+ ## 🤝 Contributing
230
+
231
+ We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.
232
+
233
+ ## 📄 License
234
+
235
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
236
+
237
+ ## 🙏 Acknowledgments
238
+
239
+ - Inspired by classical jump-diffusion literature
240
+ - Built with love for the quantitative finance community
241
+ - Special thanks to contributors and users
@@ -0,0 +1,188 @@
1
+ # Jump-Diffusion Parameter Estimation
2
+
3
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.21305522.svg)](https://doi.org/10.5281/zenodo.21305522)
4
+
5
+ A comprehensive Python library for simulating and estimating parameters of jump-diffusion processes with asymmetric jump distributions.
6
+
7
+ ## 🚀 Features
8
+
9
+ - **Flexible Simulation**: Generate jump-diffusion paths with customizable parameters
10
+ - **Maximum Likelihood Estimation**: Robust parameter estimation using mixture distributions
11
+ - **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
12
+ - **Goodness-of-Fit Comparison**: Rank candidate jump distributions on the same data via AIC/BIC and a simulation-based Kolmogorov-Smirnov test
13
+ - **Validation Tools**: Monte Carlo experiments for method validation
14
+ - **Extensible Architecture**: Easy to add new models, jump distributions, and estimation methods
15
+ - **Educational Focus**: Comprehensive documentation and tutorials
16
+
17
+ ## 📊 Model
18
+
19
+ Our implementation focuses on jump-diffusion processes of the form:
20
+
21
+ ```
22
+ dX_t = μ dt + σ dW_t + J_t dN_t
23
+ ```
24
+
25
+ Where:
26
+ - `μ`: drift parameter
27
+ - `σ`: diffusion volatility
28
+ - `W_t`: Brownian motion
29
+ - `J_t`: jump sizes (asymmetrically distributed)
30
+ - `N_t`: jump arrival times (Bernoulli approximation)
31
+
32
+ ## 🛠️ Installation
33
+
34
+ ```bash
35
+ # Clone the repository
36
+ git clone https://github.com/jdospina/jump-diffusion-estimation.git
37
+ cd jump-diffusion-estimation
38
+
39
+ # Install the package
40
+ pip install -e .
41
+
42
+ # Or install from PyPI (when available)
43
+ pip install jump-diffusion-estimation
44
+ ```
45
+
46
+ ## 🎯 Quick Start
47
+
48
+ ```python
49
+ import numpy as np
50
+ from jump_diffusion import JumpDiffusionSimulator, JumpDiffusionEstimator
51
+
52
+ # Create simulator
53
+ simulator = JumpDiffusionSimulator(
54
+ mu=0.05, # 5% annual drift
55
+ sigma=0.2, # 20% annual volatility
56
+ jump_prob=0.1, # 10% jump probability per period
57
+ jump_scale=0.15, # jump magnitude scale
58
+ jump_skew=2.0 # positive skewness
59
+ )
60
+
61
+ # Simulate a path
62
+ times, path, jumps = simulator.simulate_path(T=1.0, n_steps=252)
63
+
64
+ # Estimate parameters
65
+ increments = np.diff(path)
66
+ dt = times[1] - times[0]
67
+ estimator = JumpDiffusionEstimator(increments, dt)
68
+ results = estimator.estimate()
69
+
70
+ print(f"Estimated drift: {results['parameters']['mu']:.4f}")
71
+ print(f"Estimated volatility: {results['parameters']['sigma']:.4f}")
72
+ ```
73
+
74
+ ### Using a different jump distribution
75
+
76
+ Jumps follow a skew-normal distribution by default. Other distributions can be plugged in via `jump_distribution`, both when simulating and when estimating:
77
+
78
+ ```python
79
+ from jump_diffusion.distributions import SGEDJump
80
+
81
+ simulator = JumpDiffusionSimulator(
82
+ mu=0.05, sigma=0.2, jump_prob=0.1,
83
+ jump_distribution=SGEDJump(),
84
+ jump_loc=0.0, jump_scale=0.15, jump_nu=1.5, jump_xi=2.0,
85
+ )
86
+ times, path, jumps = simulator.simulate_path(T=1.0, n_steps=252)
87
+
88
+ increments = np.diff(path)
89
+ dt = times[1] - times[0]
90
+ estimator = JumpDiffusionEstimator(increments, dt, jump_distribution=SGEDJump())
91
+ results = estimator.estimate()
92
+ ```
93
+
94
+ 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`.
95
+
96
+ ### Robust estimation with differential evolution
97
+
98
+ 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:
99
+
100
+ ```python
101
+ results = estimator.estimate(method="differential_evolution", seed=42)
102
+ ```
103
+
104
+ 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).
105
+
106
+ ### Standard errors via Likelihood Profiling
107
+
108
+ 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:
109
+
110
+ ```python
111
+ # Compute standard errors and confidence intervals using a Wilks' theorem threshold
112
+ se_results = estimator.estimate_standard_errors(n_points=5, confidence_level=0.95)
113
+
114
+ # The results table now includes standard errors and CI bounds
115
+ estimator.diagnostics()
116
+
117
+ # Visualize the profile log-likelihood curves
118
+ estimator.plot_profiles()
119
+ ```
120
+
121
+ ### Comparing jump distributions
122
+
123
+ `JumpDistributionComparison` fits several candidate jump distributions to the same data and ranks them by AIC/BIC plus a simulation-based Kolmogorov-Smirnov test:
124
+
125
+ ```python
126
+ from jump_diffusion.distributions import NormalJump, SGEDJump, SkewNormalJump
127
+ from jump_diffusion.validation import JumpDistributionComparison
128
+
129
+ comparison = JumpDistributionComparison(increments, dt)
130
+ comparison.fit("Normal", NormalJump())
131
+ comparison.fit("SkewNormal", SkewNormalJump())
132
+ comparison.fit("SGED", SGEDJump())
133
+
134
+ print(comparison.compare()) # ranked by AIC, includes KS statistic/p-value
135
+ comparison.plot_comparison()
136
+ ```
137
+
138
+ ## 📚 Examples
139
+
140
+ Ready-to-run scripts are available in the `examples/` directory:
141
+
142
+ - **[tutorial_completo.ipynb](notebooks/tutorial_completo.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/jdospina/jump-diffusion-estimation/blob/main/notebooks/tutorial_completo.ipynb) (español) · [tutorial_completo_en.ipynb](notebooks/tutorial_completo_en.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/jdospina/jump-diffusion-estimation/blob/main/notebooks/tutorial_completo_en.ipynb) (English) – the canonical, end-to-end tutorial: simulate, estimate (L-BFGS-B and Differential Evolution), quantify uncertainty via all three inference routes (profile / Wald / bootstrap), test for jumps, and compare jump distributions. Start here.**
143
+ - [basic_usage.py](examples/basic_usage.py) – demonstrates basic library usage
144
+ - [validation_experiment.py](examples/validation_experiment.py) – runs Monte Carlo validation experiments
145
+ - [jump_diffusion_playground.ipynb](notebooks/jump_diffusion_playground.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/jdospina/jump-diffusion-estimation/blob/main/notebooks/jump_diffusion_playground.ipynb) – interactive playground: pick a jump distribution (Normal, Skew-Normal, SGED, Kou, Student-t), simulate, and try the "guess the parameters" game
146
+ - [differential_evolution_showcase.ipynb](notebooks/differential_evolution_showcase.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/jdospina/jump-diffusion-estimation/blob/main/notebooks/differential_evolution_showcase.ipynb) – showcases the power of Differential Evolution (DE) compared to L-BFGS-B on the multimodal mixture likelihood of the SGED jump-diffusion model
147
+ - [sp500_jump_diffusion_example.ipynb](notebooks/sp500_jump_diffusion_example.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/jdospina/jump-diffusion-estimation/blob/main/notebooks/sp500_jump_diffusion_example.ipynb) – applies the model to real S&P 500 data: parameter estimation, simulated-vs-real comparison, and ranking all five jump distributions by AIC/BIC/KS
148
+
149
+ 🌐 **Language / Idioma:** every notebook has an English counterpart with the `_en` suffix — [`jump_diffusion_playground_en.ipynb`](notebooks/jump_diffusion_playground_en.ipynb), [`differential_evolution_showcase_en.ipynb`](notebooks/differential_evolution_showcase_en.ipynb), [`sp500_jump_diffusion_example_en.ipynb`](notebooks/sp500_jump_diffusion_example_en.ipynb). Cada notebook tiene su versión en español (sin sufijo).
150
+
151
+ ### Notebook setup
152
+
153
+ Install optional dependencies and launch Jupyter to explore the notebook:
154
+
155
+ ```bash
156
+ pip install notebook ipywidgets matplotlib
157
+ jupyter notebook
158
+ ```
159
+
160
+ ## 📖 Referencias Académicas
161
+
162
+ Los métodos numéricos y modelos estadísticos implementados en esta librería están fundamentados en la siguiente literatura:
163
+
164
+ 1. **Calibración con Evolución Diferencial y SGED:**
165
+ - Ospina Arango, J. D. (2009). *Tesis de Maestría*. Universidad Nacional de Colombia. (Fundamentos de la aplicación de SGED y Evolución Diferencial a procesos de Salto-Difusión).
166
+ - Ardia, D., Ospina, J. D., & Giraldo, N. D. (2011). *Jump-diffusion calibration using differential evolution.* Wilmott, 2011(55), 76-79.
167
+ - 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.
168
+
169
+ 2. **Modelos de Salto-Difusión y Distribuciones:**
170
+ - Merton, R. C. (1976). *Option pricing when underlying stock returns are discontinuous.* Journal of financial economics, 3(1-2), 125-144.
171
+ - Theodossiou, P. (2015). *Skewed Generalized Error Distribution of Financial Assets and Option Pricing.* Multinational Finance Journal, 19(4), 223-266.
172
+
173
+ 3. **Inferencia Estadística (Perfilado de Verosimilitud):**
174
+ - 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.
175
+
176
+ ## 🤝 Contributing
177
+
178
+ We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.
179
+
180
+ ## 📄 License
181
+
182
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
183
+
184
+ ## 🙏 Acknowledgments
185
+
186
+ - Inspired by classical jump-diffusion literature
187
+ - Built with love for the quantitative finance community
188
+ - Special thanks to contributors and users
@@ -0,0 +1,84 @@
1
+ [build-system]
2
+ requires = ["setuptools>=64", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "jump-diffusion-estimation"
7
+ dynamic = ["version", "dependencies"]
8
+ description = "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."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "Juan David Ospina Arango", email = "jdospina@gmail.com" },
14
+ ]
15
+ keywords = [
16
+ "jump-diffusion",
17
+ "stochastic-processes",
18
+ "maximum-likelihood",
19
+ "differential-evolution",
20
+ "profile-likelihood",
21
+ "parametric-bootstrap",
22
+ "quantitative-finance",
23
+ "parameter-estimation",
24
+ ]
25
+ classifiers = [
26
+ "Development Status :: 3 - Alpha",
27
+ "Intended Audience :: Science/Research",
28
+ "Intended Audience :: Financial and Insurance Industry",
29
+ "License :: OSI Approved :: MIT License",
30
+ "Operating System :: OS Independent",
31
+ "Programming Language :: Python :: 3",
32
+ "Programming Language :: Python :: 3.8",
33
+ "Programming Language :: Python :: 3.9",
34
+ "Programming Language :: Python :: 3.10",
35
+ "Programming Language :: Python :: 3.11",
36
+ "Topic :: Scientific/Engineering :: Mathematics",
37
+ "Topic :: Office/Business :: Financial",
38
+ ]
39
+
40
+ [project.urls]
41
+ Homepage = "https://github.com/jdospina/jump-diffusion-estimation"
42
+ "Bug Tracker" = "https://github.com/jdospina/jump-diffusion-estimation/issues"
43
+ Documentation = "https://jump-diffusion-estimation.readthedocs.io/"
44
+
45
+ [project.optional-dependencies]
46
+ dev = [
47
+ "pytest>=6.0",
48
+ "pytest-cov",
49
+ "black",
50
+ "flake8",
51
+ "mypy",
52
+ "jupyter",
53
+ "sphinx",
54
+ "sphinx-rtd-theme",
55
+ "pandas-stubs; python_version >= '3.10'",
56
+ "scipy-stubs; python_version >= '3.10'",
57
+ ]
58
+ tutorials = [
59
+ "jupyter",
60
+ "matplotlib",
61
+ "seaborn",
62
+ "plotly",
63
+ ]
64
+ docs = [
65
+ "sphinx",
66
+ "sphinx-rtd-theme",
67
+ ]
68
+
69
+ [project.scripts]
70
+ jumpdiff-validate = "jump_diffusion.scripts.validate:main"
71
+ jumpdiff-benchmark = "jump_diffusion.scripts.benchmark:main"
72
+
73
+ [tool.setuptools]
74
+ zip-safe = false
75
+
76
+ [tool.setuptools.package-dir]
77
+ "" = "src"
78
+
79
+ [tool.setuptools.packages.find]
80
+ where = ["src"]
81
+
82
+ [tool.setuptools.dynamic]
83
+ version = { attr = "jump_diffusion.__version__" }
84
+ dependencies = { file = ["requirements.txt"] }
@@ -0,0 +1,7 @@
1
+ numpy>=1.20.0
2
+ scipy>=1.7.0
3
+ matplotlib>=3.3.0
4
+ seaborn>=0.11.0
5
+ pandas>=1.3.0
6
+ scikit-learn>=1.0.0
7
+ tqdm>=4.60.0
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,40 @@
1
+ """
2
+ Jump-Diffusion Parameter Estimation Library
3
+
4
+ A comprehensive Python library for simulating and estimating parameters
5
+ of jump-diffusion processes with asymmetric jump distributions.
6
+ """
7
+
8
+ __version__ = "0.2.0"
9
+ __author__ = "Juan David OSPINA ARANGO"
10
+ __email__ = "jdospina@gmail.com"
11
+
12
+ # Core imports for easy access
13
+ from .simulation import JumpDiffusionSimulator
14
+ from .estimation import JumpDiffusionEstimator
15
+ from .models import JumpDiffusionModel
16
+ from .validation import ValidationExperiment
17
+
18
+ # Make key classes available at package level
19
+ __all__ = [
20
+ "JumpDiffusionSimulator",
21
+ "JumpDiffusionEstimator",
22
+ "JumpDiffusionModel",
23
+ "ValidationExperiment",
24
+ ]
25
+
26
+
27
+ # Version information
28
+ def get_version():
29
+ """Return the current version of the library."""
30
+ return __version__
31
+
32
+
33
+ def get_info():
34
+ """Return basic information about the library."""
35
+ return {
36
+ "name": "jump-diffusion-estimation",
37
+ "version": __version__,
38
+ "author": __author__,
39
+ "description": "Jump-Diffusion Parameter Estimation Library",
40
+ }
@@ -0,0 +1,22 @@
1
+ """
2
+ Pluggable Jump-Size Distributions
3
+
4
+ This module contains the jump-size distributions that can be plugged into
5
+ JumpDiffusionModel via its ``jump_distribution`` argument.
6
+ """
7
+
8
+ from .base import JumpDistribution
9
+ from .kou import KouJump
10
+ from .normal import NormalJump
11
+ from .sged import SGEDJump
12
+ from .skew_normal import SkewNormalJump
13
+ from .student_t import StudentTJump
14
+
15
+ __all__ = [
16
+ "JumpDistribution",
17
+ "SkewNormalJump",
18
+ "NormalJump",
19
+ "SGEDJump",
20
+ "KouJump",
21
+ "StudentTJump",
22
+ ]