Once we have specified the INPUT and the logic, we can run the simulation to see the outcomes. The OUTPUT is the measurements of the outcomes. For example, the mean profit and its 95 percent confidence internal. Typically it involves statistic analysis. Taking together, we have
To illustrate, we consider a dart game. Kobe is to play the dart game with his friend. The board is of two by two size, with the circle of radius one. Kobe is a lousy shooter. He can make each shot on the square board, beyond that his shots are random. His friend makes a generous offer: Kobe gets free beer if he hits in the circle. So what is the probability that Kobe gets free bee?
There are several ways to solve this problem. For example, since Kobe shots uniformly on the dart board, his chance of hitting the board is one. Given that, his chance of hitting in the circle would equal the ratio between the circle area and the board area: .
This approach requires the knowledge of the circle area formula and the value of pi. If you don’t, you can still figure out through experiments, e.g., by asking Kobe to shot. For example, If Kobe shots times, and you can count the number of times he hits in the circle. Then .
When the sample size is large, it may be too costly or even infeasible to do real experiments. Instead, we can carry out on computer. We focus on a quarter of the board. First, specify the INPUT. In this case, we know there is only one random variable, the shot , and . In Excel: RAND().
Next, we figure out the logic. For each shot , we need to know whether it is a hit. That is, , where is the distance between the shot and the center . So is an indicator. In Excel: , or simply .
To generate a sample, we replicate shots. For each shot , we know whether it is a hit, or . We then do statistic analysis. The total number of hits is , and the probability .
Simulation is a way of thinking. Just as every story has actors, plots, and contexts, so does simulation. In a story, we want to know how the actors interact, under what context, and what is the outcome of their play. In simulation, random variables are our heroes, and we seek to understand how and why their interplay leads to certain outcomes.
For each simulation, we must first specify the relevant random variables. Like actors, they each have names and behaviors (personalities, characters). For example, Bernoulli, Binomial, and Normal are the names of typical random variables. Their behaviors are uniquely defined by their distribution functions—probability distribution function (PDF) , or cumulative distribution function (CDF) . Depending on the problem, either one can be pleasant to work with. Their relation is
Second, we care about the context of the simulation. This is done by specifying the economic and other environmental parameters. For example, the time horizon, the production cost, and the market price. Along with the parameters of random variables, they constitute the INPUT of the simulation.
Third, we need to figure out the logic—the plot—of the simulation. That is, how the random variables interact in each context. This is the most important but least teachable part of the simulation, because the logic depends on the problem specifics, and there is no universal rule for all problems. We must analyze each on its own merit.