. Math 623 - Option pricing using Quasi Monte Carlo simulation Pratik Mehta pbmehta@eden.rutgers.edu Masters of Science in Mathematical Finance Department of Mathematics, Rutgers University This paper describes the implementation of a C++ program to calculate the value of a european style call option on an underlying asset, given input parameters for stock price (s=100), strike price (k=110),volatility (v=30%), interest rate (r=5%), maturity (T=1 year) using Quasi Monte Carlo simulation with low discrepancy Sobol sequences. We compare the results of Quasi Monti Carol method to that of the closed form solution, Monti Carlo with Park Miller and MC with antithetic sampling. The underlying stock price is assumed to follow geometric brownian motion. The program calculates the option prices using the Monte Carlo/Quasi MC method with 10,000 simulations and uses the solution to the Stochastic differential equation of the stock process [3]. I. INTRODUCTION In this assignment we are pricing a European style vanilla call option using low discrepancy Sobol sequences to generate Uniform (0,1) and then use the inverse cumulative distribution function to convert uniformly distributed variables to gaussian distribution. We use Monte Carlo simulation and the solution to the stochastic differential equation to calculate the option price at expiry and then discounting it. ds(t) = (rs(t)dt + σs(t)dw (t) (1) the solution to the above Stochastic Differential Equation is, S(T ) = S(0)e (r 1 2 σ2 )T +σw (T ) the payoff for the call option is, (2) (S(T ) k) + (3) We have modified Joshi s code from chapter 6 (RandomMain3.cpp), as was required for this assignment. II. CLOSED FORM BLACK-SCHOLES-MERTON Here, K is the strike price and S(T ) is the terminal stock price at the payoff date. The price of the underlying at terminal time,t, is given by [4] S(T ) = S(0)e (r a 1 2 σ2 )T +σw (T ) (4) A closed form solution for the price of a European Call and Put is given by [4] c(t, x) = xe at N(d + (T, x)) e rt KN(d (τ, x)) (5) and p(t, x) = e rt KN( d (T, x)) xe at N( d + (τ, x)). (6) Here, N is the Normal Cumulative Distribution density and the parameters, d + and d are given by d + = d + σ T = 1 [log σ xk (r T + + 12 ) ] σ2 T.(7) The function bsm in the file Random- Main3.cpp describes the implementation of the above closed form Black Scholes Merton model. The output is as follows, III. Closed f orm option price = 10.021 (8) MONTE CARLO WITH PARK-MILLER Park-Miller is one of the many random number generators thats are used to produce random samples for Monte Carlo simulation. It is on of the Linear Congruential Generators (LCG). It has a period of, 2 31 1 (9) The general form of a LCG generator is, x = initial seed a = multiplier m = modulus c = shift x i+1 = (ax i + c) mod m 1 (10) u i+1 = x i+1 /m 1 (11) The following are the values for the variables m = 2 31 1, a = 16807 (12)
2 Park Miller s uniform random number generator is implemented by Mark Joshi. We then pass these uniform values to inverse cumulative distribution to get normally distributed variables. We directly use it as-is. The only modification we do is that we turn off Antithetic sampling. The files ParkMiller.h and ParkMiller.cpp implements the function for the above formula as a class. The output for out call option is, MC vanilla call with P ark Miller = 10.2803 (13) IV. MONTE CARLO WITH PARK-MILLER WITH ANTITHETICS This method uses the same algorithm to generate samples. But the way we sample (number of samples independently taken) is different here. We take one sample using Park Miller and the use the negative of the same value as second sample. In this was we get the following equation S(t i+1 ) = S(t i )(1 + rτ + σ T Z i+1 ) (14) S(t i+1 ) = S(t i )(1 + rτ σ T Z i+1 ) (15) Using the above formula, we can reduce the variance of the samples.the result of Monte Carlo simulation on using the above variance reduction technique. The result of this method is, Ŷ AV = 1 + Y i n (Σni=1(Ỹi )) (16) 2 MC with P ark Miller and antithetics = 9.977 (17) V. QUASI MONTE CARLO WITH SOBOL SEQUENCE A major drawback of Monte Carlo integration with pseudo-random numbers is given by the fact that the error term scales only as 1/ N.This is inherent to methods based on random numbers.this leads to the idea to choose the points deterministically such that to minimize the integration error.low-discrepancy sequence is a sequence with the property that for all values of N, its subsequence x1,..., xn has a low discrepancy. Roughly speaking, the discrepancy of a sequence is low if the number of points in the sequence falling into an arbitrary set B is close to proportional to the measure of B, as would happen on average (but not for particular samples) in the case of a uniform distribution[5]. We now have the main theorem of quasi-monte Carlo integration: If f has bounded variation on [0, 1] d then for any x 1,..., x N [0, 1] d we have 1 N N n=1 f(x n ) dxf(x) V (f)d (x 1,..., x N ). (18) Sobol sequences [6] are obtained by first choosing a primitive polynomial over Z of degree g: P = x g + a 1 x g 1 +... + a g 1 x + 1, (19) where each a i is either 0 or 1. The coefficients a i are used in the recurrence relation v i = a 1 v i 1 a 2 v i 2... a g 1 v i g+1 v i g [v i g /2 (20) g ], where denotes the bitwise exclusive-or operation and each v i is a number which can be written as v i = m i /(2 i ) with 0 < m i < 2 i. Consequetive quasi-random numbers are then obtained from the relation x n+1 = x n v c, (21) where the index c is equal to the place of the rightmost zero-bit in the binary representation of n. For example n = 11 has the binary representation 1011 and the rightmost zero-bit is the third one. Therefore c = 3 in this case. For a primitive polynomial of degree g we also have to choose the first g values for the m i. The only restriction is that the m i are all odd and m i < 2 i. There is an alternative way of computing x n : x n = g 1 v 1 g 2 v 2... (22) where...g 3 g 2 g 1 is the Gray code representation of n. The basic property of the Gray code is that the representations for n and n + 1 differ in only one position. The Gray code representation can be obtained from the binary representation according to...g 3 g 2 g 1 =...b 3 b 2 b 1...b 4 b 3 b 2. (23) The above description of the sobol sequence generation was taken from [2].We have used Sobol sequence generator by S.Joe and R.Y.Kuo. We pass a file with the primitive polynomial and values of all the coefficient. This Sobol generator is capable of producing vary high dimensional sequences from 0 to 1. In our application we need only 1 dimensional sequence since we are evaluating a vanilla call option at expiry. We have implemented a function MCSobol in Sobol.cpp which uses sobol sequences to implement Quasi Monte Carlo simulation. The function sobolpoints returns an array with sobol sequences which are used for option price calculation. The price with this method is, QM C vanilla call with Sobol sequences = 10.007 (24) As we can see that the option price using sobol sequences and quasi monti carlo method is the closest to the closed formed solution. VI. ANALYSIS OF THE RESULTS, ADDITIONAL QUESTIONS AND PLOTS The table on the next page show the results from all four methods described above. We notice that the results
3 of all the methods are fairly accurate but using Sobol sequences gave the most accurate result. The reason why we use inverse transform instead of Marsaglia-Bray-Box- Muller is because the latter uses sines and cosines to approximate the value for the normal variable. This is time consuming which reduces the efficiency of the algorithm. Also we generated 2-dimensional plots of 1024 pairs of samples from uniform distribution over a unit square using Park-Miller generator and sobol sequences. The plots can be found on the next pages. Look at the plot one can tell that the sobol points are more uniformly distributed over a unit square than the Park-Miller points. Below are the summary statistics for 1-dimension sobol and parkmiller numbers. N umerix option price = 10.08 (31) Haug Excel option price = 10.02 (32) We used many different random number generation methods to calculate the value of European Call options using the closed form solution, Monte Carlo and Quasi Monti Carlo with Sobol sequences.we benchmarked the obtained results with the Numerix option value calculator and Haug Excel VBA calculator and found our results to be in reasonably good agreement with the value given by Numerix and the closed form solutions. Uniform dist : Mean = 0.5000 S.dev = 0.2886 (25) Sobol : Mean = 0.4995 S.dev = 0.2888 (26) P ark Miller : Mean = 0.5113 S.dev = 0.2832 (27) We can clearly see that sobol sequences are much more closer to the true uniform distribution than the ones generated by Park-Miller. VII. FURTHER DISCUSSION AND ANALYSIS For testing and debugging purposes we also compared the output of our Sobol generator (Joe s and Kuo s) to that of a lower dimensional generator. In this case we used the MATLAB code provided by Brandimarte (Get- Sobol.m) and modified it to sample 1024 points. For comparison purposes we have plotted all three of them in 1-dimension below. We also provide the summary statistics for them. Brandimater Sobol : M ean = 0.500 S.dev = 0.288(28) Joe s Sobol : Mean = 0.499 S.dev = 0.288(29) P ark Miller : Mean = 0.511 S.dev = 0.283(30) From the above summary statistics and the plot it is clear that our sobol generator has the same statistical properties as the sequence from a lower dimensional sobol generator. VIII. BENCHMARKING Numerix and the Excel spreadsheets by Haug does not provide the user the ability to produce Sobol sequences. Hence we have benchmarked our results using the closed form and monte carlo simulations in Numerix and Haug VBA sheets. Below are the option prices by both the methods. They are also presented in a tabular form with all the other 4 methods described above and implemented in C++.
4 FIG. 1: 2-D Sobol sequence, over a unit square. FIG. 2: 1-D Sobol sequence.
FIG. 4: Haug s Excel calculator 5 EuropeanCall Trade Input Deal Number Trade abc Book Book A Counterparty Bank X Y Z Trader Trader A Comment Comment here Deal Definition DealID EuropeanCall Buy (+1) Sell (-1) 1 Equity IBM Number of Options 1 Currency USD Business Center NewYork Strike 110 Equity Settlement Lag 2BD EndDate 6-Feb-2013 Pricing Model Model Selection CONSTVOL Quality 0 Valuation Date 2/6/12 Numerical Method Backward Lattice Valuation and Risk Pricer:EuroOpt 10.08 EQ Greeks:EuroOpt.Vega 0.40 EQ Greeks:EuroOpt.Delta 0.50 EQ Greeks:EuroOpt.Rho 0.00 EQ Greeks:EuroOpt.Gamma 0.01 Hyperlinks Skip Risk Reports Deal Object Nx_D_EuropeanCall_Deal_Object EQ Greeks FALSE Data Nx_D_EuropeanCall_Data Events Nx_D_EuropeanCall_Events Indices Nx_D_EuropeanCall_Indices Prices Nx_D_EuropeanCall_Prices Reports Nx_D_EuropeanCall_Reports Script Nx_D_EuropeanCall_Script FIG. 3: Numerix calculator. 1.Generalized BSM The generalized Black-Scholes-Merton option pricing formula Implementation By Espen Gaarder Haug Copyright 2006 Time in : Years Long Call Asset price ( S ) 100.00 Strike price ( X ) 110.00 Time to maturity ( T ) 1.0000 Risk-free rate ( r ) 5.00% Continuous Cost of carry ( b ) 5.00% Continuous Volatility ( σ ) 30.00% Forward Price 105.1271 Option Value 10.0201 ON By Espen Gaarder Haug
6 TABLE I: European Call pricing using different uniform generators for S(0)=100 and K=110 Option Closed Form Park-Miller Park-Miller with Antithetics Sobol sequence Numerix Haug European Call 10.021 10.28 9.977 10.007 10.08 10.02 TABLE II: Summary Stastistics for all three methods Stats Low-dimension Sobol Joe and Kuo ss obol Park-Miller uniforms Mean 0.4995 0.4995 0.5113 Standard Deviation 0.2882 0.2882 0.2836
[1] wwwthep.physik.uni-mainz.de/ stefanw/download/lecture [2] M.S. Joshi, C++ design Patterns and Derivative Pricing, (Wiley 2008). [3] S.E. Shreve, Stochastic Calculus for Finance II Continuous Time Models, (Springer, 2004). [4] Wikipedia page for low discrepancy sequence [5] I M Sobol, USSR comp. Math 7