Monte Carlo analysis is a powerful method for building models and forecasts.

It allows you to build complex models, with any number of uncertain inputs, and be able to follow through that uncertainty into whatever it is you want to predict.

When your models are complex, and have lots of different moving parts, it can be tough to work out the impact of uncertainty in your inputs. Being able to overcome this difficulty is where the value of Monte Carlo analysis lies.

## How does Monte Carlo analysis work?

Monte Carlo analysis relies on the idea of running a large number of simulations within a model, and looking at the outputs of each simulation. The more simulations you run, the more accurate your model's outputs are likely to be.

### What is a simulation?

A simulation is an assignment of values to input variables. To understand what this means, we need to think of models as having two types of inputs:

**Certain inputs**These are inputs that you know with certainty. In a financial model, your fixed-value inputs might be things like tax rates, or profit margins.

**Uncertain inputs**Some inputs you won't know with certainty. In a financial model, these could be things like asset price growth, or future currency exchange rates.

In each Monte Carlo simulation, the same value is assigned to all certain inputs, and a value is assigned to all uncertain inputs according to its **probability distribution**.

### What is a probability distribution?

A probability distribution describes the possible values that an uncertain input can take.

For example, if our uncertain input is yearly price growth for a particular asset, we might know that the value of this input will be between 5% and 10%.

We can reflect this by describing this input as having a probability distribution which lies between 5% and 10%.

In the image above, the height of the distribution shows the likelihood of the input variable having that particular value. The fact that the distribution peaks in the middle (around 7.5%) means that the input is most likely to have a value of 7.5%.

This doesn't need to be the case though. If we knew that price growth would be between 5% and 10%, but knew that it was most likely to be just above 5%, we could build another distribution that looked like this.

These are both valid probability distributions, and each reflect different types of uncertainty that we can have in an input variable.

Whenever a simulation is run in a Monte Carlo analysis, a value for each uncertain input will be picked from that input's probability distribution. The value is most likely to come from where the distribution peaks, and least likely to come from where the distribution is lowest.

### Tying this back to Monte Carlo

Now we know that simulations are assignments of values to input variables, and input variables can be represented by probability distributions, we can start to answer the question of how Monte Carlo analysis actually works.

A typical Monte Carlo analysis might involve something like 10,000 simulations. This means that, 10,000 times over, the a set of values will be assigned to each input variable.

For all certain inputs, this is simple; the simulation just takes the certain input's value. For all uncertain inputs, the simulation picks a value according to that input's probability distribution.

Once all the input values are picked, the Monte Carlo algorithm will then make a note of the subsequent values of your output variables.

Once it's done this 10,000 times, it will have 10,000 different sets of output values, one for each simulation.

The crux of Monte Carlo analysis is using these 10,000 values to build up a probability distribution for your outputs.

This lets you see things like:

- The mean, or expected, values of your output variables.
- The uncertainty in your output variables.
- The probability of your output variables being above or below a certain value.

And voila, the Monte Carlo analysis is complete.

## A simple example

If the above sounded abstract at times, let's go through a very simple example.

Let's say that Apple's stock price is $100, and we know that Apple's stock price is going to grow by 5% to 10% each year.

**First question:** What will Apple's stock price be after 1 year?

As you might realise, this is a pretty easy one to answer. One of our inputs is certain (the current stock price) and the other is uncertain (price growth). Because we only have one uncertain input, we can easily say that Apple's stock price will be between $105 and $110.

If we were to plot out a probability distribution for Apple's stock price after a year, it would look identical to the probability distribution of our price growth input. I.e. if our price growth input variable had a normal distribution, then so would the Apple stock price after a year.

**Second question:** What will Apple's stock price be after 2 years?

Now we're talking. There are ways that you could solve this mathematically, but this is where Monte Carlo analysis starts to come to the fore.

A Monte Carlo approach would run a number of simulations, where in each simulation two distinct values of price growth are picked (one for year 1 and one for year 2). In each simulation, these are multiplied together, and used to work out the year 2 Apple stock price (our output).

All of the year 2 stock prices are collected, and used to build up a distribution of year 2 stock price. The crucial thing to note is that this distribution, of year 2 price, may differ in shape from the price growth distribution.

It's difficult to calculate mathematically what this shape is, but through Monte Carlo analysis and a large enough number of simulations, we can approximate it.

The above is just a simple example, so it's important to remember that the power of Monte Carlo analysis extends far beyond basic 2-input models.

No matter how many inputs your model has, or how many calculations it involves, you can always run Monte Carlo analysis to understand the probability distributions of your outputs.

## Where is Monte Carlo analysis used?

We saw above that the key benefit of Monte Carlo analysis is in being able to understand the probability distribution of output variables in a model that contains uncertain inputs.

For basic models, there are ways of achieving the same goal without using Monte Carlo methods. For more complex models, with lots of moving parts, these methods become impractical and Monte Carlo analysis becomes the natural choice

It should be no surprise therefore that Monte Carlo analyses are commonly used in particularly complex models. A model could be complex because:

**Many inputs**The model has a large number of input variables, which all affect the output you're trying to predict.

**Non-standard uncertainties**Your input variables have particularly unique uncertainties associated with them.

**Complex relationships**Your model's inputs interact together in complex, and perhaps non-standard ways.

Some examples where Monte Carlo analysis is employed, and which tick some or all of the boxes above, are:

**Financial analysis**Monte Carlo analysis is used all the time in financial contexts. Because Monte Carlo methods can help you build up a probability distribution for your model's outputs, they are often used in the context of risk analysis & management.

**Scientific research**Because so much of science studies complex systems, Monte Carlo methods find a natural home here. From particle physics to climate science, many researchers rely on Monte Carlo analysis to model systems.

## How do you build a Monte Carlo analysis?

For all the power that Monte Carlo analyses bring, they does come at a cost; they're not always straightforward to build.

If you're technically inclined, and have a background in coding, then there are some ways that you can build Monte Carlo models yourself. For many people who want to use Monte Carlo analysis though, these options are either needlessly technical or overly resource-consuming.

If you fall into this category, then you should try out Causal. One of the reasons we built Causal was to allow people to build Monte Carlo analyses without technical skills, and in minutes not days.

### What is Causal?

Causal is a browser-based modelling tool that lets you quickly build Monte Carlo analyses, and share them in interactive dashboards with your team.

There's really no learning curve to it.

Causal models are built out of variables:

And you write plain-English formulae to connect variables together:

Whenever you build a model that has uncertain inputs, Causal runs a Monte Carlo analysis in the background and lets you visualise the results in your output variables.

You can take create graphs and distributions out of those variables to understand the likelihood of your model outputs taking a certain value:

Lastly, you can share the URLs to your models (like this), and your team-mates will be able to view your outputs, and change your input assumptions to see how your outputs are affected in real-time.

If you're looking to build a scenario analysis of your own, Causal is free to get started with. Just click the link in the section below to learn more.