0

So far, all the experiments I have run using Behaviour Space have been to either record global variables or the average values of agent variables across different agentsets.

However, I need to measure a set of attributes (violence, entitativity, homogeneity, size) of individual emergent agents (extremist groups) at two/three different timesteps each run. I also need to do this across a number of different model scenarios and ideally have it all summarised in the same spreadsheet. The aim is to plot the relationship between each agent attributes, with individual agents as my cases.

I can't seem to workout if this is possible using Behaviour Space. I have tried using e.g. [violence] of groups as a reporter in Behaviour Space, but the output is then a single string variable that I can't do anything with. I've also thought about using the export-world primitive but, from what I understand, this will overwrite the file every time it is executed or create separate files each time.

desertnaut
  • 57,590
  • 26
  • 140
  • 166
  • 1
    In general, it is good to build some monitors and experiment with them a bit until they report what you want. Then you can simply copy that code to be the output to report in BehaviorSpace. But for things this complicated, do not use the BehaviorSpace spreadsheet output, use the Table output. Then you get a csv file that you can process with other software like R or Excel – JenB Apr 25 '21 at 12:54
  • I ended up using the following [solution](https://groups.google.com/g/netlogo-users/c/XrNdWPwoAns/m/Ymcn_2X8AQAJ) suggested by Dale Frakes in the Netlogo User Group forum. It is a bit of 'behaviour space aware' code that generates table output with each turtle (rather than model run) as its cases. The code is easy to follow and I found it particularly intuitive to adapt to my model. – Matthew Hall Apr 25 '21 at 15:27

1 Answers1

1

There may be a more elegant way to do this but the following should work. Create global variables, say v0, v1, v2 ...,vn for the individual violence within group n. Set these at each tick. Report them separately in Behavior space.

Example:

globals [ mass-violence v0 v1 v2]

turtles-own [ violence]

to setup
  clear-all
  create-turtles 3 [ setxy random-xcor random-ycor set violence 0 ]
  reset-ticks
end

to go
     
  set mass-violence 0
  
  if ( ticks > 4 ) [ stop ]
  ask turtles [ set violence random 100  set mass-violence mass-violence + violence]
  
  set v0 [violence] of turtle 0
  set v1 [violence] of turtle 1
  set v2 [violence] of turtle 2
  
  print (word mass-violence " " v0 " " v1 " " v2 )
  tick
end

Or you could parse the string you ended up with in Excel using Excel commands to pull selected items out of the string and put them into separate columns. That would end you up in the same place. For example, 5 runs of the above code produces this: enter image description here

Wade Schuette
  • 1,455
  • 1
  • 8
  • 9