MLEMVD: A R Package for Maximum Likelihood Estimation of Multivariate Diffusion Models Matthew Dixon and Tao Wu 1 Illinois Institute of Technology May 19th 2017 1 https://papers.ssrn.com/sol3/papers.cfm?abstract id=2944341
Time Homogeneous Markovian Diffusions (Sahalia2002) consider the multivariate time-homogenous Markovian diffusion of the form dx t = µ(x t )dt + Σ(X t )dw t, µ(x) : R m R m, Σ(x) : R m R m m W t R m are independent Wiener processes. Key idea: The log of the transition function f X (x x 0, ) can be given in closed form under mild restrictions on the form of µ and Σ.
Time Homogeneous Markovian Diffusions We observe X t at times t 0, t 1,..., t n, where denotes the difference between observation times and is assumed independent. Under this finite data, the log-likelihood takes the form: l n (p) := n l X (, x ti x ti 1 ; p), l X := ln f X. i=1 Under a Hermite expansion of l X and application of a number of transformation we get the following compact closed form expression with K terms: l (K) X (x x 0) = m 2 ln(2π ) D v (x) + C 1 X (x x0) + K k=0 C (k) X (x x 0) k k!, D v := 1 2 ln(det[v(x)]).
Example: Geometric Brownian Motion Given an initial value X 0 = x 0, X t evolves with drift parameter µ and volatility parameter σ dx t = µx t dt + σx t dw t. The transition function takes the form f X (x t x 0, t) = 1 exp (lnx t lnx 0 (µ σ 2 /2)t) 2 2πσt 2σ 2 t The exact log likelihood function, evaluated over a uniform time series of n observations of the state variable with spacing is given by l n (p) = n i=1 l X (, x ti x ti 1 ; p) = 1 2 n i=1 (ln(2π σ2 x 2 ti ) + (ln[x ti /x ti 1 ] (µ σ2 /2) )) 2 /(σ 2 ).
Example: Heston Model The Heston model describes the evolution of the log of the stock price s t = ln S t ds t = (a + by t )dt + Y t dw Q 1 (t), (1) dy t = κ (θ Y t )dt + σ Y t dw Q 2 (t), (2) where a = r d, b = 1 2.
Heston Model A key characteristic of the model is that the Wiener processes are correlated dw Q 1 dw Q 2 = ρdt => leverage effect. There are five parameters in the model κ: mean-reversion rate θ: long-term variance σ: volatility of variance ρ: instantaneous correlation between dw Q 1 and dw Q 2 y 0 : initial variance
Likelihood function estimation: full observance State vector X t := [s t, Y t ] has a transition density function for the conditional density of X t+ = x given X t = x 0 denoted by f X (, x x 0 ; p). The log likelihood function for observations at times t 0, t 1,..., t n is given by l n (p) = 1 n n l X (, x ti x ti 1 ; p), i=1 l X (, x x 0 ; p) := ln f X (, x x 0 ; p) and is given in closed form.
Likelihood function estimation: partial observance X t := [s t ; Y t ] is partially observed and hence l n can not be directly estimated from time series data. Approximate the likelihood of the observed state vector G t := [s t ; C t ], where C t is the ATM constant maturity option price. The transition density function for the conditional density of G t+ = g given G t = g 0 is now denoted by f G (, g g 0 ; p) and the log likelihood function is given by l n (p) := 1 n n l G (, g(t i ) g(t i 1 ); p). i=1
Likelihood function estimation: partial observance G t = f (X t ; p) represents the stock and option prices Under a change of variables from G t to X t, the log of the transition density f G can be expressed in terms of f X through a Jacobian J t to give: l G (, g g 0 ; p) := ln J t (, g g 0 ; p)+l X (, f 1 (g; p) f 1 (g 0 ; p); p) Goal: Find a numerical approximation to the inverse map f 1 (G; p)
Pricing The mapping between X t and G t is given by [ s f (X t ; p) = t C(S t, Y t, K, ; p) C( ) is the Heston model option price defined above and = T t is the constant time to maturity of the option. ],
Calibration: overview Since Y t, as previously mentioned, is unobserved, we seek the inverse [ ] [ ] f 1 s (G t ; p) = t st C 1 = (S t, C t, K, ; p) Use the map from G t to X t to imply the volatility y t from the observed state vector {g t } n i=1 of underlying prices and corresponding constant maturity, ATM option prices. Find the maximum likelihood estimate p. Y t
Calibration: Step 1 Fix p and find the corresponding implied volatility y p t i y p t i = arg min c ti C(S ti, y, K, ; p). y This error function is convex and so has a unique solution independent of the initial choice of y in a simple root finding method.
Calibration: Step 2 Using (y p t i, p) we compute the Jacobian of G t w.r.t. X t and the log of transition density function l X ( ) l G (, g ti g ti 1 ; p) = lnj ti + l X (, x p t i x p t i p), x p t i := [s ti ; y p t i ] The Jacobian is the vega of the option.
Calibration: Step 3 Steps 1 and 2 are now repeated for all remaining times t i and the log likelihood function is evaluated for the combination (y p, p). The value of yt p i 1 is used to initialize the solver for the least absolute error problem.
Calibration: Step 4 A new value of p is generated and Steps 1 and 3 are repeated until the likelihood function has been maximized by a numerical solver p arg min l n (p). p F
Geometric Brownian Motion log likelihood 1750 1700 1650 1600 1550 1500 1450 1.0 0.5 0.0 0.5 1.0 log likelihood 2000 1900 1800 1700 1600 1500 0.2 0.4 0.6 0.8 1.0 param 1 param 2 Figure: The marginal log likelihood function with respect to each parameter of the geometric brownian diffusion model. The mean is represented by Parameter 1 and the volatility by Parameter 2.
Geometric Brownian Motion µ σ Actual 0.5 0.2 Estimated 0.525 0.204 Est. Std. Error 6.415 10 2 5.975 10 3 Est. Huber Sandwich Error 6.420 10 2 6.624 10 3 Error in Est. Std. Error 5.169 10 13 9.339 10 12 Error in Est. Huber Sandwich Error 4.214 10 13 7.931 10 12 Table: The correct parameters, the estimates and the standard error estimates using 500 simulated stock prices.
Geometric Brownian Motion Actual maximum log likelihood 1326.4464 Est. maximum log likelihood 1326.204 L2 Norm of Score Error 1.659 10 7 L2 Norm of Hessian Error 1.448 10 7 L2 Norm of Information matrix 1.962 10 6 Table: This table lists the numerical error in a selection of estimated values.
Figure: The marginal log likelihood function with respect to each parameter of the Heston model applied to the simulated underlying and prices. Parameters 1-4 represents ρ, κ, θ and σ. Heston Model log likelihood 6000 4000 2000 0 log likelihood 40 60 80 100 140 1.0 0.8 0.6 0.4 0.2 1 2 3 4 param 1 param 2 log likelihood 15000 10000 5000 0 0.0 0.2 0.4 0.6 0.8 1.0 log likelihood 60 80 100 120 140 0.2 0.4 0.6 0.8 1.0 param 3 param 4
Heston Model ρ κ θ σ Actual 0.8 3.0 0.2 0.25 Estimated 0.81 3.4 0.201 0.2476 Std. Error 6.702 10 3 1.092 1.496 10 3 4.687 10 2 Huber Sandwich Error 4.903 10 4 9.311 10 1 1.117 10 2 3.356 10 2 Table: The correct parameters, the estimates and the lower bounds on the standard error using 50 simulated observations of the stock and the ATM option price.
Heston Model abs price.model price.sim [2017 01 01/2017 12 10] Last 0.000486872616368927 0.004 0.003 0.002 0.001 0.000 Jan 01 Feb 05 2017 2017 Apr 02 May 07 2017 2017 Jul 02 Aug 06 2017 2017 Oct 01 Nov 05 Dec 10 2017 2017 2017 Figure: The absolute error in the calibrated model prices versus the simulated prices.
Heston Model abs vol.sim vol.model [2017 01 01/2017 12 10] Last 0.00122376798258172 0.0040 0.0035 0.0030 0.0025 0.0020 0.0015 Jan 01 Feb 05 2017 2017 Apr 02 May 07 2017 2017 Jul 02 Aug 06 2017 2017 Oct 01 Nov 05 Dec 10 2017 2017 2017 Figure: The absolute error in the implied volatilities versus the simulated volatilities.
MLEMVD Package Installation library("devtools") install_github("mfrdixon/mlemvd")
MLEVMD Univariate Models Model µ σ constraints U1 x(a + bx) σx 3/2 U2 a + bx dx U3 b(a x) cx d U4 κ(α x) σx 1/2 U5 3 i=0 θ ix i γx ρ ρ 1 U6 a + bx + cx 2 + dx 3 f U7 κ(α x) σ a U8 1 x + a 0 + a 1 x + a 2 x 2 σx p ρ 1 a U9 1 x + a 0 + a 1 x + a 2 x 2 (b 0 + b 1 x + b 2 x b3 ) 1/2 a U10 1 x + a 0 + a 1 x + a 2 x 2 b 0 + b 1 x + b 2 x b3 ρ 1 U11 a + bx f + dx β U12 x αx 3 γx 1/2 a U13 1 x + a 0 + a 1 x + a 2 x 2 + a 3 x 3 σx ρ ρ 1 Table: The specification of various univariate diffusion models currently supported by the package.
MLEMVD Bivariate Models Model µ(x1, x2) Σ(x1, x2) constraints ( ) ( ) a + bx2 ρ (x2) B1 0 c + dx2 ( ) ( h (1 ρ 2 )x2 ) a0 + a1x1 + a2x2 c0 + c1x1 + c2x2 0 B2 b0 + b1x1 + b2x2 0 d0 + d1x1 + d2x2 ( ) ( ) µ x2/2 x2 0 B3 α + βx2 σρx γ 2 σ 1 ρ 2 x γ 2 ( ) ( a0 + a1x2 B4 b(a x2) + λgx β 1 ρ 2 a + f (x2 a) ρ ) a + f (x2 a) 2 a + f (x2 a) 0 gx β 2 ( ) ( ) bx1 hx1 x2 0 B5 c dx2 gρ x2 g 1 ρ 2 x2 ( ) ( ) m x2/2 x2 0 B6 a bx2 σ 1 ρ 2 x2 σρ 2a > σ 2 x2 ( ) ( ) 0 2x1 B7 γ 2ηx1 x2 γ a1 a2x2 2 x2 0 ( ) ( a + bx1 dx γ ) B8 1 ex2 0 ( cx2 ) ( 0 f a + bx1 dx γ ) B9 1 ex2 0 ( cx2 ) ( 0 f ) B10 b1(a1 x1) g1 0 b2(a2 x2) 0 g2 x2 ( ) ( k1 + k2x2 1 ρ 2 x2 ρ ) x2 B11 κ(θ x2) 0 σx2 ( ) ( ) ax1 cx1e x2 0 B12 bx2 dr d ( ) ( 1 ) r 2 B13 b11(a1 x1) + b12(a2 x2) σ11 σ12 b21(a1( x1) + b22(a2 ) x2) ( σ21 σ22 ) B14 k1(x2 x1) σ x1 0 ( k2(θ x2) ) ( 0 σ2 x2 ) a + bx1 x1 0 B15 ( fx1 + dx2 ) ( h 1 + gx1 ) a + bx1 + gx2 x1 0 B16 d + ηx1 + fx2 h x2