MonteCarlito v1 10-2
MonteCarlito v1 10-2
MonteCarlito v1 10-2
10
M. Auer, 2004-2012
Distributed under terms of GNU General Public License
www.montecarlito.com
This tutorial explains how MonteCarlito can be used to run Monte Carlo
simulations in Excel.
Monte Carlo simulations are often used to compute mathematical functions
where no fast, analytical solution exists (e.g., some financial functions,
or integrals), or to look at the statistical behaviour of complex systems.
Example 1: Basics
Basically, in a Monte Carlo simulation you analyze a random function, often to
get its average result (its so-called "expected value"). Say you are offered
to play the following game: you throw a dice, and get 1$ it you throw 1,
4$ if 2, 9$ if 3, 16$ if 4, 25$ if 5, and 36$ if 6.
But you also have to pay 14$ upfront to participate. Would you play that game?
To answer that question, you determine the expected profit/loss; an easy way
to do this is to simulate the game many times and average the individual outcomes.
To simulate this in Excel, first you need to create a random number from 0-1 with RAND():
Random number:
0.21995765
To play the game once, determine the profit of the dice throw, and subtract the costs:
Game profit:
Costs:
4
14
-10
Pressing F9 repeatedly reveals that sometimes you win, sometimes you lose money.
If you repeat this many times and analyze the outcomes, you can determine if you should play.
MonteCarlito is a tool to help you with that.
Just put the result of one (random) outcome in any cell, and write "1000" next to it:
1000
-10
Now, select the whole light blue area (2x2 cells) and press Ctrl+W.
MonteCarlito runs the simulation 1000 times, and gives you the average result. If it's positive, you should pla
al outcomes.
ou lose money.
rmine if you should play.
To simulate one dart throw, first create two random numbers (the x and y coordinate) between -2 and 2:
Throw to coordinates:
x
y
-1.60165752 1.62428126
0
0.805
3.220
press F9 a few times to make sure that the throw is between -2 and 2 in both axes)
23.2608186
18.6542744
Total effort:
41.915093
47.9586665
0.32193268
45.5857
10.1804053
103.640651
1000
Mean
Standard error
Median
Standard deviation
Variance
47.9586665
19.9535943
This means roughly that in 95% of all outcomes, the effort is between
and
47.9586665
47.9586665
plus
minus
19.9535943
19.9535943
MonteCarlito
Instructions:
1. Put all N formulas you want to simulate next to each other, preceded by the number of trials you want to run.
2. Select the N+1 cells and the 7x(N+1) cells beneath (indicated by frame).
3. Run macro "simulate" or press Ctrl+W to run simulation. Result:
1000
Mean
Standard error
Median
Standard deviati
Variance
Skewness
Kurtosis
0.0301
48.6044
0.5036
2198.8597
0.0094
135.6636
0.4878
186.1393
0.2986
4290.0602
0.0891 18404616.8190
0.0039
2.4879
1.7135
8.7563
0.0691
-0.0131
0.0309
-0.0174
0.9761
0.9529
0.0473
2.9563
Note:
- If the number of trials is negative, simulation is run in high-speed mode with minimized windows.
- If the cell with the number of trials has bold font type, histograms are created at end of simulation run.
- If you select less than 7 rows of cells beneath formulas, you get less output.
Examples:
a) Select range I11:K13; press Ctrl+W.
100
0.2966
-0.9944
b) Select range I18:J21; press Ctrl+W (a new workbook will be created with histogram).
1000
0.0825861673
h histogram).