• Increase font size
  • Default font size
  • Decrease font size
Home Tutorials Monte Carlo Method

Monte Carlo Method

E-mail Print PDF
User Rating: / 173

To explain Monte Carlo simulation method, I’ll give a quick introduction/motivation of monte-carlo method, then I’ll walk through an example. I will give details the technical concepts as per need, i.e. I won’t just list down definitions/explanations all at once and then use them in an example.

What does the monte carlo method do?

Ever heard someone say: “I bet that I can reach the destination in 10 to 15 minutes”? Or have you ever heard someone say: “I am very confident that the convertable will cost between $60K to $70K”? Monte carlo simulations tries to capture the thought process that goes into generating these ranges: “10 to 15 minutes” or “$60K to $70K”.

If we think about it: the more knowledge we have in a domain, the more precise we can be in producing the range, e.g. if I have a year’s worth of experience in selling cars then I would be confident in giving out the price range: “$50K to $80K” but if I have more experience then I would easily come up with a range of: “$60 – $70K”, notice how the range becomes narrow with more knowledge. In the monte carlo concept this “more knowledge” is the number of simulations/iterations we perform. In other words, the greater the number of simulations, the more precise I can be and this creates a narrower range.

Monte Carlo Example

(Note: this is not a real world example with the intent to clearly teach the process and steps involved in the monte carlo simulation method)
Imagine that you run an options-trading firm with many options traders. Each options trader is given $500,000 to invest in 5 positions with $100,000 in each position. The outcome of each $100,000 position could be either: in-the-money, at-the-money or out-of-the-money at expiration. For simplicity, assume that the probability of each outcome is 1/3 and outcomes of different positions are independent. For the term end performance reporting a trader is successful trader if for the 5 positions (at option expiry) there are one or both of the following:

  1. two successive in-the-money
  2. three successive at-the-money

Now, let’s use monte carlo simulations to extract useful results from the above scenario:

Let’s build a 99% confidence interval that a trader will be successful using 100 simulations.

We can model this scenario easily in excel. The following images give a step by step guide to do this in excel.

1. We know that the probability of each outcome (in-the-money, at-the-money and out-of-the-money) is 1/3. We can use the rand function in excel to setup the columns at shown in the image below. We setup the the 5 columns to generate a 1/3 probability for each column. Notice that we have a lookup table setup to have 0 = in (in-the-money), 1 = at (at-the-money) and 2 = out (out-of-the-money). All we are doing is substituting the values for 0, 1, and 2 from the lookup table into the columns using the excel VLOOKUP function. So from columns B - F, we have a setup that generates equal probability out of in, at or out-of-the-money samples.

2. Next we want a way to tally the successive in-the-money outcomes. For this we add 4 more columns each column comparing the result of of successive outcome columns. This is shown in the image below.

3. Very similar to step 2 we want to tally the successive at-the-money outcomes. Because our problem statement says that at-the-money should have at least 3 successive outcomes, we add only 3 columns to compare the outcomes.

4. The 'Trader Successful' column is a simple OR function. The reason is that we have handled the problem conditions partially in the 'Successive in-the-money' and 'Successive 'at-the-money' columns. Now all we have to do is mark the trader successful if there is at least 1 'yes' in the column range: G - M.

5. We want to have 100 simulations that is why we just copy the row over to 100 rows and hence get 100 simulations.

6. This is the fun part where we start getting results. Notice the 'Analytics' section on the right side of the page. In this image all we are doing is getting the mean of the outcomes. This 'mean' is the number of successful traders divided by the total number of traders (i.e. 100 in our example).

7. In this step we just calculated the standard deviation of the successful traders. Both mean (average) and standard deviations are used in the monte-carlo formula.

8. This is where we get the z value. Fortunately excel provides us with a function to get the value as shown in the image. A detail to notice is that we are using the value .995 (or 99.5%) when we are trying to get a 99% confidence interval.

9. Now, we calculate the upper and lower range values. This formula is the gist of monte carlo concept. To get the upper value we use the formula: mean - ( std-dev * z / sqrt(100) ).

10. To get the lower value we use the formula: mean + ( std-dev * z / sqrt(100) ). By this point we have created the confidence interval and we can state our result from the simulations as: 'i can say with 99% confidence that the probability of a successful trader is between .236 and .484'.

The spread of the result

Now, let’s think about extending our results. Let’s say that we want to quantify the precision of our results. The following images show how to get the precision:

Using the results from the above simulations: “i can say with 99% confidence that the probability of a successful trader lies between .341 and .599 with .129 precision”

Number of simulations for desired precision result

Furthermore we can extend this problem. Say, we want to find out the number of simulations that are needed to get a precision of .02. We already have that with a 100 simulations we have a precision of .128, now to improve the precision from .128 to .02 we have increase the number of simulations. This total number of simulations to get a precision of .02 is found using the following formula.

Appendix A - Downloads



0 #19 Doug Hassell 2014-05-17 14:01
Hi, like the site and the examples. I am wondering if you can get in contact to help me further? My email is doug.hassell at btinternet.com


0 #18 Zorro7860 2013-08-03 01:27
Great job!!
+1 #17 hello can you solve 2012-10-20 07:12
Using Monte Carlo simulation, find the approximate area under the curve y= cos (x) over the interval .

In EXCEL, we can obtain random numbers by using the commands
=RAND( ) This generates a random number between 0-1
=RANDBETWEEN(a,b ) This generates a random number as an integer between integers a and b.

2. Deterministic Models

Area Under the Curve

y=f(x)=cos(x) between [-pi/2,pi/2] and 0 < cos(x)
0 #16 кппуп 2012-10-20 07:11
+1 #15 dr Nayil Khursheed 2012-06-07 06:39
I am a Neurosurgeon, and interesed in decision analysis of various drug therapies or procedures in neurosurgically sensitive situations, i have down loaded Tree Age pro and purchased a book by Bernd A Berg, should i do more to learn MCMC.Can your let me know about ur email id so that i can communicate to you faster. Thanks
+1 #14 suman Kumar 2011-12-25 17:51
Hi Farooq,
Its been a nice teaching of step by step, procedure.
Can we take this example to put in financial aspect like specified below.
positions 1,2,3,4,& 5 be filled with expenses & incomes.
see the succesful combination of them and find out the retirement income after 10-20 years.

Its just an idea where in the financial model which will be made using some conditions like market volatility and inflation and salary growth, being variable and few fixed constants, to build into a meaning ful platform.

It will be used for different purposes by different people, which may include the credit rating agencies, housing finance companies or banking institutions.

Hope this idea helps you.

+3 #13 Ehsan 2011-08-03 17:15
Thank you for this nice tutorial. It is really helpful.
+3 #12 Aijaj Ahmed 2011-07-31 15:02
Excellent Tutorial, Thumps UP
+3 #11 Marky Z 2011-06-11 13:54
So helpful for my assignment, I've spent like 30 hours to find something like this and found a jewel.
+1 #10 jeeba 2011-03-08 05:13
like it dude - keep the page up!!! u r referenced from wikipedia!