Analytica > Blogs > Monte Carlo simulation tips & tricks

# Monte Carlo simulation tips & tricks

The use of random numbers as input is a defining feature of Monte Carlo simulations. This is what turns a deterministic model into a stochastic one, although how those random numbers are generated in the first place also affects the way the simulation runs. A Monte Carlo simulation lets you see how uncertainty is propagated, and how the performance, reliability and sensitivity of a model are affected by lack of knowledge or random variations.

## Where should you get your random numbers?

What is random? People have tried different methods for generating random numbers such as â€˜least significant digitsâ€™ in measures of time. Mathematical functions exist that generate sequences of numbers that look like random numbers: these are called pseudo-random numbers. Starting off with a â€˜seed valueâ€™ generates a particular sequence, and using a different seed value gives another sequence. This has two effects. The first is that different seed values need to be used, or the Monte Carlo simulation will continually give the same result. However, the second is that by recording the seed values used, the simulation becomes reproducible â€“ an important point in correcting and refining the simulation.

## Making it reproducible

Scientific experiments, organizational audits and Monte Carlo simulations have certain things in common: they should be impartial, systematic and reproducible. Sources of error need to be controllable or at least isolatable. Then the basic steps of conducting a Monte Carlo simulation can be followed:

1. Create a model with appropriate parameters
2. Generate datasets of random numbers as inputs (one number per parameter per dataset)
3. Run the simulation and record the result for each dataset
4. Analyze the results with statistical tools such as confidence intervals.

Image source: vertex42.com

From what you know about real-life inputs into the system you want to simulate, choose the probability distribution for the inputs that comes closest to that observed in reality.

Image source: fda.gov

## Variables and variations on a Monte Carlo theme

Von Neumann, one of the first to work with Monte Carlo simulations, used pseudo-random numbers. He found that if the simulation then went wrong, it did so in an obvious way, making it easier to identify possible problems. In some financial applications, Quasi Monte Carlo simulations are found to work better. In these simulations, random numbers are replaced by â€˜low-discrepancyâ€™ sequences (â€˜quasi-randomâ€™ sequences). In sports contexts and betting, Monte Carlo simulations have also been used to model separate events like football matches, and then combine the results to achieve a forecast of results that spans a complete football season. Similar approaches could be used to model larger events such as earthquakes affecting industrial facilities.

## Donâ€™t stop if or when you get a desired outcome

It may be tempting to call a halt to a Monte Carlo simulation when the output is something you suspected should be the result. This temptation can be resisted by making sure the simulation is run a statistically significant number of times, checked by, and even preferably performed by an independent entity. In addition, error in Monte Carlo simulations has been shown to change in the ration of 1/(square root of M), where M is the number of sample points. Itâ€™s better therefore to define an appropriate value for M (perhaps 10,000), run the simulation and average the results to reach an objective result with correspondingly less chance of error.

If youâ€™d like to know how Analytica, the modeling software from Lumina, can help you to model uncertainty in Monte Carlo simulations, then try Analytica for free to see what it can do for you.

## Share nowÂ

### Building electrification: heat pump technology

Lumina set out to build a useful tool to assess the benefits of heat pumps. Learn more about heat pumps and their impact.

### Navigating the heat pump landscape

Fort Collins, Lumina, and Apex Analytics have created a tool to help reduce greenhouse gas emissions by optimizing building electrification programs.

### US gas leaks much larger than previously estimated

A new Stanford-led study on natural gas leak rates from oil and gas activity across a large fraction of the US are about 3x more than previous government estimates. The

### Monte Carlo simulation software

Elevate your decision-making with powerful tools for risk analysis, uncertainty modeling, and robust predictions with Analytica's Monte Carlo simulations.

Moreâ€¦

### Embrace risk & uncertainty

Risk and uncertainty are inevitable. Discover how best to mitigate risks and find robust decisions so that your clients can prosper under a wide range of possible futures.

Moreâ€¦

### Pi Day comparison: Monte Carlo vs Latin hypercube vs Sobol sampling

This blog will be visiting the dart-throwing method of estimating Ï€ and comparing how fast or slow different sampling techniques converge to the actual value of Ï€. The sampling techniques...

Moreâ€¦

### Monte Carlo analysis for schedules: more than just a mouse click

Project managers using Analytica to model schedules benefit from the built-in Monte Carlo engine. That makes the simulation runs for a given model effortless from the ...

Moreâ€¦

The free version of Analytica lets you create and edit models with up to 101 variables, which is pretty substantial since each variable can be a multidimensional array. It also lets you run larger modes in ‘browse mode.’ Learn more about the free edition.

While Analytica doesn’t run on macOS, it does work with Parallels or VMWare through Windows.

The free version of Analytica lets you create and edit models with up to 101 variables, which is pretty substantial since each variable can be a multidimensional array. It also lets you run larger modes in ‘browse mode.’ Learn more about the free edition.

While Analytica doesn’t run on macOS, it does work with Parallels or VMWare through Windows.

The free version of Analytica lets you create and edit models with up to 101 variables, which is pretty substantial since each variable can be a multidimensional array. It also lets you run larger modes in ‘browse mode.’ Learn more about the free edition.

While Analytica doesn’t run on macOS, it does work with Parallels or VMWare through Windows.

The free version of Analytica lets you create and edit models with up to 101 variables, which is pretty substantial since each variable can be a multidimensional array. It also lets you run larger modes in ‘browse mode.’ Learn more about the free edition.

While Analytica doesn’t run on macOS, it does work with Parallels or VMWare through Windows.