Choosing R Optimization Methods for Pricing Model Calibration
Summary
This document explains how to calibrate a pricing model by selecting parameters that bring model prices close to observed market prices, using an error measure such as mean absolute error or root mean square error. It discusses choosing an optimization algorithm based on the objective function and constraints, and suggests that gradient-based methods with multiple starting points can work when the model behaves suitably near candidate solutions.
The answer highlights that calibration repeatedly reprices instruments, so the speed of the pricing routine can matter more than the optimizer itself. It recommends efficient, low-overhead pricing calculations and reusing shared computations across instruments. Differential Evolution is offered as a robust option, with vectorized objective evaluation as a possible speed improvement. No package comparison or benchmark is provided, and the best algorithm remains model-dependent, so practical experiments are needed.
Key ideas
- Calibration minimizes a chosen error between model prices and observed prices.
- Algorithm choice depends on the objective function, constraints, and local behavior of the model.
- Multiple starting values can help gradient-based methods find useful solutions.
- Pricing speed and reuse of shared computations can strongly affect calibration runtime.
- Differential Evolution and vectorized objective evaluation are suggested as practical approaches.
Tags
Full text
# R packages for calibration (optimization/minimization) of pricing models # R packages for calibration (optimization/minimization) of pricing models Let us assume we have observed market prices and try to find (multiple) model parameters in such a way that the model prices are close to the actual prices, i.e. to minimize the difference between the model and the observed prices, quantified e.g. by the mean absolute error or the root-mean-square error. Along the way, there are various functions that need to be considered to determine the price, and in the end, we calculate the measure of choice. What are useful packages in R for this type of optimization/minimization problems? In particular, I look for general packages that are not tied to a specific product, e.g. options. ## Answer by Enrico Schumann (score 2) https://quant.stackexchange.com/a/59388 R gives you access to a large number of optimization algorithms; see the Optimization Task View for a (probably incomplete) list. What algorithm is appropriate will depend on your model, i.e. the objective function and the constraints. If your model is sufficiently well-behaved at least locally, even a standard gradient-based method, restarted from different initial values, may work well. (See A Note on 'Good' Starting Values for an example; disclosure: I am one of the authors.) Eventually, the only way to find out is to run experiments. How fast the optimization algorithm runs will primarily depend on how fast your pricing algorithms are. Calibration means repeatedly valuing your trades/instruments with different parameter values, and so any split second you can shave off your objective function will help. That implies that you usually do not want to use "convenient", high-level functions with lots of error-handling and so on; instead, go for bare-bones pricing routines. Also, you'll typically not calibrate a single instrument, but several. Pricing an array of instruments can often be sped up by caching and reusing parts of the computation. Differential Evolution, as suggested by @LisaAnn in the comments, is in my experience a robust method for such models. It evolves several solutions at once. If the implementation allows it, you can often gain speed by vectorizing your computations, e.g. by evaluating the objective function for all solutions at once (see Vectorised objective functions for examples).
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.