Computing VGSA Cumulants with Symbolic or Automatic Differentiation
Summary
The note asks how to obtain the first, second, and fourth cumulants of the variance gamma with stochastic arrival model for use in Fourier-cosine option pricing. It defines the model through a characteristic function built from a variance gamma process with a CIR time change, and relates cumulants to derivatives of the cumulant generating function at zero.
Two practical approaches are described. Symbolic differentiation can produce analytic expressions without approximation error, but higher-order formulas may become lengthy and slow to implement. Automatic differentiation can compute derivatives of arbitrary order from an AD-ready implementation, including complex-valued calculations. The author favors hand-coded analytical derivatives when performance is critical and feasible, and AD for complicated or higher-order derivatives; AD can also check analytical implementations. The note does not provide explicit VGSA cumulant formulas or discuss numerical stability in detail.
Key ideas
- Cumulants can be obtained by differentiating the cumulant generating function at zero.
- Symbolic algebra can derive exact formulas, though higher-order expressions may become unwieldy.
- Automatic differentiation computes derivatives from an appropriately structured implementation.
- Analytical derivatives may be faster in production, while automatic differentiation can help with complex expressions and validation.
Tags
Full text
# Cumulants of variance gamma with stochastic arrival (VGSA) model
# Cumulants of variance gamma with stochastic arrival (VGSA) model
The characteristic function of the VGSA model is defined as a specific parameterization of the characteristic function of the CIR (Cox-Ingersol-Ross mean reverting process) time-change:
$ \mathbb{E}e^{iuY(t)} = \varphi_{VGSA}(u,t,y(0),\kappa, \eta, \lambda) = A(u,t,\kappa,\eta,\lambda)e^{B(u,t,\kappa,\lambda)y(0)} $
Where \begin{align*} A(u,t,\kappa,\eta,\lambda) &= \frac{\exp\Big( \frac{\kappa^2\eta t}{\lambda^2} \Big) }{\Big( \cosh(\gamma t/2) + \frac{\kappa}{\gamma}\sinh(\gamma t/2) \Big)^{\frac{2\kappa\eta}{\lambda^2}}}\\ B(u,t,\kappa,\lambda) &= \frac{2iu}{\kappa + \gamma\coth(\gamma t/2)}\\ \gamma &= \sqrt{\kappa^2-2\lambda^2iu} \end{align*}
The VGSA characteristic function is given by: $ \mathbb{E}e^{iuZ_{VGSA}(t)} = \varphi_{VGSA}(-i\Psi_{VG}(u), t, \nu^{-1}, \kappa, \eta, \lambda) $
Where $\Psi_{VG}(u)$ is the log characteristic function of Variance Gamma at unit time:
$ \Psi_{VG}(u) = -\frac{1}{\nu}\log(1-iu\nu\theta + \sigma^2\nu u^2/2) $
The cumulant generating function satisfies:
$ G(w) = \ln \mathbb{E}e^{wX} = \ln(\varphi_{VGSA}(-iw)) $
Its $n$-th cumulant is the $n$-th derivative of the cumulant generating function evaluated at zero: $ c_n = G^{(n)}(0) = \frac{-i\varphi_{VGSA}^{(n)}(0)}{\varphi_{VGSA}(0)} $
I need the first, second, and fourth cumulants in order to price VGSA using the Fourier-cosine method.
Does anyone have these cumulants or know if they even exist in closed form?
## Answer by LocalVolatility (score 2, accepted)
https://quant.stackexchange.com/a/31562
I recently came across the same problem, though for different asset dynamics. I usually use one of two approaches:
1) Symbolic Differentiation
Use a compute algebra system such as Mathematica or SymPy to get analytic expressions for the higher-order cumulants. The advantage is that you get exact expressions with no approximation errors. These can however get very lengthy and potentially lead to inefficient code. The fourth cumulant of the Heston model for example already spans half a page at 11pt.
2) Automatic Differentiation
Use an automatic differentiation (AD) library that supports complex numbers. In C++ for example I use CppAD from the COIN-OR project. You make your code AD-ready by templating the complex data type in your cumulant generating function implementation, i.e.
```
template<typename Type>
Type cumulantFunction(double maturity,
Type omega) const
{
// your implementation
}
```
The AD library can then compute exact derivatives of any order without you having to explicitly implement anything. See also this blog post for some more details.
Summary
I prefer to use the analytic derivatives for performance-critical production code when feasible as I found that these are usually computed faster than via AD. For higher-order derivatives and/or relatively involved expressions I resort to AD. I also found that AD serves as a great tool for unit-testing hand-coded analytical derivatives.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.