# Charles Yoe, Ph.D. College of Notre Dame of Maryland

## Presentation on theme: "Charles Yoe, Ph.D. College of Notre Dame of Maryland"— Presentation transcript:

Charles Yoe, Ph.D. College of Notre Dame of Maryland
Monte Carlo Process Charles Yoe, Ph.D. College of Notre Dame of Maryland Many risk assessment tools are probabilistic. Several of these make extensive use of the Monte Carlo process. This on-line course will introduce you to the workings of the Monte Carlo process through a very simple example.

Analytical Solution Solution meets all criteria of problem 2 + x = 4
x = 2 is a solution that works Some problems have more than one analytical solution x2 = 9 Some problems have no analytical solution It is always better to get the answer to a problem when the answer exists. If we are trying to convert feet to inches we do not want to simulate the number of inches in a foot, although many models could do so quite precisely. There is no need to simulate when we can calculate the answer quite precisely.

Simulation Numerical technique used to estimate analytical solutions to a problem Not an optimization technique, answers what-if questions Results are not analytical solutions Analytical solutions are preferred There are many simulation techniques, Monte Carlo is just one of them. If you have ever seen a video game flight simulator you can easily appreciate the range in simulation techniques that are available.

Monte Carlo Process Code name for simulations relating to development of atomic bomb Applied to wide variety of complex problems involving random behavior Procedure that generates values of a random variable based on one or more probability distributions Not simulation method per se It may be an apocryphal story, but it is too good not to repeat. One story goes that during the development of the atomic bomb the assembled scientists had pretty much convinced themselves that if they initiated the atom splitting process they could contain it. Because that had not yet been done no one could be absolutely certain. It was all theory up to that point. Because the stakes of being wrong were reasonably high they felt they needed to consider as many scenarios as possible. The Monte Carlo process was either invented then or put to good use, depending on the version of the story, in order to explore the possible scenarios that could be encountered in the process of splitting the atom and containing that process. The name is a clear allusion to the gaming tables of Monaco.

Suppose . . . You have a variable that varies between 10 and 50
All you know is theoretical maximum and minimum, any number between is equally likely Suppose you are trying to describe a quantity whose value can vary in an uncertain fashion. It might be the time it takes to complete a process, the time to component failure, the weight of an animal or a commodity, an average or any other continuous random variable. Further suppose you know only that it has a theoretical or practical minimum of 10 and a maximum of 50. Any number between these two is as likely as any other. That is all you know.

Monte Carlo Process Is a process that can generate numbers within that range According to the rules you specify In this case a min and a max Any number as likely as any other number We’re using a simple example to keep the arithmetic easy. The Monte Carlo process works with any distribution you can specify mathematically. The rules for which values get selected with what frequencies are embedded in the math of the distribution you specify.

Monte Carlo Process Two steps Generate a simple random number
Transform it into a useful value using a specific probability distribution The first step is to come up with a number between zero and one in a random fashion. But because we need a number between 10 and 50, this value will not be immediately useful for our problem. It must be transformed to a value between 10 and 50 to be useful to us.

Random Number Generation
Pseudorandom Numbers [0,1] Seed = 6721 (any number) Mid-square Method (John von Neumann) (6721)2 = ; r1= (1718)2 = ; r2= (5152)2 = ; r3= etc. More sophisticated methods now used We’ll demonstrate step one with a random number generator that was used early in the history of this process and that was abandoned almost as early for reasons that will become apparent. It is not hard to see some problems with this method. Suppose you had a large simulation model and needed 100,00 random values for your variable. What is the largest number of values theoretically possible when you use a mid-square of four digits? There are only 10,000 values and that is not enough. So why not square a larger number and use a larger mid square? That may or may not work. Suppose your initial seed is Try it. The sequence yields one “random” number. Other seeds cause a loop after a limited number of values are generated. Because this method was not adequate for many purposes it was quickly abandoned. It is used here because it is very easy to understand, it is part of the random number history, and it illustrates a potential problem with random number generators. Much more efficient algorithms are used today. The example starts with any 4-digit number. Square it and take the middle four numbers. If there is an uneven number of digits simply follow a predetermined rule for the “middle” four. Divide these four digits, the “mid square” by 10,000 to get a random number between 0 and 1.

Transformation (1) Assume Uniform Distribution, U(a,b) where a = 10 and b = 50 To obtain a value, x, we use x = a + (b - a)u In this case, x = u This is the “rule” we’ll use for transforming random numbers into useful numbers.

Transformation (2) Generate U~U(0,1), say u = 0.1718 then
x = 10 +( ) = 16.9 x = 10 +( ) = 30.6 x = 10 +( ) = 31.7, etc. Other distributions are similar but more complex transformations By substituting random numbers for u we can transform numbers on a [0,1} to random numbers from a uniform distribution over [10,50].

This slide shows you another simple example
This slide shows you another simple example. This is a normal distribution with a mean of 35 and a standard deviation of 5. Commercially available software (Palisade has been used to reproduce the Monte Carlo process for this distribution. The cells of the spreadsheet display values sampled from this distribution in a process similar to that just shown. The math is messier with a normal distribution and the mid square method is no longer used, but the two stage process is the same.

Some Language Iteration--one recalculation of the model during a simulation. Uncertain variables are sampled once during each iteration according to their probability distributions Simulation--technique for calculating a model output value many times with different input values. Purpose is to get complete range of all possible scenarios The Monte Carlo process is often used in a simulation. A single simulation is composed of many iterations.

Monte Carlo Simulation
Simulation model that uses the Monte Carlo process Deterministic values in models replaced by distributions Values randomly generated for each probabilistic variable in model and calculations are completed Process repeated desired # times Not all simulations use a Monte Carlo process. Those that do are often called Monte Carlo simulations. The key point is that deterministic values are replaced by distributions.

Monte Carlo Simulation
X = Here is a simple picture of a Monte Carlo simulation model. It shows two random variables being multiplied together. One is a discrete variable the other is continuous. Together they yield the continuous distribution of outputs shown at the bottom. The top left distribution is the number of people who will take a group trip. The top right distribution is the cost per person. Multiply these two values together and you obtain the bottom distribution, the total cost of the trip. Risk assessment addresses the variation in model inputs (top two distributions). Risk management addresses the variation in outputs (bottom distribution).

How Many Iterations? Means often stabilize quickly--few hundred
Estimating probabilities of outcomes takes more Defining tails of output distribution takes many more iterations If extreme events are important it make take many many more Some analysts have estimated that the expected values of output simulations converge after a few hundred iterations. The additional iterations are most useful in providing information about the remainder of the distribution. It takes more iterations to define the output distributions’ tails and more still to identify the extreme events in those tails. When the tails and extreme events are important, you need more iterations than when only expected values matter.

Some Examples The Monte Carlo process is used for several risk assessments linked to the Clearinghouse Salmonella Antimicrobial Resistant Campylobacter The Monte Carlo process has been used extensively in risk assessment. You can see how the process has been used in practice by examining some of the risk assessments linked to this Clearinghouse. The Campylobacter model is the simpler of the two models.

The End