# A question about an expression definition in Monte Carlo

• UFSJ
In summary, a Monte Carlo simulation is a method for estimating the parameters of a computer model. It involves running a number of trials and measuring the results. To obtain a trustworthy result, you need to use statistics.

#### UFSJ

Hi,
my question is about the correct means of the expression "computer experiment" in a Monte Carlo simulation. What specifically is an "experiment" in a Monte Carlo simulation? Is the same of "Monte Carlo path" or is the whole process adopted to found a magnetization curve, for example?

If the second answer is the correct, how to know how many Monte Carlo experiments I have to do to obtain a trustworthy result??

Thanks a lot!

UFSJ said:
Hi,
my question is about the correct means of the expression "computer experiment" in a Monte Carlo simulation. What specifically is an "experiment" in a Monte Carlo simulation? Is the same of "Monte Carlo path" or is the whole process adopted to found a magnetization curve, for example?
In the context of a Monte Carlo simulation, the word "experiment" usually refers to the whole process of estimating one or more parameters. It is analogous to an experiment you might do in a physics lab. To conduct your experiment you set up your equipment and conduct multiple trials, measuring the results at each trial. You may vary the inputs to see how the outputs vary. Then you apply statistical methods to estimate the uncertainty of your results.

A Monte Carlo experiment follows a similar process. You code a computer model and run multiple trials, measuring the results at each trial. You may vary the inputs of the model to see how the outputs vary. Then you use the same statistical methods as you would in a physical experiment to determine uncertainty.

UFSJ said:
If the second answer is the correct, how to know how many Monte Carlo experiments I have to do to obtain a trustworthy result??

For this you need to use statistics. This is going to depend on what form your data takes. If you are estimating a single parameter for example, you can calculate a 95% confidence interval based on the number of trials. For an output curve, you could calculate a 95% confidence interval for each data point and plot error bars.

Here is a tutorial on Monte Carlo methods that gives a quick summary of most of the important aspects. http://statweb.stanford.edu/~owen/pubtalks/MCQMC2012-Owen-Tutorial.pdf

As I understand a Monte Carlo Method, you set up a random experiment so that the probability of a given event is proportional to the quantity you wish to calculate.

For example, to determine the area of a triangle, I would place the triangle in a larger rectangle and my random experiment would be to select a point with uniform random distribution in the rectangle. I would then carry out the experiment a number of times and determine the proportion within the triangle. That number $\hat{p}$ would be approximately the ratio of their areas and so the triangle area would be estimated as the product of the proportion times the rectangular area.

The question of how any you need to obtain a "trustworthy result" is relative to how precise you need to be and how trustworthy you mean. You need to set up a confidence interval for the proportion and map that interval to a confidence interval for the quantity you're seeking to estimate. You can select an a priori degree of confidence (say 95% or 99%) and then decide on the precision you want (width of the confidence interval) and solve for the sample size.

The relation is:
$$p = \hat{p} \pm \varepsilon,\quad \varepsilon = z_{\alpha/2} \cdot \sqrt{ \frac{\hat{p}(1-\hat{p})}{n}}$$
where $\varepsilon$ is your margin of error with $\alpha$ being the degree of uncertainty, one minus the confidence. Thus for 95% confidence $\alpha = 0.05$. The $z_{\alpha/2}$ is a critical z-score, tables of which you can find on the internet.

You can, for purposes of solving for n, work with the "worst case scenario" where the proportion is about 1/2.
$$\varepsilon = z_{\alpha/2}\sqrt{\frac{1}{4n}}$$
so
$$n \approx \left(\frac{\varepsilon}{4z_{\alpha/2}}\right)^2$$
Note that this $\varepsilon$, margin of error is for the proportion and you must scale it for/from the actual quantity you seek to determine.

I understood!

Thanks guys!

## 1. What is the definition of an expression in Monte Carlo?

An expression in Monte Carlo refers to a mathematical formula that is used to model a complex system or process. It is composed of variables and operators that represent the inputs and outputs of the system, and it is used to calculate the probabilities of various outcomes.

## 2. How is an expression defined in Monte Carlo?

An expression in Monte Carlo is defined by specifying the variables, operators, and their relationships that represent the system being modeled. These expressions are typically written in the form of a computer program or algorithm, and they are used to simulate the behavior of the system over many iterations.

## 3. What is the purpose of using expressions in Monte Carlo?

The purpose of using expressions in Monte Carlo is to model and analyze complex systems that involve randomness or uncertainty. By using these expressions, scientists and researchers can make predictions about how the system will behave and gain insights into the underlying mechanisms and relationships.

## 4. How are expressions used in Monte Carlo simulations?

Expressions in Monte Carlo simulations are used as the basis for generating random inputs and calculating the resulting outputs. These simulations involve running the expression many times with different random inputs to simulate the behavior of the system and determine the probabilities of different outcomes.

## 5. What are some common examples of expressions used in Monte Carlo simulations?

Some common examples of expressions used in Monte Carlo simulations include the Monte Carlo method for estimating pi, the Black-Scholes equation for pricing financial options, and the Metropolis algorithm for simulating physical systems. These expressions can vary greatly depending on the specific system being modeled.