Document Sample

International Conference on Computer Systems and Technologies - CompSysTech’08 Implementation of Monte Carlo simulation in a distributed computing environment Ivaylo Penev Abstract: The paper presents an approach for achieving better performance of Monte Carlo simulation by implementing the process in a distributed computing environment. The simulation process is analyzed and sub processes, suitable for parallel execution are defined. The proposed approach is demonstrated by applying Monte Carlo simulation for evaluating the market risk of a financial position in an experimental distributed computing environment. Comparison data, obtained by carrying out the same simulation in an environment with one computer and in distributed environment, are presented and analyzed. Key words: Monte Carlo Simulation, High Throughput Computing, Distributed Computing Environment. I. INTRODUCTION Simulation refers to any analytical method meant to imitate a real-life system, especially when other analyses are mathematically complex or difficult to reproduce. Statistical simulation methods may be contrasted to conventional numerical discretization methods, which are typically applied to ordinary or partial differential equations that describe some underlying physical or mathematical system. One of the most often simulation methods used is the Monte Carlo method. In many applications of Monte Carlo, the processes are directly simulated, without need to even write down the differential equations, describing the behavior of the system. The method utilizes randomly generated, correlated values. The input of the physical (or mathematical) system has to be described by probability density functions (pdf's). Once the pdf's are known, the Monte Carlo simulation can proceed by random sampling from the functions. Many simulations are then performed (multiple “trials” or “histories”) and the desired result is taken as an average over the number of observations (which may be a single observation or perhaps millions of observations) [2]. Due to the great number of simulation trials performed, the jobs implementing Monte Carlo are compute intensive and require lots of computing power. An area where the Monte Carlo is widely applied is Market Risk Evaluation. The paper presents an approach for more effective implementation of Market Risk Evaluation of a financial position. First, the evaluation methodology is described in brief. Second, the whole simulation process is analyzed, sub processes are separated and those one are defined, which could be realized in parallel in a local computer network. Next, an experimental distributed environment in which the sub processes are tested is proposed. Finally, comparison data obtained by the implementation of the same simulation by one computer are discussed. II. AN APPROACH FOR MARKET RISK EVALUATION USING MONTE CARLO SIMULATION II.1. Evaluation Methodology [1,3] Market Risk involves the uncertainty of future earnings resulting from changes of various independent underlying assets in market environment (prices of assets, interest rates, etc.) for a certain future time (risk horizon). The market risk of a position or of a portfolio is measured by a single value, called market Value at Risk (VaR). Market VaR represents unexpected loses at adverse move and is a measure of risk based on a probability of loss and a specific time horizon in which this loss can be expected to occur. The Value at Risk calculation is defined by the RiskMetrics methodology [3]. It includes calculation of statistic parameters: mean value and standard deviation of relative changes of interest rates and net present values. The methodology is based on the - V.4-1 - International Conference on Computer Systems and Technologies - CompSysTech’08 assumption that the interest rates relative changes are normally distributed. A Monte Carlo simulation engine produces price distribution of a single financial position or of a portfolio aggregate applying numerical calculation procedures on a large set of possible market scenarios derived from statistic data for market moves from historic series. The Monte Carlo module for market risk is based on the following methodology: Fig.1 Monte Carlo Simulation 1. Volatility vector (V) and correlation matrix (R) for a set of market risk drivers such as interest rates are produced from statistic of own historic series imported from standard risk data sets. 2. The covariance matrix (C) is obtained by matrix multiplication of the volatility vector (V) by the correlation matrix (R). 3. The Cholesky matrix S is constructed from the covariance matrix (C), so that S x S’ = C, where S’ is the transposed matrix. Matrix Perturbation is used to adjust the covariance matrix to be positive definite in case the original matrix is not positive definite as a result of dependencies of the risk drivers. 4. A random generator produces independent samples for each market driver using standard normal distribution SND(0,1) stored into deviation vectors (D). A normal form correction applied to random vectors ensures normal distribution with mean = 0, standard deviation = 1. The high quality of the random series reduces the number of Monte Carlo runs, 4000 to 10000 runs are usually enough to obtain good results. 5. The deviation vectors (D) are multiplied by the Cholesky matrix (S) to take the covariance between every risk driver pair into account. This produces delta vectors (B) of normal distributed and correlated deviations. 6. The vectors (B) are applied on the actual risk driver values (interest rates) in the asset vectors (A) and this produces scenario vectors (E) for the Monte Carlo runs that compute the pricing expression value. 7. Step 6 is repeated a number of times (4000…10000). The large scenario set causes the calculation of price distributions of pricing expression. - V.4-2 - International Conference on Computer Systems and Technologies - CompSysTech’08 II.2. Analysis of the simulation process The whole process of Monte Carlo simulation could be divided into the following sub processes: 1. Preparation of scenario set. It includes construction of volatility vector, correlation matrix, covariance matrix, Cholesky matrix, generation of normally distributed relative changes of market drivers (interest rates), scenario vectors. 2. Evaluation calculations. The function producing the price of the financial position (Net Present Value – NPV) is calculated a number of times. As the function calculations are independent each other, they could be performed in parallel within the computing resources of a local network. 3. Producing the price distribution and calculating the VaR. The resulted price distribution is constructed by counting the appearance of the values within many adjacent small ranges and there after the Value at Risk is calculated by numerical integration of the distribution density using confidence percentages, for example 1% and 5%, for the upper limit of the price distribution. Each of the sub processes defined above is realized by a separate simulation step. II.3. Proposed approach and experimental environment for evaluation the market risk of a financial position The current problem is to evaluate the market risk of a financial position with two payments – one (50 currency units) after 6 months and the other (80 units) after 12 months. The interest rates for each month during one year are known. The evaluation function F, calculating the Net Present Value (NPV) of the position, is given by discounting the two payments to current date [4]: 50 80 F= + 1 + x * 0 .5 1 + y * 1 . As a tool for managing computing jobs and resources, the system Condor [5,6], developed by the University of Wisconsin-Madison is used. Users submit jobs to a pool of computers, the system Condor puts them in a queue, finds a suitable machine to run a job on and after a job finishes, the system returns the results back to the users [5]. The environment in which the simulation is implemented and tested consists of three connected computers - central manager and two executing machines. The central manager performs the following functions: - Prepares the scenarios set; - Divides the set into parts; - Submits the parts to the executing machines; - Collects the results returned by the executing machines; - Produces the price distribution in 40 numerical ranges; Machine 1 and machine 2 calculate the evaluation function with the provided scenarios independently each other. - V.4-3 - International Conference on Computer Systems and Technologies - CompSysTech’08 Fig. 2 Experimental distributed environment for testing the simulation III. TEST AND RESULTS The central manager collects the results calculated by the executing machines. There after the manager counts the appearances of the values into 40 small numerical ranges, constructs the distribution and draws the chart visualizing this distribution. Fig. 3 Chart of the NPV distribution - V.4-4 - International Conference on Computer Systems and Technologies - CompSysTech’08 The Value at Risk is calculated for two values of probability – 95% and 99%. The VaR is equal to the difference between the mean net present value and the value from the distribution ranges, responding to the relevant confidence percentage [4]. Fig. 4 Result Analysis The simulation is tested on one computer only and in the experimental environment described above. The following comparison data are obtained and analyzed: Fig. 5 Results from testing the simulation on one computer and in the proposed distributed environment The distributed simulation execution adds a new simulation step – submitting the prepared scenarios to the executing machines. The construction of the price distribution also needs additional time for collecting the calculated results. Nevertheless, the comparison data shows that the most part of the simulation time is consumed by the sub process of evaluation function calculation. This time is reduced by the distributed execution. The parallel execution of the sub process by the proposed approach accelerates the whole Monte Carlo simulation process at about 1.28 times. IV. CONCLUSIONS AND FUTURE WORK The paper presents an analysis of the Monte Carlo simulation process and proposes an approach for gaining better performance with parallel execution of independent evaluation function calculations by the computing resources of a local network. The approach is implemented and tested by evaluating the market risk of a financial position in a distributed computing environment. The results show that the approach improves the effectiveness of the process. The future work of the author will be connected to applying the approach for real simulations with complex evaluation functions in large networks, consisting of computers with outside load. The possibilities of Grid architectures for realizing distributed Monte Carlo simulations will be investigated. - V.4-5 - International Conference on Computer Systems and Technologies - CompSysTech’08 V. REFERENCES [1] Haugh, M. The Monte Carlo Framework, Examples from Finance and Generating Correlated Random Variables. Course Notes, 2004 [2] http://karmak.org/archive/2004/03/mc/node1.html: Introduction to Monte Carlo Methods [3] http://riskmetrics.com: Long Run Technical Document [4] http://www.fcg.bg/bg/education/ [5] http://www.cs.wisc.edu/condor/description.html: What is Condor? [6] Condor Project, Computer Sciences Department, University of Wisconsin- Madison, Using Condor: An Introduction, Condor Week 2007 ABOUT THE AUTHOR Ivaylo Penev, PhD student, Department of Computer Sciences and Technologies, Technical University of Varna, E-mail: ivailo.penev@tu-varna.acad.bg. - V.4-6 -

DOCUMENT INFO

Shared By:

Tags:
monte, carlo, simulation, interest

Stats:

views: | 70 |

posted: | 7/12/2009 |

language: | English |

pages: | 6 |

OTHER DOCS BY jessifer

How are you planning on using Docstoc?
BUSINESS
PERSONAL

By registering with docstoc.com you agree to our
privacy policy and
terms of service, and to receive content and offer notifications.

Docstoc is the premier online destination to start and grow small businesses. It hosts the best quality and widest selection of professional documents (over 20 million) and resources including expert videos, articles and productivity tools to make every small business better.

Search or Browse for any specific document or resource you need for your business. Or explore our curated resources for Starting a Business, Growing a Business or for Professional Development.

Feel free to Contact Us with any questions you might have.