Models with Randomness

Questions, Leftovers, Etc.

Pulse

What are the factors affecting someone's pulse?

What is Randomness?

Why and how is investing random?

(Aside: If the market is down X percent one day and then goes back up X percent then next day, where are you?)

This is the latest thing in financial advice.

Why is pollution random?

Why would the amount of pollution from a factory be random?

How do we model randomness?

Dice--Integer Uniform

Extend can generate numbers from different distributions.

We can get a generator of die values by using the "Input Random Number" block (Generic Lib > Input). open the dialog and look at the following:

The number of faces on the die, call it N, is

N = (max - min) + 1

Why?

The probability of each face (each number) is

1/N

We'll also use a "histogram" (Plotter Lib > Histogram). We'll look at the dialog for this, too.

Finally, we'll look at how the number of rolls of the dice are determined (Run > Simulation Setup > Continuous Simulations > Number of Steps ).

Our model looks like:

one random number generator and one histogram

We'll run some experiments to explore the questions above and whatever other questions may arise during class.

N-sided Dice

Depending on our model, we may need dice with more or fewer than six sides. (Gamers run into this all the time. Do you know about "percentile dice" used in fantasy role-playing games?) In Extend, it's easy to handle this by adjusting the "min" and "max" values.

Can you think of a physical way to have a 3-sided die?

What if you only had a normal 6-sided die and needed to make a three-way decision?

Functions of Random Numbers

The uniform integer distribution is a pretty flexible kind of generator. Still, there are things it can't do immediately, so we may need to modify the numbers some.

Note that many of the kinds of random numbers have some fixed point (such as starting at zero). Therefore, in the following discussion, we will assume that the uniform integer distribution always has:

min=0
max=N-1

Why N-1?

location: 10-20

Suppose we needed numbers in the range from 10-20, inclusive, instead of starting at 0? What could we do?

one die plus 10

We call this shifting or translating the random variable: changing its location without changing the range or number of values or anything else about the random variable.

scale: 0,10,20...50

What if we needed numbers that weren't consecutive, but were in distances of 10 or 0.1? Use scaling. Like a change of units.

More Generality

Use the equation block.

The Equation block in Extend

Suppose, just for the sake of argument, that we want to compute

Y=3X2+4X+5

Let's try having the 3 come from a constant block instead of being built into the equation.

Sums of two dice

What's the difference between

Y=2X

and

Y=X+X

Let's build a model that has two random number generators (with identical parameters) and another that has a single random number generator but multiplies the result by 2.

The Multisim Plotter

To compare runs, use Plotter, Multisim. Let's build a simple simulation that just sums the random numbers we get. We only need a random number generator, an accumulator, and a plotter (multisim).

In Run > Simulation Setup, modify the number of runs to 5 and the number of steps to be 10. Then run the model. We'll look at the multisim plot together:

Pitfall: different axes

Consider an alternative way to do this:

All in all, not a good option. But maybe for some purposes.

Samples versus Distributions (Populations)

If we roll a die, we get a particular number. That number is called a sample. What is it a sample of? It's a sample of a population of possible outcomes, namely the numbers 1-6.

When we add randomness to a simulation, each run becomes a sample from a (possibly infinite) population of possible runs.

Modifying the Interest Model to use Randomness

We said that the long-run average return on stocks is about 10%. Suppose that the year to year returns range from -20% to +30%.

Let's use the Integer, Uniform to create this. For simplicity, we'll use steps of 0.1.

Here's a model to play with: random-return.mox

Looking at Randomness in the Lake Pollution Model

The Lake Model already has a random number generator in it. We'll replace it with a Integer Uniform between 0 and 2000.

This work is licensed under a Creative Commons License | Creative Commons License | Viewable With Any
Browser | Valid HTML 4.01! | Valid CSS!