Skip to content
All library documents

Speeding Up Monte Carlo Calibration of Heston Models in MATLAB

Article Quant Q&A · Author: AZhu

Summary

The document discusses ways to reduce runtime when calibrating a Heston model with Monte Carlo simulations in MATLAB. The author reports using a four-core computer, 10,000 scenarios, 1,000 time steps, and `fminsearch`, with a run taking roughly half an hour to an hour. They want a faster approach that can also support alternative stochastic volatility models without convenient analytical solutions.

The answer recommends profiling first, since parallel processing can add overhead when individual calculations are small. It also suggests batching Monte Carlo draws into matrices to take advantage of MATLAB’s efficient matrix operations, and sending larger workloads to parallel workers. The discussion offers practical implementation directions rather than measured speedups or a detailed benchmark. It does not provide code, compare numerical methods, or establish how much either change improves calibration time; results will depend on the implementation and workload.

Key ideas

  • Profile the calibration workflow to find which operations dominate its runtime.
  • Parallel computing can add overhead when each task is too small.
  • Batch Monte Carlo paths into matrices to make better use of MATLAB’s matrix operations.
  • Larger tasks may be more suitable for parallel workers than many small calculations.

Tags

Full text
# Heston MC Simulations - Speed up in Matlab


# Heston MC Simulations - Speed up in Matlab












At the moment I am running a Quad Core Xeon PC with 12GB of RAM doing crude MC with 10k scenarios and 1000 time steps. And using fminsearch for calibration, and it takes about half an hour to an hour to do the work.

Now, assuming MC is the only possible way for doing so (I know there are other ways from the post here, thanks to the great people at StackExchange: Other means of calibrating Heston models), is there any way I can speed this up a little? I am already using Matlabpool open for parallel computing and I would like my code to be flexible enough so that I can still run other alternatives of the Heston model (say Chan model) which does not have an easy analytical solution.

Thanks!

## Answer by Ilya (score 1, accepted)

https://quant.stackexchange.com/a/8321

Different optimizations could help.

- Parallel computing makes even worse if each computation is fast enough due to overhead. Thus it may be better to use profiler to get what can be improved. Usually it helps to send larger problems to parallel computation cores.

- Matlab is very good at matrix operations and it could be better to treat different draws of MC as one matrix if possible. Returning to first point this multiple scenarios in one matrix can be sent for parallel computing and improve performance.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.