Software, Data and Modelling News
NetLogo meets R: Linking agent-based models with a toolbox for their analysis

https://doi.org/10.1016/j.envsoft.2010.02.008Get rights and content

Abstract

NetLogo is a software platform for agent-based modelling that is increasingly used in ecological and environmental modelling. So far, for comprehensive analyses of agent-based models (ABMs) implemented in NetLogo, results needed to be written to files and evaluated by using external software, for example R. Ideally, however, it would be possible to call any R function from within a NetLogo program. This would allow sophisticated interactive statistical analysis of model structure and dynamics, using R functions and packages for generating certain statistical distributions and experimental design, and for implementing complex descriptive submodels within ABMs. Here we present an R extension of NetLogo. It consists of only nine new NetLogo primitives for sending data between NetLogo and R and for calling R functions (six additional primitives for debugging). We demonstrate the usage of the R extension with three short examples.

Section snippets

Software availability

Name of the software: NetLogo-R-Extension

Availability: Software and documentation are available at http://netlogo-r-ext.berlios.de

Developers: Jan C. Thiele

Year first available: 2010

Software required: Sun Java (JRE/JDK version 1.5 and higher), NetLogo 4.x, Gnu R (2.6 or higher), rJava package for R

Operation systems: Windows, Linux

Programming language: Java

License: GNU GPL with Linking Exception

New primitives

NetLogo’s programming language consists of a large number of commands, or “primitives”. Our R extension adds only nine primitives (see documentation and http://netlogo-r-ext.berlios.de/article_resources.php). The new primitives provide means for sending data from NetLogo to R and vice versa, for evaluating any R command (with the exception mentioned above) and for observing the processes.

Examples

Three examples, which are included in the online attachment (http://netlogo-r-ext.berlios.de/article_resources.php), illustrate how our R extension of NetLogo can be used. The NetLogo program code in the listings contains only the parts where the R extension is used. The complete programs are provided in the examples folder of our R extension of NetLogo.

In the first example, (http://netlogo-r-ext.berlios.de/listing2.php) the R extension is used in the setup procedure to get random values from a

Concluding remarks

Both NetLogo and R are powerful tools with growing user communities. In the fields of agent-based modelling and statistics, respectively, they are increasingly considered as standard software platforms. Combining these tools to tackle environmental and ecological problems provides many benefits. NetLogo users can utilize the power of R without needing to communicate via data files. This offers new and fascinating opportunities to analyse agent-based models interactively and to implement

References (12)

There are more references available in the full text version of this article.

Cited by (49)

  • Investigating path dependence and spatial characteristics for retail success using location allocation and agent-based approaches

    2022, Computers, Environment and Urban Systems
    Citation Excerpt :

    This movement is required since the most widely used ABM development platforms (e.g., NetLogo, Wilensky, 1999; Repast, Collier, 2003) have support for GIS data (Liebert, Earnest, & Tolk, 2008), but lack the fluidity of working with spatial data in R or Python and are restricted in the size of data with which their models can operate (e.g., Sturley et al., 2018). Contemporary tools like PyNetLogo (Jaxa-Rozen & Kwakkel, 2018) and RNetLogo (Thiele & Grimm, 2010) provide wrapper functions to facilitate a more flexible integration between spatial data and processes with ABMs; however, the workflow and knowledge requirements remain inhibiting to novice modellers and coders. Following the technical challenges being overcome by the integration of agent-based modelling and GISystems is the need to better integrate methods of spatial-temporal analysis with simulation methods.

  • Exploring policy options to spur the expansion of ethanol production and consumption in Brazil: An agent-based modeling approach

    2018, Energy Policy
    Citation Excerpt :

    The following description of the agent-based model is based on the ODD (Overview, Design concepts, and Details) protocol proposed by Grimm et al., (2006). The model was implemented in NetLogo (Wilensky, 1999) along with the R extension of NetLogo (Thiele and Grimm, 2010). the aim of the model is to study the influence of various policy instruments on the expansion of the Brazilian sugarcane ethanol market.

  • Agent-Based Modeling

    2017, Comprehensive Geographic Information Systems
  • Can individual variation in phenotypic plasticity enhance population viability?

    2017, Ecological Modelling
    Citation Excerpt :

    The best fitting model is taken to be the model with the combination of parameters that maximizes the correlation between the predicted and the observed λ. Correlations were estimated for each run using the cor.test function in R 3.3.1 (R Core Team, 2016), implemented in NetLogo using the R extension (Thiele and Grimm, 2010). Based on the results of the 500 runs, we calculated the mean correlation coefficient (r) and its 95% confidence interval.

  • Modelling domestic water demand: An agent based approach

    2016, Environmental Modelling and Software
View all citing articles on Scopus
View full text