Skip to content

Stochastic ant colony model

ants_stochastic

Previously on Physics of Risk website we have presented Kirman’s ant colony agent based model 1, where each ant was represented as an agent. In this article we will move from the agent based model framework to the stochastic differential equation framework. Thus showing that in case of simple agent based models full transition to stochastic framework is possible. This transition is very important as stochastic framework is very popular and well developed in quantitative finance. The problem is that stochastic framework mainly gives only a macroscopic insight into the modeled system, while microscopic behavior currently is also of big interest.

Derivation of stochastic differential equation

In this section of the article we will follow derivation of stochastic differential equation, analogous to the previously discussed agent based model, done by Alfarano and Lux in 2. Authors of 2 in their derivation follow the underlying ideas of birth-death processes or one-step processes, overview of which is given in most of handbooks concerning Stochastic Calculus. Thus if you want to get more familiar with the ideas bellow you shoud see 3 or other similar works.

Alfarano and Lux start by simplifying notation, used in the previous agent based model, of system state, defined as number of ants using one of the food sources, 02129bb861061d1a052c592e2dc6b383 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano , transition probabilities,

5f5705ab44eadb34add0b9fda63a513b T 000000 0 ordinary Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano dc6cb1849d8638f5454ff205f481d0b9 T 000000 0 ordinary Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano

where 443f1ce7caed387759d6aaf5dae5ad71 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano stands for 85885c78527a24442c7c4545e2f0843c T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano and 67c21025f15808eab4a6996b96c41d3d T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano for 235e7dae3360c4148ab97cedd6f0ee47 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano . In such case Master equation, for very short times 5a72f1304af0783657605aed0e38201a T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano , can be expressed as

7d0e22ccfc0ac051536c8eaa4a540789 T 000000 0 ordinary Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano

here 5cf76054a417892bf307de1d00cea4dc T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano is probability for system to be in the state described by agent number 02129bb861061d1a052c592e2dc6b383 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano , or in the other words probability of 02129bb861061d1a052c592e2dc6b383 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano ants at a given time to be using one of the two food sources.

It is comfortable for further derivation to introduce, from the Master equation above, total probability flux, a49769d46301476c88f893548585e7a2 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano , between states d448eaa1c4b19b3634c6bc4035a9f37f T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano and d4c2e2e18304f3d0d71babd22ba2878e T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano . Latter can be expressed as

e065b3fc55078e83edc3926d7a5fead0 T 000000 0 ordinary Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano

here first term describes transitions from d4c2e2e18304f3d0d71babd22ba2878e T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano to d448eaa1c4b19b3634c6bc4035a9f37f T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano , while the second term describes transitions in the opposite direction – from d448eaa1c4b19b3634c6bc4035a9f37f T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano to d4c2e2e18304f3d0d71babd22ba2878e T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano . Thus if flux, a49769d46301476c88f893548585e7a2 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano , is possitive system state with larger 02129bb861061d1a052c592e2dc6b383 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano becomes more probable than the system state with smaller 02129bb861061d1a052c592e2dc6b383 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano . Now by using defined probability fluxes and Master equation above one can obtain a discrete continuity equation

232671ca0a78c833c35f89c3b53d3c89 T 000000 0 ordinary Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano

The interpretation of this equation is generaly the same as, for example, in case of electric current continuity equation – if flux outside of current system state (or differential volume in case of electric current) is positive, the probability (analogous to charge) density of this system state will decrease. This idea stands behind the idea of local continuity. If probability flux vanishes at some boundaries, let say 590f253783a788cf4dcd63938c40e534 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano , then one can show that e4e6a665d3894b0357b5af5f831bffdf T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano is true for every time moment. The last result actually stands behind the idea of the global continuity.

Now lets move on from the discrete case of 8fdaa9b0a7c7940ecd97b4b3cd488a26 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano to continous case with 21c59e8e7d5b2fb04d943d1bd4130018 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano , applying transformation 1cb43a7c80debd6803668700f5ad940a T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano , where 524ce044c402a61b400bc14273b8cdda T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano . One can reexpress probability of continous system state through discrete system state as

bfc5f546a7a7dc77dd57c6620adbe281 T 000000 0 ordinary Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano

and total probability flux as

3be28c9351d35fcd5dd772d7e9505940 T 000000 0 ordinary Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano

The reasoning behind the offset in the latter equation lies within the fact that flux noted by 92be1e84a17adfa36fd7bd66a36402ea T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano connects two discrete states d4c2e2e18304f3d0d71babd22ba2878e T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano and d448eaa1c4b19b3634c6bc4035a9f37f T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano , thus it should be located in the middle of that interval. This offset also helps to avoid tedious mathematics in further derivation. Alfarano and Lux also mention that this offset in flux is widely used in discretization of Maxwell’s equations and in gauge theories on a discrete lattices (see the references in 2).

One can rewrite the above discrete continuity equation in continous terms by taking analogy with electric current continuity equation or by expanding a5777b57d07587610418bde61072533b T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano using Taylor series expansion (droping second order, d081879e9804c9b9e47386c070bac07e T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano , and above terms). Either way one would obtain,

