Monte Carlo Simulation: Drawing From a Stated Shape
Monte Carlo simulation writes down the shape an outcome can take, draws from that shape one value at a time, and counts what falls out. State the Nakshatra unit's five monthly changes and their weights, draw twelve, apply them to Rs 100/-, then do the whole thing again. Ten thousand paths from seed 12345 leave 2,453 below Rs 100/-, reading 24.5300 per cent against an exact 24.6562.
The output of one of these is familiar enough, even where the machinery behind it is not. Somebody says there is a one in four chance of the thing ending lower than it started, and the number arrives already finished, with no visible working. The machinery behind that number is small enough to pull apart on paper. A calculator and about twenty minutes produce the same digits printed below.
The whole method is four steps and only one of them requires any thinking. Four steps with one decision inside them is the sentence worth carrying away before anything else. Everything difficult about a Monte Carlo simulation happens before a single number is drawn, in the step where somebody decides what shape the outcomes are being drawn from. The drawing itself is bookkeeping.
Everything here runs on one invented thing. The Nakshatra unit was composed for teaching: it carries a price, it is quoted once a month, and no other property was ever assigned to it. Its opening price is Rs 100/-. From one month to the next that price moves by exactly one of five amounts, and by nothing in between: a fall of 9.00 per cent, a fall of 4.00 per cent, a rise of 1.00 per cent, a rise of 6.00 per cent, or a rise of 11.00 per cent. The weightThe number sitting beside each possible value, saying how much of the time that value turns up. Weights across all the possible values add to one, which is settled elsewhere and used here without rebuilding. on each of those five, in the same order, is 0.08, 0.18, 0.48, 0.18 and 0.08. The list of five values with five weights is the stated shape, and the shape is stated rather than measured, fitted or discovered. Somebody wrote it down.
No figure below was measured. The Nakshatra unit was composed for teaching, and its five values and five weights were fixed when it was first set out. Every reading then comes out of one arithmetic rule, printed in full further down and started from a number named beside each figure it produces. Put the same starting number into the same rule and the same digits come back, and that repetition is the whole of the checking available.
What is taken here as already settled?
Three things, each built elsewhere, each used here without being rebuilt from scratch.
- The five values, the five weights, and the fact that weights add to one. Where those come from and what a weight means is covered separately. Here they are simply the raw material, and the only fact about them that matters is that they total exactly 1.00.
- The purpose of a simulation, and how it differs from replaying a record already held. The comparison between the two is covered separately. Generating outcomes is taken as a legitimate thing to do, and the question is how one is actually generated.
- A counted answer is an estimate, and estimates miss. The standard errorA measure of how far a counted answer would typically jump about if the whole counting exercise were done again from scratch. How it is calculated, and how many draws a stated tolerance costs, are both covered separately. of a counted share is covered separately. The figure 0.4310 per cent is used once below as a sense of scale, and is not derived here.
The strangest and most useful feature of the whole treatment is worth stating first. Because the Nakshatra unit was composed and its shape written down, its true answer is known exactly rather than estimated. There are 1,820 different ways twelve months can be shared out among five values, each way carries a weight that can be computed, and adding up the weight of every way that finishes below Rs 100/- gives 24.6562 per cent. Adding up every way like that is enumerationListing every possibility one at a time and adding up what each of them contributes, rather than sampling some of them and scaling up. It only works where the list of possibilities is short enough to finish., not sampling. So every simulated answer below stands beside the truth it is trying to reach. No real study of anything can do that.
What are the four steps of a Monte Carlo run?
Here they are, and there are genuinely only four.
- State the shape. Write down every value the thing can take and the weight on each. For the Nakshatra unit that is five values and five weights, and it is a decision somebody makes, not a fact anybody looked up.
- Draw a number between zero and one. One uniform drawA number picked from the stretch between zero and one where no part of the stretch is favoured over any other. Where such numbers actually come from is covered separately., no more. Where those numbers come from is covered separately; for now, accept that a rule exists that produces them one after another.
- Read the drawn number off against the shape to get one value. The mapping is set out immediately below, and it is where readers get stuck.
- Repeat. Twelve times to fill one twelve month path. Ten thousand times to fill a run. Then count.
Step one is a decision and steps two, three and four are mechanical. So every argument anybody ever has about a Monte Carlo simulation is really an argument about step one. Nobody disputes that a drawn number between 0.08 and 0.26 should read as a fall of 4.00 per cent, given the weights. People dispute the weights, always and only. The weights are what to look at whenever one of these answers is quoted.
Which of the four steps in a Monte Carlo run is a decision rather than a mechanical operation?
How does a number between zero and one become one of five values?
Through the running totals of the weights, and it is easier than it sounds. The five weights taken in order, with a running total kept along the way, give 0.08, then 0.08 plus 0.18 is 0.26, then plus 0.48 is 0.74, then plus 0.18 is 0.92, then plus 0.08 is 1.00. The five running totals cut the stretch from zero to one into five stretches whose widths are exactly the five weights.
Now the rule. The drawn number walks along the running totals until it reaches the first one it is below. The value sitting at that first running total is the value drawn. The test is strictly less than, and the word strictly is doing real work here. A draw of 0.0500 is below 0.08 straight away, so it reads a fall of 9.00 per cent. A draw of 0.2599 is not below 0.08, but it is below 0.26, so it stops there and reads a fall of 4.00 per cent. A draw of exactly 0.2600 is not below 0.26. Equal is not below, so the draw walks on to 0.74 and reads a rise of 1.00 per cent.
The hair splitting matters less for the answer than for confidence in the answer. Landing exactly on a boundary is vanishingly rare, so the answer barely feels the rule at all. Confidence feels it a great deal. A rule that is only mostly specified is a rule two people will implement differently, and then their answers will differ and neither will know why.
The mapping is the only place the stated shape enters the calculation, so changing the shape means changing these five widths and changing nothing else at all. The drawing rule does not change. The counting does not change. The twelve multiplications do not change. Five widths move, and everything downstream is carried along by them. Hold on to that width business. The tool further down is honest for exactly this reason: it moves one width and lets one other width absorb the change.
A drawn number comes up as 0.7399. Which value does it read off, and what would 0.7400 read off instead?
What does one whole path look like?
Now to do it properly. The rule that produces the numbers between zero and one in this guide is a single line of arithmetic: the current number is multiplied by 16,807, and the remainder after dividing by 2,14,74,83,647 is kept. The remainder divided by 2,14,74,83,647 is the number between zero and one. The remainder then feeds back in and the line repeats.
The rule has to start somewhere, and the number it starts with is the seed. The headline run starts it at 12345, and the seed is named beside every figure the run produces. 12,345 multiplied by 16,807 is 20,74,82,415. The product is smaller than the number being divided by, so it survives the remainder step untouched. Divided by 2,14,74,83,647 it gives 0.096617. Walked along the running totals, it is not below 0.08 but it is below 0.26, so the first month reads a fall of 4.00 per cent, and Rs 100/- becomes Rs 96/-.
Carried on for twelve months, that gives a path. Each month's change is applied to whatever the month before left behind rather than to the original Rs 100/-. Stacking changes like that is ordinary compoundingWhere a change lands on top of whatever was left standing after the change before it, so the base keeps shifting. Twelve such moves cannot be totalled up as twelve numbers. and is why the twelve changes cannot just be added up. Here is the whole thing, and every line of it is one multiplication and one remainder.
| Month | The number in the rule | Drawn number | Change, per cent | Price |
|---|---|---|---|---|
| 1 | 20,74,82,415 | 0.096617 | minus 4.00 | Rs 96.0000/- |
| 2 | 1,79,09,89,824 | 0.833995 | 6.00 | Rs 101.7600/- |
| 3 | 2,03,51,75,616 | 0.947702 | 11.00 | Rs 112.9536/- |
| 4 | 7,70,48,696 | 0.035879 | minus 9.00 | Rs 102.7878/- |
| 5 | 2,47,94,531 | 0.011546 | minus 9.00 | Rs 93.5369/- |
| 6 | 10,98,54,999 | 0.051155 | minus 9.00 | Rs 85.1186/- |
| 7 | 1,64,45,15,420 | 0.765787 | 6.00 | Rs 90.2257/- |
| 8 | 1,25,61,27,050 | 0.584930 | 1.00 | Rs 91.1279/- |
| 9 | 1,96,30,79,340 | 0.914130 | 6.00 | Rs 96.5956/- |
| 10 | 1,68,31,98,519 | 0.783800 | 6.00 | Rs 102.3913/- |
| 11 | 71,54,26,902 | 0.333147 | 1.00 | Rs 103.4153/- |
| 12 | 41,90,02,361 | 0.195113 | minus 4.00 | Rs 99.2786/- |
Look at months four, five and six. Three falls of 9.00 per cent in a row, in the very first path the rule produced, from a value carrying a weight of only 0.08. A reader meeting that for the first time usually assumes something has gone wrong, and nothing has. Three falls of 9.00 per cent in a row is exactly the sort of thing a weight of 0.08 on that value produces, and finding one in the first path is not evidence of a broken rule any more than three heads in a row is evidence of a bent coin.
Working out how often it should happen makes the surprise go away. A run of three at any given starting month has a weight of 0.08 times 0.08 times 0.08, or 0.000512. There are ten places in a twelve month path where such a run could begin. Across ten thousand paths there is plenty of room for it. The household version: a street vendor who has three terrible days in a row in his first week has not been cursed, he has had a normal week for someone whose takings vary. The right response is to check the takings book, not the stars.
Path one contains three falls of 9.00 per cent in a row. With a weight of 0.08 on that value, is that evidence the drawing rule is broken?
How does one path become an answer?
One path does not become an answer, and this is the part people skip. Path one ended at Rs 99.2786/-, below where it started. One path finishing below the start is one count. One count is not a share, and a share needs a denominatorThe count written underneath a share, deciding what the share is a share of. Change it and the share changes even when the number on top has not moved. worth the name.
Consider path one on its own. One path finished below the start, out of one path run, and the reading is 100.0000 per cent. The reading is a true statement about the one path and a worthless statement about anything else. Across twenty five paths, eight of them finish below for a reading of 32.0000 per cent. Better, and still a long way from anything worth putting in writing. Across ten thousand, 2,453 finish below for a reading of 24.5300 per cent.
The answer a Monte Carlo simulation produces is a counted share, and the drawing was only the machinery that gave the share something to count, so the ending price of any one path is not an output of the method at all. A single simulated path quoted as though it were a finding is the raw material offered as the product.
Path one ended at Rs 99.2786/-. Is that an output of the Monte Carlo simulation?
What does the tool take, and why is one of its controls not a variable?
The tool takes two controls, and the two are not the same kind of thing at all.
The first control is the variable. The variable is the weight on a fall of 9.00 per cent, and it moves from 0.00 to 0.20. The five weights have to keep adding to exactly one, so whenever the weight on a fall of 9.00 per cent moves, the weight on 1.00 per cent moves the other way to absorb it. With the weight on a fall of 9.00 per cent set to w, the five weights become w, 0.18, 0.56 minus w, 0.18 and 0.08. Added up: 0.18 plus 0.18 plus 0.08 is 0.44, and w plus 0.56 minus w is 0.56, and 0.44 plus 0.56 is 1.00. The five weights close at every setting, and the tool's own script checks the total before it prints anything.
The second control is the seed, and it is not a second variable. The seed decides which stream of numbers between zero and one comes out of the rule. The seed decides nothing whatever about what is being asked. Changing the seed is like putting the same question to a different set of ten thousand drawn paths. Changing the weight asks a different question entirely.
A panel that reshuffled on every click would make a real change impossible to tell apart from noise, and the seed is there to stop that: the same setting always gives the same reading. Repeatable randomness feels backwards, and the idea is worth sitting with for a second. Randomness that can be repeated sounds like a contradiction, and it sounds like cheating. It is neither. When the weight moves from 0.08 to 0.10 and the reading moves, the question is whether the reading moved because the shape moved or because the drawing happened to land differently this time. With the seed held fixed, only one of those two explanations survives.
The weights closing at exactly one is not a nicety, and it is worth seeing rather than believing. Draw the five weights as one bar and something rather nice shows up: the cut at 0.74 does not move at any setting. The weight the first value gains is exactly the weight the middle value loses.
The tool's seed moves from 12345 to 12346 and nothing else changes. What should happen to the reading, and what would it mean if the reading did not move at all?
The tool is set back to a weight of 0.08 and seed 12345 tomorrow morning. What reading will it give, and what does that say about what a seed is for?
The weight on a fall of 9.00 per cent is about to move from 0.08 to 0.16. Does the chance of ending below Rs 100/- roughly double, more than double, or less than double?
Move the stated shape and watch the answer follow it.
One variable moves: the weight on a fall of 9.00 per cent, through eleven settings from 0.00 to 0.20. The weight on 1.00 per cent absorbs every change, so the five weights add to exactly one at every setting, and the tool checks that before it prints a single figure. The bands redraw, twenty five sample paths redraw, and the counted answer redraws beside a marker for the exact answer that is drawn only at the stated setting. The opening setting is a weight of 0.08 with seed 12345, and the run at that setting puts 2,453 paths below Rs 100/- out of 10,000, reading 24.5300 per cent against an exact 24.6562 per cent. The seed sits beside the slider without being a second thing to explore, and it is here because a tool that shuffled its own answer on every click would quietly contradict everything written above it.
Educational illustration. Every figure in the tool comes out of the arithmetic rule printed above, started from the seed shown. The shape at a weight of 0.08 is the stated one. Every other setting describes a different thing entirely, so the marker for the exact answer is drawn only at 0.08.
What happens to the answer when the stated shape moves?
The answer moves a very long way, and that is the whole claim being made. Here are all eleven settings, each one a full run of ten thousand paths from seed 12345.
| Weight on minus 9.00 | Weight on 1.00 | Chance of ending below Rs 100/- |
|---|---|---|
| 0.00 | 0.56 | 5.3200 per cent |
| 0.02 | 0.54 | 9.2100 per cent |
| 0.04 | 0.52 | 13.8200 per cent |
| 0.06 | 0.50 | 18.9700 per cent |
| 0.08, the stated shape | 0.48 | 24.5300 per cent |
| 0.10 | 0.46 | 29.7600 per cent |
| 0.12 | 0.44 | 35.2700 per cent |
| 0.14 | 0.42 | 41.0300 per cent |
| 0.16 | 0.40 | 46.6300 per cent |
| 0.18 | 0.38 | 52.0600 per cent |
| 0.20 | 0.36 | 57.7900 per cent |
From 5.3200 to 57.7900 per cent. The answer moves by a factor of nearly eleven while the drawing rule, the seed, the twelve months and the counting all sit perfectly still. Nothing about the machinery changed. One number in the first step changed.
The answer is a function of the stated shape, and the stated shape was an assumption, so a Monte Carlo simulation can never be more right than the sentence somebody wrote down before any drawing started. The dependence is not a criticism of the method. It is the method, described accurately. The drawing is a very good way of working out what a stated shape implies, and it is no way at all of working out whether the shape is any good.
Now the harder half. Because the enumerated answer described the shape at 0.08 and nothing else, the exact 24.6562 per cent belongs only to that setting, and at every other setting there is nothing to compare the reading against. The trap catches people who have got comfortable with the truth marker. At a weight of 0.20 the reading is 57.7900 per cent, and the natural next question is what the true answer is. There isn't one here. A unit whose weight on a fall of 9.00 per cent really is 0.20 does have an exact answer of its own, but that unit is not the Nakshatra unit, and the enumeration above was carried out for the Nakshatra unit alone.
The reading at a weight of 0.20 is 57.7900 per cent. Why is there no marker for the exact answer beside it, when there is one beside the reading at 0.08?
Who actually runs one of these, and what do they do with the answer?
Start somewhere without any finance in it at all. A caterer is quoting for a wedding and needs to know how often a job of this size loses money. She has done eleven weddings. Eleven is not enough weddings to count anything from. So instead she writes down what she knows: guest numbers land in one of five brackets, and she knows roughly how often each bracket comes up. She writes down five ingredient cost levels and how often each of those comes up. Then she works through five hundred imaginary weddings on paper, drawing a bracket and a cost level for each, and counts how many lost money. Five hundred imaginary weddings counted on paper is a Monte Carlo simulation, done with a pencil, and it is the same four steps.
The caterer must not then forget where the five brackets came from. If somebody asks her the chance of losing money on a wedding, the honest answer is not a number. The honest answer is a number attached to a sentence: given that guest numbers fall into these five brackets this often, the chance is such and such.
The professional version is the same shape with better software. Somebody sizing a lending book runs paths of borrower behaviour and counts the ones that breach a limit. Somebody planning a household's lumpy expenses over ten years runs paths of income and counts the years that come up short. An analyst asked how often a holding finishes a year below where it began does exactly what was done above with the Nakshatra unit. In each case the useful product is not the headline number but the sensitivityHow far an answer shifts when one of the inputs behind it is nudged. A number that barely moves and a number that halves under the same nudge are two very different things to report. around it. A run shows how much the answer depends on the input that was least certain. The sensitivity is the reading worth carrying into a room.
Which is also the honest way to use the calculator above. The calculator does not offer eleven possible answers. The calculator measures how much the answer rests on one assumed number, and if the answer swings from 5.3200 to 57.7900 per cent while that number moves across a range nobody could confidently rule out, then what has been learned is that the answer is not known, and why.
What can a Monte Carlo simulation not show?
Four things, and they are worth naming individually because they fail in different ways.
- Whether the stated shape is right. Nothing inside the run can check this. The drawing is perfectly obedient to whatever it was handed, and it obeys a wrong shape exactly as faithfully as a right one.
- Whether the values in the shape are the only values the world can produce. The Nakshatra unit as stated cannot fall 30.00 per cent in a month, because a fall of 30.00 per cent is not in the list. Ten thousand paths will never produce one. A hundred million will never produce one. Absence from the output is not evidence of impossibility, it is a restatement of the input.
- The record of what actually happened. A Monte Carlo run generates outcomes that could occur under a stated shape. The run reports nothing that did occur. Replaying a real record answers a different question and is covered separately.
- How far the counted answer sits from the answer the same shape would give with unlimited paths. The gap is a separate calculation with its own arithmetic, covered separately, and on the default run it is measured at 0.4310 per cent while the miss came in at minus 0.1262 per cent.
The first of those four is the one that ends careers and the fourth is the one everybody quotes. Saying the run used ten thousand paths sounds diligent and is easy to check. Saying the run assumed a weight of 0.08 on a fall of 9.00 per cent because that is what somebody wrote down in a meeting is far harder. Both belong in the report. Only one of them usually gets there.
Somebody reports that a Monte Carlo simulation shows a 24.5300 per cent chance of the Nakshatra unit ending a twelve month stretch below where it started. Name the assumption that number is entirely conditional on, and say what would have to be checked before quoting it.
The mistake this tool invites, and it is a good mistake
Here is what happens. A reader moves the weight on a fall of 9.00 per cent from 0.08 to 0.12, watches the answer go from 24.5300 to 35.2700 per cent, and writes down that the chance of the Nakshatra unit ending below Rs 100/- is somewhere between 24.5300 and 35.2700 per cent.
It is not. Only one of those two shapes is the shape the Nakshatra unit was defined with. The other describes a different thing entirely, something whose falls of 9.00 per cent come up half again as often. Presenting the two readings as a range says that one subject has an uncertain answer. In truth, two different subjects each have a perfectly definite answer.
The cost of this is a report where a reader downstream cannot tell the two apart. A range that comes from genuine uncertainty about the world and a range that comes from the author trying out different inputs look identical in print, and only one of them means what the reader will assume it means. The fix costs one line of typing. Label every reading with the shape that produced it, and never put readings from two different shapes together as a range. The reader's actual discovery is far more useful than a fake range. How hard the answer leans on one assumed number is a finding worth reporting in its own right and in its own words.
Related subjects. Simulation itself, and how generating outcomes compares with replaying a record already held, is covered separately. The discipline that makes a run worth reporting, including how a seed gets chosen and reported honestly, is set out in its own treatment. Where the numbers between zero and one actually come from, and how many draws a stated tolerance costs, are both covered separately. The method that draws its material out of a record instead of out of a written down shape is covered separately as well. Pointing this method at a contract and valuing the contract belongs to a different subject altogether.
What would have to be fetched to check the figures here?
Nothing. There is no document behind these figures because there is no document that could be behind them. Five values, five weights and one line of arithmetic are the entire equipment, and all three are printed above in full. The check on every figure here is not a citation but a repetition: start the rule at the seed named beside the figure, turn the handle, and see whether the same digits come back.
| The kind of source a reference table usually carries | What stands in its place |
|---|---|
| A supervisor, exchange or standard setter whose rule is being restated | None. No supervisor or standard setter made this arithmetic. Multiplying by 16,807 and taking a remainder is not anybody's regulation, and no market decides what a running total is. |
| A price series, with the day it was last read | None. The Nakshatra unit has never traded anywhere, so it has no series and no reading date. Its five values were composed, not observed. |
| An author whose method this is | None named. Drawing from a stated shape and counting is old, ordinary working practice, and it is attached to nobody in particular. |
| Figures taken on trust from somewhere else | None. Path one, the 2,453 paths below Rs 100/-, all eleven shape settings and the exact 24.6562 per cent are each produced by the arithmetic rule above, and the calculator regenerates them every time a control moves. |
| A jurisdiction, threshold or period that changes from place to place | None. No rate, threshold, filing date or product appears anywhere here, so there is nothing that could differ between one market and another. |
The Nakshatra unit, the caterer and the street vendor are invented.
Educational material. Not advice on any investment, tax, budget or market position.
