More Models

We'll talk about some other kinds of models today. We'll have time in lab to play with them and others.

Populations versus Samples versus Distributions

There have been a few questions about distributions versus samples, so I'd like to take a couple of minutes to review that:

Continuous Random Variables

Unlike discrete random numbers, which only take on a few values, usually integers, continuous random numbers take on any real number in the range.

Uniform Random Numbers

Let's start with the "Real, Uniform" RNG. Essentially, like the "Integer, Uniform," you give a min and a max and it generates a number in that range, but it can be any real number, so you can get fractional values as well. They are all equally likely.

This is all pretty intuitive, but when we start thinking about the probability of a number, things get strange. We'll talk more about this in a couple of weeks, but for now let's leave it intuitive: all the numbers in the range are equally likely.

To do: Using Extend, generate some "real, uniform" random numbers and do a histogram of them.

Birth and Death

Birth rate models often look like this:

births = population * birth-rate

Q: This gives us exponential growth. Why?

Death is also often (not always) proportional to population:

deaths = population * deathRate

Here's a model that combines both:

birth-death.mox

What are some other models of death?

Newtonian Cooling

Isaac Newton's law of cooling is that the amount that something cools is proportional to the difference in temperature between the object and the outside environment.

cooling = -k ( temp - env )

The constant k depends on the object and can be experimentally determined.

Here's a problem from CSI: Suppose k for a dead body is 0.1438. The body is found at midnight with a temperature of 75 degrees in a motel room that is 60 degrees.

Q: At what time did the person die? Here's a model that does that:

newton-cool.mox

Exponential decay curves are often found in nature (say, diffusion processes), anytime when change is proportional to the difference between two things. Keep an eye out for them.

Simulation Order

I ran into a problem building the cooling model, and I want to share with you what I learned.

Resource Usage

Population models are often combined with resources: the population consumes the resource. We might be interested in when the resource runs out, and different ways in which the amount of resource might affect

Let's look at a model like that. Play with it.

Q: When does the resource run out? Can you get it to last for 50 years?

resource1.mox

One way that the birth rate might depend on the resource is as a threshold: births are normal until the resource drops below some minimum, then births are suspended. Thus:

resource2.mox

Take some time to study this model. It introduces a new block: Select Input. Essentially, it chooses either its the upper or lower input, depending on whether the bottom input (T) is greater than the critical value (CV, a constant you set in the dialog box). If T < CV, the top input is chosen; if T >= CV, the bottom input is chosen. Read the documentation for more detail.

Q: When does the population start to decline? Why?

One way that death rate might depend on the resource is as direct function: the closer the resource to zero, the closer the death rate to 100 percent. A function like this might do the trick:

deathRate = 1-(currentResource/initialResource)

Finally, we can have the consumption depend on the amount remaining: as the resource gets more scarce, per capita consumption goes down. A model like the deathRate one would work. It needs to start at some desired rate of consumption, C, then decline towards zero as the resource goes to zero. For example:

consumeRate = C*(currentResource/initialResource)

Thus

resource3.mox

Q: What is the eventual amount of resource? How could we get a model that uses up more of the resource?

As long as the resource continues to diminish, the population will always eventually die out. See if you can find a model where the population dies out at about the same time that the resource is exhausted.

Implement some way for the resource to be replenished. This can be a simple constant growth rate, or it can be proportional, or whatever you like. What is the long term stable value of the population and resource?

Sensitivity Analyses

Very often, we want to run a model several times with different values of a parameter that we think matters. We want to see if the model is sensitive to that parameter.

Extend can help us do this sensitivity analysis. Do the following:

Reports

The plotters give us a general feel for the results, but if we want actual numbers, one way is to get a report.

After the simulation runs, the report is automatically displayed. Notice how you can get the final value of the holding tank (the pollution in the lake) in each scenario.

Monte Carlo Simulations

If you have a simulation that includes randomness, there's little point in running it only once. That's like rolling a die only once: you can't learn very much about the probability of different outcomes rolling it once.

Add a histogram to the Lake Pollution model. Use the dialog box to specify that you want to collect values for each run not each time step. Collect data on the lake pollution. Use the "simulation setup" to specify 10 runs, and then run the simulation.

Add a "Generic Lib > Statistics > Mean & Variance" block to the Lake Model. Specify collecting data only for each run.


Questions and Answers

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