0e2c1a06121f7f59970daac67c5d1d3a T 000000 0 ordinary Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano

continuity equation for continous time (is introduced by assuming that 7777cac5761add4e2b8bff8cd3c610ef T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano ) and space.

Now let’s recall definition of total probability flux in discrete terms and rewrite it in continous terms. In the process it becomes

702f6a59138d877b1dae431524b9fdf3 T 000000 0 ordinary Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano

In the equation above 9dd4e461268c8034f5c8564e155c67a6 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano was additionaly shifted by e9604f3e2de570387b387e947dc7f2a6 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano .

When 524ce044c402a61b400bc14273b8cdda T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano , we can also expand 1e9fd69ca97ed0ec7e76171b5dd8c5c8 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano , using Taylor series expansion (up to second order), as 885d87d87c5b721959d788ba3a65f7ad T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano . And thus we finally obtain

4fc022df41257908db849c5bcd02e2ca T 000000 0 ordinary Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano

Now one should put into the equation above definitions of c16321d388a5ce61680163e140dc8050 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano and e0b5243799594051ff7b1a0f2677d22f T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano to make one more step in derivation, but before this it is comfortable to define two custom functions

b4b56e130f8cbf1a259fe7eae7ae7d6c T 000000 0 ordinary Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano bf7b5c5dfd85ac57b2b9293edebf3f98 T 000000 0 ordinary Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano

Then after putting in definitions of transitions probabilities, c16321d388a5ce61680163e140dc8050 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano and e0b5243799594051ff7b1a0f2677d22f T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano , and droping terms of second order and above one obtains

af2ff3d4a8557f15c8529fc9d256a087 T 000000 0 ordinary Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano

And then from continuity equation one can obtain Fokker-Plank equation

36df4a72c3acda6ad91ea38b9e5e29c8 T 000000 0 ordinary Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano

which produces the same dynamics as agent based model. Note that custom functions, which were introduced before, have special meaning – 7852db5d43d5ab2b22775d9f2131b869 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano describes drift of the system state and 15444eb27adfc21cf2a51f356dc5fa78 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano describes it’s diffusion.

Fokker-Plank equation above can be altenatively modeled using Langevin stochastic differential equation (for general details on conversion see 3)

c876f1e7f9bc7a52f4addff76aa084b9 T 000000 0 ordinary Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano

and in the limit of high 8d9c307cb7f3c4a32822a51922d1ceaa T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano

993cb4ad9a57da8673e97759d23d2d20 T 000000 0 ordinary Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano

here 61e9c06ea9a85a5088a499df6458d276 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano is Wiener-Brownian process. This, final, equation is solved in the java applet bellow.

Observed population fraction dynamics

The only thing, which has changed since the previous implementation of Kirman’s ant colony model, is modeling framework – in the section above we have derived Langevin equation for Kirman’s ant colony. Thus observations discussed in the previous article also apply towards this model. This time we just limit ourselves to simply showing that Langevin equation and agent based model produce same results using same parameter values (see Fig 1.).

sde abm comparison Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano

Fig 1. Comparison of probability density function (a) and power spectral density (b) of external observable, x, time series, which were produced by agent based model (points) and stochastic model (lines). Parameters are set as follows: h=1 (same in all cases), σ1=0.2 (red points, blue lines), σ1=16 (magenta points, cyan lines), σ2=5 (same in all cases).

Population fraction SDE Applet

In the applet bellow we solve aforementioned Langevin equation using simple Euler-Maruyama method (see 4). Using this method we transform stochastic differential equation into difference equation

4a24fc655ac3d5d4d9ec812bdeb74b5a T 000000 0 ordinary Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano

where 663fb10dd83cc51138bfd9cfb3a49833 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano is Gaussian random variable with zero mean and unit variance. As 9dd4e461268c8034f5c8564e155c67a6 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano has meaning only in the interval 9222b04fb332304262efba9d6c4718b9 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano , we also enforce boundary conditions to restrict 1ba8aaab47179b3d3e24b0ccea9f4e30 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano values. And in order for numerical solution to be stable we require that ad366801d8b2fd059b84bad187500ea4 T 000000 0 inline Stochastic ant colony model stochastic interactive models econophysics agents  Lux Kirman model biology Alfarano .

Above you should see Java applet. If you do not see it, then please make sure that you have JRE installed and that your browser has Java enabled. Also make sure that you are running newest available JRE version. Newest JRE version can be downloaded from http://java.com/getjava.

References

  • A. P. Kirman. Ants, rationality and recruitment. Quarterly Journal of Economics 108, 1993, pp. 137-156.
  • S. Alfarano, T. Lux, F. Wagner. Estimation of Agent-Based Models: The Case of an Asymmetric Herding Model. Computational Economics 26 (1), 2005, pp. 19-49.
  • C. W. Gardiner. Handbook of stochastic methods. Springer, Berlin, 2009.
  • P. E. Kloeden, E. Platen. Numerical Solution of Stochastic Differential Equations. Springer, Berlin, 1999.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Image with challenge