# Example SDE models provided by `msde`

#### Martin Lysy, JunYong Tong, Nigel Delaney

#### 2021-12-16

This vignette contains a complete description of the sample models found in `msde::sde.examples()`.

## Heston’s stochastic volatility model

Let \(S_t\) denote the value of a financial asset at time \(t\). Heston’s stochastic volatility model (Heston 1993) is given by the pair of stochastic differential equations \[ \begin{split} \mathrm{d}S_t & = \alpha S_t\mathrm{d}t + V_t^{1/2}S_t\mathrm{d}B_{1t} \\ \mathrm{d}V_t & = -\gamma(V_t - \mu)\mathrm{d}t + \sigma V_t^{1/2} \mathrm{d}B_{2t}, \end{split} \] where \(V_t\) is a latent stochastic volatility process, and \(B_{1t}\) and \(B_{2t}\) are Brownian motions with \(\mathrm{cor}(B_{1t}, B_{2t}) = \rho\). To improve the accuracy of the numerical discretization scheme used for inference, the variables are transformed to \(X_t = \log(S_t)\) and \(Z_t = 2 V_t^{1/2}\), for which Heston’s SDE becomes \[ \begin{split} \mathrm{d}X_t & = (\alpha - \tfrac 1 8 Z_t^2)\mathrm{d}t + \tfrac 1 2 Z_t \mathrm{d}B_{1t} \\ \mathrm{d}Z_t & = (\beta/Z_t - \tfrac \gamma 2 Z_t)\mathrm{d}t + \sigma \mathrm{d}B_{2t}, \end{split} \] with \(\mathrm{cor}(B_{1t}, B_{2t}) = \rho\). Thus the diffusion function on the variance scale is \[ \boldsymbol{\Sigma}_\boldsymbol{\theta}(\boldsymbol{Y}_t) = \begin{bmatrix} \tfrac 1 4 Z_t^2 & \tfrac \sigma 2 Z_t \\ \tfrac \sigma 2 Z_t & \sigma^2 \end{bmatrix}, \] where \(\boldsymbol{Y}_t = (X_t, Z_t)\) and \(\boldsymbol{\theta}= (\alpha, \gamma, \beta, \sigma, \rho)\). The data and parameter restrictions are \(Z_t, \gamma, \sigma > 0\), \(|\rho| < 1\), and \(\beta > \tfrac 1 2 \sigma^2\), with the final restriction ensuring that \(Z_t > 0\) with probability 1. This model is contained in `sde.examples(model = "hest")`.

## Bivariate Ornstein-Uhlenbeck process

This model for \(\boldsymbol{Y}_t = (Y_{1t}, Y_{2t})\) is given by \[ \mathrm{d}\boldsymbol{Y}_t = (\boldsymbol{\Gamma}\boldsymbol{Y}_t + \boldsymbol{\Lambda})\mathrm{d}t + \boldsymbol{\Psi}\mathrm{d}\boldsymbol{B}_t, \] where \(\boldsymbol{\Gamma}\) is a \(2\times 2\) matrix, \(\boldsymbol{\Lambda}\) is a \(2 \times 1\) vector, and \(\boldsymbol{\Psi}\) is a \(2\times 2\) upper Choleski factor. The model parameters are thus \(\boldsymbol{\theta}= (\Gamma_{11}, \Gamma_{21}, \Gamma_{12}, \Gamma_{22}, \Lambda_{1}, \Lambda_2, \Psi_{11}, \Psi_{21}, \Psi_{22})\), and the model restrictions are \(\Psi_{11}, \Psi_{22} > 0\). This model is contained in `sde.examples(model = "biou")`.

## Lotka-Volterra predator-prey model

Let \(H_t\) and \(L_t\) denote the number of Hare and Lynx at time \(t\) coexisting in a given habitat. The Lotka-Volterra SDE describing the interactions between these two animal populations is given by (Golightly and Wilkinson 2010): \[ \begin{bmatrix} \mathrm{d} H_t \\ \mathrm{d} L_t \end{bmatrix} = \begin{bmatrix} \alpha H_t - \beta H_tL_t \\ \beta H_tL_t - \gamma L_t \end{bmatrix}\, \mathrm{d} t + \begin{bmatrix} \alpha H_t + \beta H_tL_t & -\beta H_tL_t \\ -\beta H_tL_t & \beta H_tL_t + \gamma L_t\end{bmatrix}^{1/2} \begin{bmatrix} \mathrm{d} B_{1t} \\ \mathrm{d} B_{2t} \end{bmatrix}. \] The data and parameters are all restricted to be positive. This model is contained in `sde.examples(model = "lotvol")`.

## Prokaryotic autoregulatory gene network model

Let \(\boldsymbol{Y}_t = (R_t, P_t, Q_t, D_t)\) denote the number of molecules at time \(t\) of four different compounds in an autoregulatory gene network: RNA (\(R\)); a functional protein (\(P\)); protein dimmers (\(Q\)); and DNA (\(D\)). Then Golightly and Wilkinson (2005) define an SDE describing the dynamics of \(\boldsymbol{Y}_t\) with drift and (variance-scale) diffusion functions \[ \begin{split} \boldsymbol{\Lambda}_\boldsymbol{\theta}(\boldsymbol{Y}_t) & = \begin{bmatrix} \gamma_3 D_t - \gamma_7 R_t \\ 2 \gamma_6 Q_t - \gamma_8P_t + \gamma_4 R_t -\gamma_5 P_t(P_t-1) \\ \gamma_2(10-D_t) - \gamma_1 D_t Q_t - \gamma_6 Q_t + \tfrac 1 2 \gamma_5 P_t(P_t-1) \\ \gamma_2(10-D_t) - \gamma_1 D_t Q_t \end{bmatrix} \\ \boldsymbol{\Sigma}_\boldsymbol{\theta}(\boldsymbol{Y}_t) & = \begin{bmatrix} \gamma_3 D_t + \gamma_7 R_t & 0 & 0 & 0 \\ 0 & \gamma_8P_t + 4\gamma_6 Q_t + \gamma_4 R_t + 2 \gamma_5 P_t(P_t-1) & -2 \gamma_6 Q_t - \gamma_5 P_t(P_t-1) & 0 \\ 0 & -2 \gamma_6 Q_t - \gamma_5 P_t(P_t-1) & A + \gamma_6 Q_t + \tfrac 1 2 \gamma_5 P_t(P_t-1) & A_t \\ 0 & 0 & A_t & A_t \end{bmatrix}, \end{split} \] where \(A_t = \gamma_1D_tQ_t + \gamma_2(10-D_t)\) and \(\boldsymbol{\theta}= (\theta_1, \ldots, \theta_8)\), \(\theta_i = \log(\gamma_i)\), are various reaction rates. The data and parameter restrictions for this model are \(\boldsymbol{\theta}\in \mathbb R^8\), \(\boldsymbol{Y}_t > 1\), and \(D_t < 10\). This model is contained in `sde.examples(model = "pgnet")`.

## References

Golightly, A. and Wilkinson, D.J., 2005. Bayesian inference for stochastic kinetic models using a diffusion approximation. Biometrics, 61 (3), 781–788.

Golightly, A. and Wilkinson, D.J., 2010. Discussion of ‘Particle Markov chain Monte Carlo methods’ by Christophe Andrieu, Arnaud Doucet, Roman Holenstein. JRSS B, 59 (2), 341–357.

Heston, S.L., 1993. A closed-form solution for options with stochastic volatility with applications to bond and currency options. The Review of Financial Studies, 6 (2), 327–343.