Or

4
Tutorials that teach
Simulations

Take your pick:

Tutorial

This tutorial talks about simulations. Simulations are a way of modeling random events. So now with a simulation. you are modeling. And so you're creating a fake kind of simulated situation to mimic those random events that you're trying to look at.

With simulation, if you extend the number of times you're repeating it, or use a larger number, so instead of flipping a coin 10 times, if you simulated flipping it 1,000 times, then the law of large numbers is going to tell us that our estimate will get closer and closer to theoretical probability.

So that's one of the chief uses of a simulation, is to verify a probability calculation. So when we either don't know the theoretical probability, or we want to verify that what we found is correct, we can run a simulation.

It's also going to give insight into complicated problems, and into the real world. Now most real world problems end up being quite complicated, because the number of factors involved in a simulation helps us to kind of look at that, in a smaller situation and a clarified way.

Now here's an example. A baseball player gets a hit 25% of the time, and we want to see how he will perform in the next 20 at bats. This is a real world example, it's quite complicated. There are a lot of factors that get involved. But we just want to run a model, to figure out how he's going to perform to make a guess, how he's going to perform in the next 20 at bats.

So first we need to describe the possible outcomes. We have a choice of a hit, or no hit. Those are only two things when he gets at bat. Then we need to link each of those outcomes to one or more random numbers. So here, because he gets a hit 25% of the time, that I need to make sure that the random numbers I assigned to hit match up with that 25%. So here, when I'm choosing multiples of four, then that's going to link nicely to the 25% of the time.

And then no hit, on the other hand, is going to be non-multiples of four.

Now I need to chew the way to get these random numbers. You could use dice, you could use a spinner. So here's what I got. Here's my set of random numbers that I generated. Now, based on those random numbers, I need to assign outcomes between hit and no hit. And if we look back, hit was multiples of 4. So in this list, I'm going to circle all the multiples of 4.

So we're going to circle 56, 68, 44, 60, and 88. Now, if I wanted to, I could repeat this process a number of times. This time I found out that he had five hits, and then the remaining 15 were no hits. If I keep repeating this, I generate new random numbers and I see how many hits I get, I'm going to decrease the variability of the estimate.

Because I'm only looking to predict for 20 at bats, it wouldn't make sense to simulate for a large number, for 1,000 or so, to try and get that law of large numbers involved. So I'm just, if I wanted to, I could repeat it. In this case, I'm not going to.

Now, the last part is to analyze what I got. Analyze the simulated outcomes. And based on this, I would predict that in the next 20 at bats, he would get a hit five times. So that was my simulation there.

Now, another thing to note, is that there's the Monte Carlo method. So there's a set of computer algorithms that rely on repeated random sampling to compute results. It could tell us what could happen, and how likely that is to happen. And it's faster than using a truly random digit table. The pseudo random number algorithms typically used in computer programs.

It's referencing the Monte Carlo method when it's talking about that. It's only pseudo random. It's not actually random, and that's very difficult to do. It's an algorithm, so it can't be random. There's a pattern to it, but it is faster than using a truly digit number table.

This has been your tutorial on simulations.