Predation on a Vensim programme

Topic: Predation on a Vensim programme

what’s going to happen to the population, according to the example
7. Adding stochasticity
In its current state the model is completely deterministic; that is, it incorporates neither randomness nor uncertainty. However, such stochasticity is ever-present in environmental systems (e.g., the natural variation in the rates at which processes occur in space and time). Thus, it is important to consider how we might include this variability in our models. The easiest way to do this (in this case) is simply to add some „noise‟ to the amount of rainfall that occurs each month. Vensim PLE has some built-in functions that allow you to draw random deviates from the uniform and Gaussian (normal) distributions:
RANDOM UNIFORM( {min} , {max} , {seed} )
RANDOM NORMAL( {min} , {max} , {mean} , {stdev} , {seed} )

In both cases you need to specify a minimum and maximum value. For the Normal you also need to specify the mean and SD of the distribution you wish to draw from. You also need to specify a „seed‟. The „seed‟ kick-starts the random number generator – each seed will generate a different stream of random values; thus if you always use the same seed you will always get the same sequence of random numbers (see Vensim help for more). When the seed passed to the RANDOM functions is zero, they will use the default noise seed. You can control this by creating a variable in the model (usually a constant) called NOISE SEED. When this variable exists in the model its value is used to initialize the noise streams. Changing NOISE SEED will then generate alternative noise streams in different simulations.
As examples:
13
ENVSCI 704. Vensim Session 1 „Getting Started‟

RANDOM UNIFORM( 0 , 99 , 0 )
will generate random uniform deviates between 0 and 99
RANDOM NORMAL( -2 , 2 , 0 , 1 , 0 )
will generate random normal deviates with mean = 1 and SD = 0 truncated at ± 2.

We can use random numbers to simulate uncertainty; for example, if we knew that the uncertainty associated with rainfall at each point in time was 10% we could modify our model such that rainfall was multiplied by a uniform deviate between 0.9 and 1.1 each time it was generated. Changing the seed but using the same minimum and maximum will generate a different series of random deviates but the series will have the same statistical properties – below we will see how the seed can be changed automatically.
ï‚• Try modifying your existing model in this way and then experiment with larger uncertainties.
ï‚• Using a uniform deviate assumes that large deviations from the average are as likely as small ones; this is not usually the case and so we may choose to use the Gaussian distribution to simulate uncertainty.
8. Model sensitivity analysis
Varying Parameters in a Deterministic Model
Sensitivity analysis is an important component of any model evaluation process, whether the model is deterministic or stochastic. We will expect models developed using Vensim to include some form of sensitivity analysis. Vensim PLE Plus can conduct automated sensitivity analysis. As an example we can conduct a sensitivity analysis on the stochastic rainfall model (Step 6 above):
Click Model ïƒ Sensitivity or click on the Sensitivity icon

Select the parameter whose sensitivity you wish to evaluate and the other controls on the

sensitivity:
Understanding how to use random numbers to simulate stochastic processes is likely to prove very important in your project work; few (if any!) environmental or social processes are truly deterministic!
14
ENVSCI 704. Vensim Session 1 „Getting Started‟
Specify the state variables to be saved – in this case soilWater – you can select multiple state variables for analysis.

Run the model

There are three visualisation options for the sensitivity runs; they are available via the three buttons:

15

ENVSCI 704. Vensim Session 1 „Getting Started‟

As per normal to graph the output, click the variable of interest on the workbench (it will need to be one you selected in 3. above). You can then plot: (i) the mean and confidence intervals derived from the simulations, (ii) the individual traces (i.e. every model simulation), and/or (iii) a histogram showing the state variable values at the end of the model run (potentially a very useful way of analysing a model).

Multiple Realisations of a Stochastic Model with Fixed Parameter Values

If you have a stochastic model (e.g. the rainfall-drainage model of Step 7, above) you often want to hold all the parameters fixed but run the model multiple times with different sequences of random numbers (seeds). The sensitivity tool lets you do this by varying the variable that seeds the random number generation – in the model above this is NOISE SEED. Thus, if you set the Sensitivity command to vary NOISE SEED for 200 model runs, you will generate 200 realisations of the model with all parameters fixed but the underlying sequence of random numbers changing. This is a common way to establish baseline conditions (e.g. mean and standard deviation) for stochastic models before performing sensitivity analysis on individual parameters. You can visualise the outcomes of such analyses as described above.

Exporting the Simulations

While Vensim provides graphs of the outcomes of the sensitivity analysis you need to export the data to a package such as R or Excel to produce higher-quality graphics. To do this:

Click Model ïƒ Export

Specify the .vcf file that contains the model runs – this is the data file you have been saving

to in Vensim – and then specify output options.

If exporting a sensitivity analysis you will be asked if you want to export all the data – you do.

Vensim will export the data in a file format (tab-delimited text) that can be read by R or Excel.
16
ENVSCI 704. Vensim Session 1 „Getting Started‟
The manual provides full details on the Sensitivity tool – make good use of it!