# How to perform and apply Monte Carlo simulation?

By Indra Giri & Priya Chetty on October 10, 2017

Monte Carlo simulation is an extension of statistical analysis where simulated data is produced. This method uses repeated sampling techniques to generate simulated data. For instance, a regression model analyzes the effect of independent variables X1 and X2 on dependent variable Y. The regression equation is as follows:

`Y = 0.076 + 0.0054X1 – 0.72X2`

The value of Y can be predicted from the above equation. Moreover, different values of X1 and X2 will give different values of Y. Using this procedure helps generate infinite amount of data. This means variability among different values of X1 and X2 causes variability in its respective values of Y, hence affecting the output. In such cases, Monte Carlo simulation is useful as it simulates the data of X1 and X2. It removes the variability and optimizes the data so that it correctly estimates the value of Y. Therefore, it is broadly a technique to study how a model responds to randomly occurring inputs.

## Process of performing Monte Carlo simulation

There are three main steps in performing Monte Carlo simulation:

1. Perform a regression with ‘N’ inputs (observations of X1 and X2).
2. Run a simulation for each of the ‘N’ inputs. Here simulation refers to the methods to analyze the mean, standard deviation and variance of series X1 and X2 and optimize the same to obtain robust Y.
3. Aggregate and assess the output from the simulations.

## Step by step example of Monte Carlo simulation

In this example first the regression was run. Furthermore, the results from the predicted regression equation were moved to Monto Carlo simulation window (SPPS, Minitab or any other).  This article presents Monte Carlo simulation in Minitab software.

When the Monte Carlo simulation window opens, it presents the below given fields:

Here, the model is defined and values of X1, X2 and Y  are expressed as per the estimated regression equation. Write the estimated regression equation. Also, using parameter optimization choose the appropriate lower and upper limit of mean and variation. This will help generate the value of Y as per those conditions (not present in the image below).

After inserting the values of all variables, click on ‘simulation’. The results will appear in the form of a histogram showing the value of Y with upper limit and lower limit. Here Monte Carlo simulation uses ‘Parameter Optimization’ with minimum mean settings so that number of defects will be minimum. Like in histogram shown in figure below, the value of Y focuses on the mean and carry minimum defects (variability).