Thursday, March 25, 2010

NetLogo & R Extension

I'm really a heavy user of R and was so much before starting to do any agent based models. So the first thing I was looking in any software package for ABM was some automated link to R (much like spgrass6 for GRASS and R for GIS). 
I thought  Repast Simphony was the way to go, since the website claims about capabilities to work along with R, but then I was disappointed to find out that it was only storing the output in a data.frame class object (and besides it does not work on a  Mac…). Then after switching (at this stage almost completely) to NetLogo, I found this awesome extension, currently in beta stage (and alas, still not working on yet on a Mac…) but as far as I've seen it works perfectly fine. 
The NetLogo-R-Extension developed by Jan C. Thiele and Volker Grimm (one of the authors of the ABM textbook of the previous post) links seamlessly NetLogo to R through the rJava package. This means that you can do much more than exporting your results in a data.frame class object: you can call R while your simulation is running!!!! So for instance you can plot the L-function of your agents' spatial distribution on the fly while the simulation is running (see the picture below). But this is just the tip of the iceberg! Since you can virtually call any command in R while running your model, you can save plots in any folder, link to Databases (I haven't tried yet, but I guess it's possible), and virtually do any analysis you would like to do and store it in a .Rdata file!!!



Example of a NetLogo ABM with continuos plot of the L function (along with the Confidence Envelope)

1 comment:

  1. Hi Enrico
    Thanks for posting about this! Would be happy to have you 'guest blog' on electric archaeology sometime.
    Shawn

    ReplyDelete