Monte Carlo
Monte Carlo
Monte Carlo
Intro to MonteCarlo.xls
This workbook introduces Monte Carlo Simulation with a simple example.
Typically, we use Excel to draw a sample, then compute a sample statistic, e.g., the sample average.
We can repeat this process, again and again, keeping track of the result each time. We then look
at the empirical histogram and summary statistics of the results in order to discover or illustrate the
statistical properties of the chance process. This method of studying a chance process is called
Monte Carlo simulation.
The OneFreeThrow sheet shows how Excel can be used draw a random number and simulate a free throw.
The Sample sheet has the outcome of 100 free throw attempts.
Page 1
Intro
Page 2
OneFreeThrow
To simulate a free throw, we use a random draw in an IF statement. Scroll down to see how.
The random draw uses the formula, "=RANDOM()", to get a uniformly distributed number in the 0,1 interval.
Click in cell B5 to see the formula. Hit F9 (or CTRL - =) to draw a new number. For more on random number generation, see
Random
#MACRO?
draw
The RANDOM() function is the foundation of the Monte Carlo Simulation because it's our roulette wheel,
but we need one more concept to complete the simulation. We need a way to tell Excel that Larry
has a 90% chance of making the free throw.
Fortunately, this is easily done with an IF statement.
Random
#MACRO? ### ###
draw
### ###
Combining the RAND and IF statements into a single formula, we get a virtual 90% free throw shooter:
Larry Bird
#MACRO?
Simulated
Notice that this outcome will occasionally differ from the one above. The reason is that
it's based on a different draw from the uniform distribution.
Hit F9 (or CTRL - =) repeatedly (say 30 times in a row) to see how Larry's doing.
As long as the value stays at 1, Larry hit the free throw. When it changes to 0, he missed.
Question:
"I noticed that sometimes he misses in cell B23, but makes it in cells C18 through D19. What's going on?"
Answer:
Excel is drawing different random numbers in cells B18 and B23. Every time it sees
RANDOM() in a cell, Excel draws a new random number.
Question:
"Sometimes I see the word "Calculate" at the bottom of the screen. What does that mean?"
Answer:
Excel can be set up to automatically calculate the values of every formula whenever
the user enters new information anywhere in the workbook OR it can be in Manual Calculate
mode, which means that it will not automatically recalculate. Manual Calculation is needed for
Monte Carlo simulation to prevent constant redrawing of random numbers. The "Calculate"
message in the Status Bar at the bottom of the screen alerts the reader that Excel has not
automatically recalculated the cells in the workbook. If you hit F9, the "Calculate" message
Page 3
OneFreeThrow
will disappear. Section 9.3 explains about Calculation in more detail and shows how to set the calculation mode.
Page 4
OneFreeThrow
0,1 interval.
ndom number generation, see sections 9.2 and 9.3.
Page 5
OneFreeThrow
calculation mode.
Page 6
Sample
Percentage Made #MACRO? This sheet contains a single repetition of 100 draws (free throw attempts)
Attempt Result Larry Bird hits 90% of his free throws. The formula in Cell B4 informs Exc
1 #MACRO? The exact same formula is used in the 100 cells from B4 to B
2 #MACRO? Hit F9 to simulate another 100 free throws.
3 #MACRO? How did Larry do this time?
4 #MACRO?
5 #MACRO? Hit F9 again and again. Watch cell B1.
6 #MACRO? How much spread or bounce is there?
7 #MACRO?
8 #MACRO? Wouldn't it make sense to keep track of Larry's sample percentage?
9 #MACRO? Click on the button below to do so.
10 #MACRO?
11 #MACRO?
12 #MACRO?
13 #MACRO? Curious about streaks? Click on the button below.
14 #MACRO? Click this button several times.
15 #MACRO?
16 #MACRO?
17 #MACRO? Do you think Max Streaks follow a normal distribution?
18 #MACRO? Click on the button below to see a Monte Carlo simulation that answers th
19 #MACRO?
20 #MACRO?
21 #MACRO?
22 #MACRO?
23 #MACRO?
24 #MACRO?
25 #MACRO?
26 #MACRO?
27 #MACRO?
28 #MACRO?
29 #MACRO?
30 #MACRO?
31 #MACRO?
32 #MACRO?
33 #MACRO?
34 #MACRO?
35 #MACRO?
36 #MACRO?
37 #MACRO?
38 #MACRO?
Page 7
Sample
39 #MACRO?
40 #MACRO?
41 #MACRO?
42 #MACRO?
43 #MACRO?
44 #MACRO?
45 #MACRO?
46 #MACRO?
47 #MACRO?
48 #MACRO?
49 #MACRO?
50 #MACRO?
51 #MACRO?
52 #MACRO?
53 #MACRO?
54 #MACRO?
55 #MACRO?
56 #MACRO?
57 #MACRO?
58 #MACRO?
59 #MACRO?
60 #MACRO?
61 #MACRO?
62 #MACRO?
63 #MACRO?
64 #MACRO?
65 #MACRO?
66 #MACRO?
67 #MACRO?
68 #MACRO?
69 #MACRO?
70 #MACRO?
71 #MACRO?
72 #MACRO?
73 #MACRO?
74 #MACRO?
75 #MACRO?
76 #MACRO?
77 #MACRO?
78 #MACRO?
79 #MACRO?
Page 8
Sample
80 #MACRO?
81 #MACRO?
82 #MACRO?
83 #MACRO?
84 #MACRO?
85 #MACRO?
86 #MACRO?
87 #MACRO?
88 #MACRO?
89 #MACRO?
90 #MACRO?
91 #MACRO?
92 #MACRO?
93 #MACRO?
94 #MACRO?
95 #MACRO?
96 #MACRO?
97 #MACRO?
98 #MACRO?
99 #MACRO?
100 #MACRO?
Page 9
Sample
sample percentage?
Page 10
Q&A for MonteCarlo.xls
1) Run a Monte Carlo with 1,000 repetitions of the percentage made of 100 free throws.
Use the Take a Picture button to take a picture of your results.
Copy and paste the picture in a Word document.
2) Run a Monte Carlo with 10,000 repetitions of the percentage made of 100 free throws.
Take a picture, copy it, and paste it in the Word document below the 1,000 repetition Monte Carlo.
3) In what sense is the 10,000 repetition Monte Carlo better than the 1,000 repetition Monte Carlo in this example?
5) What are the chances that the virtual Larry Bird gets a max streak of 51 in a row or more?
Explain how you arrived at your answer.
n Monte Carlo.