jump-diffusion-estimation 0.2.0__py3-none-any.whl

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.
@@ -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,29 @@
1
+ jump_diffusion/__init__.py,sha256=E_wGyZb1jQBt8Bc7ykp3hQw-o3y7aAdxd8F_gBD7Fh0,1057
2
+ jump_diffusion/distributions/__init__.py,sha256=RXXJsSuiFbVj8JCmLopv3uX7quv-uHK0ztc-Zx73q8I,501
3
+ jump_diffusion/distributions/base.py,sha256=NtAY2nYAX_uNbku6sgkz0Rd9-yOSScLmPwf2a5zZheA,5750
4
+ jump_diffusion/distributions/kou.py,sha256=a2OFcxBC0lm0zijc2iLY0ujatlO0VSAJQ3q9Q7fixCw,3896
5
+ jump_diffusion/distributions/normal.py,sha256=AMBAFmdbKPUphQnJCQ0ir-xMDIzY8eRcYP_YvZAkj3g,2119
6
+ jump_diffusion/distributions/sged.py,sha256=UZPYX4_u901QPMHAXv7f19UDcR_48KrTuqjK7gT9Mto,3949
7
+ jump_diffusion/distributions/skew_normal.py,sha256=xAnQbPw2hfh2ELfX1e_ey_lm-b2tAJmjKEdBP_GluYI,3044
8
+ jump_diffusion/distributions/student_t.py,sha256=tkca7XFrEsU_IEmy-QhMm9kihuyYlIuzJpSb-T1-HdE,2727
9
+ jump_diffusion/estimation/__init__.py,sha256=IIKjIMnFFdTi4MnYTmltaMBN3tjtFGM-uxVyO5t19Fw,502
10
+ jump_diffusion/estimation/base_estimator.py,sha256=HhcyzpKAuswXvsfMcRun5Ceg6hBXMEP2SEXw_u1tWPE,1412
11
+ jump_diffusion/estimation/maximum_likelihood.py,sha256=e1E9cQz6eLZGVHTbTWcNo_gcFVjgaS3mdFhprQk-NFI,50048
12
+ jump_diffusion/models/__init__.py,sha256=VKM-u4icKvUlewXswfMJMM87umWwPPnyrGRKpMxQySc,294
13
+ jump_diffusion/models/base_model.py,sha256=6TSRcfUGIYLckaT-IR_gYSkt60RbTky_ZjI73TPOZSs,2253
14
+ jump_diffusion/models/jump_diffusion.py,sha256=8FHJMEjGRfGS8BTukFalGrm_XwvbqAhzzolyoVWxvxY,5404
15
+ jump_diffusion/scripts/__init__.py,sha256=Mp7GHPmlTv4ZlALlk54yusZFasvthZ9b6swupTlt9SI,90
16
+ jump_diffusion/scripts/benchmark.py,sha256=exGXAWMv7o65Me8EVByj54e5StjTSQAb1Eldf9SiCdk,236
17
+ jump_diffusion/scripts/validate.py,sha256=KOypZd2iQJqNCJwYJpGPC0h0SeLiFrlWoFtufp6G1m0,1992
18
+ jump_diffusion/simulation/__init__.py,sha256=2OKJwsrg4vzSuigBRqyYMIBUiEExk4gvH9Ij5WvPuZw,358
19
+ jump_diffusion/simulation/base_simulator.py,sha256=i9fnDveAi5gcJ5bUzbzOP4JITO72EX6RHQ9N-Nbqo38,1059
20
+ jump_diffusion/simulation/jump_diffusion_simulator.py,sha256=BfPN6oDexyjBZ8Jewzqj2exNknj556BmAAUzrRtGhyQ,8872
21
+ jump_diffusion/validation/__init__.py,sha256=WLC5GgcBDWxtMxf05oOJ6P7Vm8PPwhW9egvLKVnMzbU,341
22
+ jump_diffusion/validation/distribution_comparison.py,sha256=U_4LWqRemAx8JuGJSEwYXH5kL34CQ7LbY89YidRf6zk,9894
23
+ jump_diffusion/validation/monte_carlo.py,sha256=soROGlKdkJtMRFYzipCAoH1fkwPpCdQBWZe3nW3hzXs,11331
24
+ jump_diffusion_estimation-0.2.0.dist-info/licenses/LICENSE,sha256=S7sgMJD5RbKFH4hZgD9HYYE-eEwH7qhOttKO50tuPxE,1224
25
+ jump_diffusion_estimation-0.2.0.dist-info/METADATA,sha256=cdLu8ZpcOjIyyJhNveCKCPp5co8igu5B_H9XiMVCDVo,12472
26
+ jump_diffusion_estimation-0.2.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
27
+ jump_diffusion_estimation-0.2.0.dist-info/entry_points.txt,sha256=A2NPhQ5UMpwC5pYeJQ_AdFVSsHIVmqtB0WFHJiQRZfY,134
28
+ jump_diffusion_estimation-0.2.0.dist-info/top_level.txt,sha256=JLdR-Z4TRQBJbIg1S8-5_buwdYPPNu687GG9iMKUauM,15
29
+ jump_diffusion_estimation-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ jumpdiff-benchmark = jump_diffusion.scripts.benchmark:main
3
+ jumpdiff-validate = jump_diffusion.scripts.validate:main
@@ -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 @@
1
+ jump_diffusion