Has anyone attempted to implement additional stochastic volatility models? I’m currently trying to implement the Heston square-root volatility model with jumps in returns. The model is described in page 61 of the paper below https://www0.gsb.columbia.edu/faculty/mjohannes/PDFpapers/JP_2006.pdf where the author describes estimation with Metropolis
This (and similar models) are widely used in finance and it would be great to be able to use NUTS for estimation
I’ll have to review your example but thanks for sharing! The paper I referenced actually includes an example of a regime switching model
The model(s) I’m trying to implement are of the following form. Stock price follows an SDE, and the volatility process also follows an SDE, where the brownian motions of each SDE are correlated. For stochastic volatility jump diffusion, the SDE also contains a jump diffusion.
I’ve made some progress implementing a log-stochastic volatility model. The model is described on page 54 in the paper I referenced in my initial comment. I’m using the AR time-series distribution to model the log volatility process
My next step is to incorporate correlation between the stochastic return process and the stochastic log-volatility process (page 56). I’m not sure how to do this in PyMC3. I’m wondering if I can replace the AR process with a MVGuassianRandomWalk
Code for log-stochastic volatility below: #Log Stochastic Volatility
import numpy as np
import matplotlib.pyplot as plt
import pymc3 as pm
I could never get the stochastic vol estimation to work for Heston, never even got to trying jumps. I couldn’t figure out how to implement the multivariate Heston SDE where the Brownian motions are correlated and the volatility process is latent. The PyMC3 interface just isn’t flexible enough to handle this type of problem, which is too bad since they are prominent in quant finance
Ah, I’m sorry to hear that. Did you switch to another interface or did you abandon the project altogether? Does e.g. STAN provide more flexibility? I would also be very interested in a model with jumps.
In which specific ways would you say the modelling interface wasn’t flexible enough to handle this standard quant finance model? If you would share some of your specific notes, it would be incredibly helpful for Pymc3’s further development, as I also believe quant finance would benefit from being able to use NUTS.
If you read my previous post you will understand the problem I was trying to solve, but I’ll generalize to speak to what features would make PyMC3 more flexible to handle a wide variety of quant finance problems
Most models in quant finance are SDEs. The problem I was trying to handle was a multivariate , correlated SDE
where one process is latent. It would be great if the time series methods were expanded to include a general, multivariate SDE, basically an extension of the single SDE class that exists. This would be great for stochastic volatility models like Heston or interest rate model like multi factor CIR or HW
I’m happy to collaborate. Fitting stochastic vol is pretty easy in PyMC3 if the return and volatility process are independent, as in the example provided in the PyMC3 documentation. When they are correlated (as in Heston or logSV) is where I couldn’t get it working. In general, fitting a multivariate SDE where one or more state variables are latent is the task. Let me know if you want to work together
I would be down to try to figure out an effective way to do this Pymc. At this point I think a SMC sampler is what is needed, so we could work with and re-purpose the non-time-series SMC sampler just recently put in place, but I am open to other suggestions. Dm me if you want to start at some point.
Thanks for sharing Chris, these are interesting examples, However I don’t see how these examples apply to this specific problem. The issue we are having is with a two dimensional SDE with correlated innovations. If the original problem were restated with independent diffusions, a solution in PyMC3 would be straightforward. The challenge is when we generalize to a correlated process
Hi @Marion2025. I am currently struggling with the same problem - estimation of a the Heston Model using MCMC and after reading all your posts here I get to the concusion it is not currently possible within PYMC3. You have written that you ended up writing your own sampler and I am thinking about doing the same, however - don’t know really where to start (I am pretty new to the whole Bayesian Inference thing). Could you possibly recommend any resources on how one can write such a sampler? Not to diverge form the topic of the discussion here, we can communicate one-to-one, if you wish. Thanks in advance!