This article is more than 1 year old

About to make a big bet? Don't crash out, cash in with the power of maths

From biz changes to Monte Carlo, probabilities of risk explained

You... lost in the desert

It is worth noting that a combinatorial approach, were it possible, could actually be considered to produce a proof of the number of times Canfield solitaire comes out. A Monte Carlo simulation is never a proof because it might just happen that, time after time, by random luck, the cards would shuffle to a solvable solution. But the chances are very, very much against that happening. A Monte Carlo simulation, whilst not offering a proof, is often used and does provide a very good estimation very rapidly.

One of the key elements of a Monte Carlo simulation is the randomising part and that makes it a stochastic (as opposed to deterministic) process. A deterministic process produces the same answer every time it is run, assuming that we use the same starting values.

So, 0.5 x 0.7 always gives a 35 per cent chance of meeting in the pub. Stochastic systems/processes on the other hand display a level of indeterminacy. From the same starting point it is possible to reach several (possibly an infinite number) of outcomes. To provide that level of indeterminacy in practice, some of the numbers we use in a Monte Carlo simulation are random.

You are lost in the desert. You take a single step in a random direction. Then you take another, but the direction of the second is entirely random with respect to the first step. The question is, at the end of n steps, how far away are you from the starting point?

So, let’s go back to our website. You could try to solve the problem by assigning a set of probabilities to all the possible outcomes of users interacting with web pages but I really wouldn’t advise doing this. However a Monte Carlo simulation would be relatively simple.

In a computer program we could set up a pool of users. The relative proportions of the different age groups and classes would be representative of the observed users of the website. We could generate a “pool” of web pages in a similar way. Now we pick a user at random from the pool (there’s the indeterminacy) and let them interact with a randomly chosen (indeterminate) web page.

Note that while we choose the user randomly, they are being chosen from a pool where the proportions of the different user types is carefully set to represent reality; so if there are more elderly users of the website, then the chances of selecting one of those is higher. The same applies to the selection of web pages.

“Ah,” you may well be thinking, “but we’d need to track the users as they follow links between pages.” OK, so we build those links into the model. “But users don’t start at ‘random’ pages on a website, some pages are much more likely than others.” OK, so build that into the rules of your model.

So, does it actually work?

Of course, I wouldn’t be wasting your time if it didn’t. Let’s look at a really simple example in action with the Random Walk problem. You are lost in the desert. You take a single step in a random direction. Then you take another, but the direction of the second is entirely random with respect to the first step.

The question is, at the end of n steps, how far away are you from the starting point? (This problem sounds totally pointless but early last century it was a crucial question – not about people lost in deserts, but about how atoms and molecules move.) The problem was solved mathematically at the time. When I tell you that Einstein worked on it, you get some idea that it is a non-trivial question.

Nowadays we can solve it really easily using a Monte Carlo simulation. We simply write a program that generates random directions and walks the current person (or atom) one step at a time. We can record how far they have got after one step, two steps, three and so on. We do that for 20 people and take the average value for each number of steps.

Finally we plot the averages for each step.

Monte Carlo 1

In the chart above you can see the result of 20 simulations for between one and 100,000 steps. The blue line is the square root of (n) and you can see that in this simulation, the two approximate to the same answer. Why stop at 20 simulations; isn’t that what CPU cycles are for?

Monte Carlo 2

Now, in the above chart, you can see the result of 50,000 simulations for between one and 5,000 steps.

Great mathematicians worked on the random walk problem. It is unlikely that you will be able to get someone of Einstein’s calibre to prove whether a change to your web page is beneficial or not. In practice, you probably don’t need a proof; you just need a very, very good estimation. It would be wise, therefore, to count Monte Carlo simulation amongst your friends. ®

More about

More about

More about

TIP US OFF

Send us news


Other stories you might like