# How do stochastic simulations work?

Is there any simple (or simplified) explanation for how stochastic simulation work? How those methods could provide the information about the underlying processes that almost impossible to be achieved with non-stochastic models? How stochastic (random) model could link with unknown property of the system?

For example, in the evaluation of mineral distribution in an area (2D or 3D) it is always recommended that to use simulations (specially conditional simulations) instead of estimations (such as kriging, idw etc) since the resulting maps based on simulations could preserve local variations where in almost all estimation methods the smoothing effect exists.

Now the above questions have some physical sense.

-
It would be best to be slightly more specific. Surely your question arises from some specific case you're thinking about. Say at least a little bit about that specific case. –  Karl Sep 27 '11 at 13:53
I added some information. –  Developer Sep 27 '11 at 17:37

At its core, the use of simulation is exploiting the idea that if you repeatedly simulate a process, you can - with a sufficiently large sample size - start to get results that resemble an analytical solution even when that analytical solution is unknown. There are all kinds of questions that can be answered with that - Monte Carlo methods are a pretty sprawling topic, so you might want to consider a more specific question. However, I'll give two examples of techniques where they could be used:

1. You're trying to calculate the power for a proposed study. Either due to the planned statistical analysis, a very sophisticated study design, or wanting to build in some more complexity, there aren't simple power formulas you can use. You can simulate a population with a true value, and see how many times your analysis technique correctly identifies said true value. That percentage is your power.

2. You'd like to explore the impact of a study design choice. For example, in a case-control study, its common to sample cases perfectly (from a registry for example), and then recruit controls though some less perfect method, like random-digit dialing. What happens if there are underlying differences in those populations that are related to your outcome? For complex versions of these questions, there aren't clean, closed form solutions. But you can get the answer by simulating thousands upon thousands of studies recruiting from a population with a known value.

If you provide more details about what exactly you're interested in doing, people might be able to point you toward where simulation might help.

-
(+1) The power analysis example is a good one. In almost every situation I'm interested in knowing power (or sample size for a particular power) under a particular parameter value, simulation is the only practical way I can get a handle on it. –  Macro Sep 27 '11 at 14:49
I added some points. My question is how random (stochastic) sampling could target the underlying process? What is behind stochastic methods that makes links between us as observers and underlying unknown processes? –  Developer Sep 27 '11 at 17:43
@Developer What links us is coding the simulation. You cannot simulate a purely unknown process. Well, I suppose you could, but it would be pretty useless. What links it is the question you ask, and how you answer it. "If this is uniformly distributed, what happens? What if its not?" - those questions are reflected in the underlying simulation code. –  Fomite Sep 28 '11 at 5:43
This answer together with comments looks satisfactory to me. Thanks –  Developer Sep 30 '11 at 16:04

Probably the best idea is just to quote Ulam:

The first thoughts and attempts I made to practice [the Monte Carlo Method] were suggested by a question which occurred to me in 1946 as I was convalescing from an illness and playing solitaires. The question was what are the chances that a Canfield solitaire laid out with 52 cards will come out successfully? After spending a lot of time trying to estimate them by pure combinatorial calculations, I wondered whether a more practical method than "abstract thinking" might not be to lay it out say one hundred times and simply observe and count the number of successful plays. This was already possible to envisage with the beginning of the new era of fast computers, and I immediately thought of problems of neutron diffusion and other questions of mathematical physics, and more generally how to change processes described by certain differential equations into an equivalent form interpretable as a succession of random operations. Later [in 1946], I described the idea to John von Neumann, and we began to plan actual calculations.

-
+1 It's always nice to see such useful historical material. Although it's only implicit in this quotation, the appeal for Ulam, von Neumann, and others is that this technique promises to reveal complex behaviors of systems, such as their dynamics and their natural variation, which goes far beyond mere estimations of expectation as in the Canfield game. –  whuber Sep 27 '11 at 14:41
I also liked it. –  Developer Sep 27 '11 at 17:45

Simulations generally concern estimation of the expected value of some function $f(x)$ of a random variable that has some distribution $\Pr(x)$.

Non-stochastic calculation would be to compute the sum $\text{E}[f(X)] = \sum_x f(x) \Pr(x)$ exhaustively.

The simulation approach is to sample $x_1, \dots, x_n$ from $\Pr(x)$ and then estimate $\text{E}[f(X)]$ by $\sum_i f(x_i) / n$.

-