Stata Technical Bulletin
27
Auxiliary equations
If an auxiliary variable (ex: avarl) depends on another auxiliary equation (ex: avar2), the equation for avar2 must precede
the avarl equation in the model listing.
Example of the simula command use
To use simula, it is necessary to have a model coded in the string variable .model present in memory. Using the previous
example of prey-predator interactions, we can load the file volmodi. det before giving the simula command:
. infile using volmodi
dictionary -(
* file "volmodi.det"
* example model for ’’simula” STATA command (4/11/91)
* This is a kind of a VOLTERRA model - without delays
* Ref. J. Maynard Smith, 1974. Models in ecology. Cambridge University Press.
str70 .model ’’Model statements”
(25 observations read)
Parameter values, while defined in the volmodi. det file, can be overridden with the ival () and parv() options. Suppose
that the initial values for X and Y are 800 and 400, respectively, and that Kι,x = 0.07 and K∣,lj = 0.003. The command will be
. simula,dt(0.25) tspan(10) tstart(1991) exo(climate) par(Kbx=0.07 Kby=O.003)
> ival(X=800 Y=400) border c(ll)
Parsing:
Line : 1
Line : 2
Line : 3
(output omitted )
Line: 24
Line: 25
Simulation:
Time=1991
Time=1991.25
Time=1991.5
(output omitted )
Time=2000.5
Time=2000.75
Figure 3, top panel, shows the results. We can take into account the material delay by loading the volmod2.dct file and typing
. simula,dt(0.25) tspan(10) tstart(1991) exo(climate) par(Kbx=0.07 Kby=O.003
> Devt=O.3) ival(X=800 Y=400) border c(ll)
The obtained simulation results are also presented in Figure 3, lower panel. (Stage was used to combine the two graphs produced
by the separate runs of simula.) To obtain a two-dimensional space-state graphic, it is possible to create graphics of X vs. Y
with different initial values and then overlapg them by using Stage. The Appendix reports other simulation examples.
APPENDIX
Example 1 : Exponential growth
a) Positive feedback
Let us simulate the process of weight (IW) increasing in a living organism, particularly during the first development phase.
This process is known to be, generally, exponential and the growth rate (GR) proportional to W by a parameter RGR (relative
growth rate). To simulate this system, we enter the model statements and use simula.
. drop .all
. input str40 .model
.model
1.
2.
3.
4.
ε.
"S W=W+dt*GR
"R GR=RGR*W
"I w=ε
"P RGR=O.1
end
Weight (g)"
Growth rate (g∕day)"
Initial weight (g)"
Relat. growth rate (g∕g∕d)"