File: ExamplesImmigrationDeath.htd

package info (click to toggle)
cain 1.10+dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 29,856 kB
  • sloc: cpp: 49,612; python: 14,988; xml: 11,654; ansic: 3,644; makefile: 133; sh: 2
file content (114 lines) | stat: -rw-r--r-- 4,466 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<html>
<head>
<title>Immigration-Death</title>
</head>
<body>
<h1>Immigration-Death</h1>

<h2>Transient Dynamics</h2>

<p>
Consider a system with a single species <em>X</em> and two reactions:
immigration and death. The immigration reaction is 0&rarr;<em>X</em>
with a unit propensity factor. The death reaction is <em>X</em>&rarr;0
and has propensity factor 0.1. Since both reactions use mass-action kinetic
laws, the propensities are 1 and 0.1 <em>X</em>, respectively.
Open the file <tt>examples/cain/ImmigrationDeath.xml</tt>. Select the
&quot;ImmigrationDeath&quot; model and the &quot;Direct&quot; method
and then generate 10 trajectories. Below is a plot of these trajectories.
</p>

<p align="center">
<img src="ExamplesImmigrationDeathTimeSeriesDirect.jpg">
</p>

<p>
The analogous deterministic process is <em>X</em>' = 1 - 0.1<em>X</em>.
We numerically solve this equation by selecting &quot;ODE&quot; in the
list of methods and generating a single trajectory. The solution is
shown below.
</p>

<p align="center">
<img src="ExamplesImmigrationDeathTimeSeriesDeterministic.jpg">
</p>

<h2>Steady State</h2>

<p>
Note that both the stochastic model and the deterministic model have a
steady state behavior. For the latter the solution approaches a
stationary point as time increases. We can determine
the steady state solution algebraically by setting <em>X</em>'
to zero and solving
for <em>X</em>, which yields <em>X</em> = 10.
</p>

<p>
The stochastic system does not have the same kind of steady state solution
as the continuous model. At steady state, there is a probability
distribution for the population of <em>X</em>.
To determine this distribution we will record the state in a time
averaged histogram. First select &quot;ImmigrationDeath10&quot;
from the model list, for which the initial population has been set to 10.
Then select &quot;SteadyState&quot; from the list of methods.
From the simulation parameters in the method editor you can see that
the system is allowed to equilibrate for 100 seconds and then the
state is recorded for 10,000 seconds. Generate 10 trajectories and
then plot the resulting empirical probability distribution using
the histograms tab of the plot configuration window. The result is
shown below.
</p>

<p align="center">
<img src="ExamplesImmigrationDeathSteadyState.jpg">
</p>

<p>
From the plot we can see that the distribution is close to a normal
distribution and is centered near
<em>X = 10</em>.  We can obtain statistics on the distribution by
clicking the table button <img src="x-office-spreadsheet.png">&nbsp;
and selecting the &quot;Mean and standard deviation&quot; option.
From this we see that the mean is 9.96 and that the standard deviation
is 3.20.
</p>

<p>
Next one might consider the accuracy of the empirical probability distribution
for the steady state solution. Since the solution is recorded
in multiple histograms, we can estimate the error in the combined
result. Click the table
button <img src="x-office-spreadsheet.png">&nbsp; and select
&quot;Estimated error.&quot; The result depends upon the stream of random
number used, I got an estimated error of 0.0071. This indicates that the
histogram is fairly accurate and captures the typical behavior of the system.
We could obtain a more accurate answer by generating more trajectories.
</p>

<h2>Inhomogeneous Model</h2>

<p>
Now we will consider an inhomogeneous model, meaning that the reaction
propensities have explicit time dependence. In the models list, clone
ImmigrationDeath10 and name the result Periodic. In the reactions
editor, uncheck the MA field for the Immigration reaction. Then change
the propensity function to &quot;1+sin(2*pi*t/20)&quot;, a 
function with a period of 20. In the methods
list, clone Direct and name the result Inhom. Then select the
&quot;Time Inhomogenous&quot; time dependence category in the method
editor. Next change the recording time to 200 and set the number of
frames to 401. Generate a trajectory by clicking the
compile-and-launch button <img src="compile.png">&nbsp; in the
launcher panel. A plot of the species population is shown below. We
can clearly see the effect of the periodic variation in the rate of
the immigration reaction, as well as the stochastic noise.
</p>

<p align="center">
<img src="ExamplesImmigrationDeathInhomogeneous.jpg">
</p>


</body>
</html>