Wednesday, January 02, 2013

An Agent-Based Model of Insurgency

Back in 2007, I created a model in NetLogo that reproduces the research presented in "Modeling civil violence: An agent-based computational approach" by Santa Fe researcher Joshua M. Epstein. The full citation is:


Epstein, J. M. “Modeling Civil Violence: An Agent-based Computational Approach.” Proceedings of the National Academy of Sciences 99, no. 90003 (May 7, 2002): 7243–7250. doi:10.1073/pnas.092080199

Below is a screen shot of my model (click to enlarge). It postulates a toroidal 'world' in which there are civilians and cops. The civilians can become active revolutionaries (red) or remain passive (blue). The cops patrol the landscape and arrest the active revolutionaries, one per turn. The plots on the screen show the number of citizens that are active, and the number that are in jail.

In this model I can vary many of the parameters that were discussed in the 2001 article. But, for the purposes of my research, I have also put in a selector to change the activation pattern.I have been exploring two different activation methods. Epstein used random activation: agents were chosen at random to execute their methods: move and act (cops would arrest, citizens would choose whether they would be active). An additional, typical activation scheme is "uniform", in which all agents get one turn, but their sequence is shuffled each turn. These two methods are analogous to sampling with and without replacement, respectively.

My next problem is: how do I characterize the output? Epstein used the 'pulses' of revolt that appear in the model. So, in order to quantify these pulses I needed to build a 'pulse detector'. This is simply a counting algorithm (written in Python) that creates a sequence of data points for each pulse: the time since the last pulse and the height of the pulse.

This, in turn, requires a definition of a pulse. Epstein arbitrarily chose a value of 50. That is, a 'revolt' event occurs in his data when over fifty agents have converted to 'active' status. The revolt (or pulse) ends when that number drops below 50.

I needed something a little less arbitrary, that could be used for a variety of 'revolt' time series across a broad parameter space. Thus, I chose a threshold of one standard deviation. That is, once the number of 'active' agents goes above the average number of actives plus the standard deviation of the number of actives, there would be a 'pulse'. I used the standard deviation of the whole sample, so this required a completion of the run in order to define a pulse. It could not be computed real-time.

A distribution of these inter-arrival times is shown in the first histogram. This is a model run using random activation, and executed for 25,208 'ticks'. The majority of peaks happen after a wait less than 25 ticks. But, in one instance, a gap of over 200 ticks occurred between peaks. I found that this distribution held for all activation methods and for all the parameter changes I instituted.

Additionally, a similar distribution can be found for the maxima of the peaks. The second histogram shows the distribution of peak heights -- the largest number of active citizens in each peak -- for the same large run. Most revolts involved less than 10 individuals, while a very few exceeded 60. The largest was over 80.

These two output values -- inter-arrival average and average peak height -- represent the 'model behavior parameters' that can be further examined. Thus, with the output quantified, I can then proceed to evaluate the impact of activation schemes on these values. 

I also examined what input parameters could be changed to change the averages of the inter-arrival times and the revolt peaks. The candidates were: citizen vision, cop vision, threshold (for activation), maximum jail term, and a constant, k, that is supposed to create a plausible arrest probability. Citizen vision appears to be one input parameter that makes a difference, so I began with this. Citizens will make several decisions based on what they see. They will chose to become active, in part, based on whether there are 'cops' within their vision, and based upon how many other citizens are already active within their vision. Epstein reported results for a citizen vision of 7.0. I found that interesting results occurred as vision is increased. (Note that, in my explorations, 'cop' vision remains fixed at 7.0. I did not find that varying 'cop' vision changed the output very much. People just got swept into jail more efficiently.)

The results -- the change in inter-arrival time and peak height as a function of different citizen visions -- are shown in the next two scatter plots.






There is, to be sure, quite a variance in the outcomes. But, it can be seen that peak height is highly dependent on activation at all levels of citizen vision, and inter-arrival times of revolts seems to be dependent on activation at higher levels of citizen vision. For random activation, the inter-arrival times seem to become chaotic at a citizen vision of 8.6. Runs at this setting (citizen vision = 8.6, random activation) result in an average gap between peaks that can be as low as 17.9 and as high as 70.9.

I'll discuss all this later, but I thought it would be interesting to post the results. I'm also conducting more runs to help better characterize variation in output. (I'll say more about the behavior of the model as the sample size gets larger in a subsequent post.)

One thing appears to be clear from this data, however. The choice of activation makes a significant difference in quantitative model outcome. 






No comments: