R package for exploration of NetLogo agent based models. Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

A tool for NetLogo experiment definition, exploring simulation results and model optimization. Makes it easy to turn the cycle of experiment definition, data analysis, visualisations and parameter fitting into readable and reproducible documents.

Installation

devtools::install_github("bergant/nlexperiment")

Getting Started

Measures

Fire Experiment example demonstrates how to:

  • define and run experiments, export view images,
  • define temporal measures (step measures),
  • define final measures (simulation run measures),
  • aggregate temporal measures over time.

Segregation example shows how to obtain data from individual NetLogo agents:

  • define and run experiment with “agents-after” measure,
  • visualize position of agents from different groups.

Network example collects values from turtles and their links:

  • define experiment to get data about network structure (turtles, links),
  • recreate network as igraph object,
  • map turtle variables to igraph vertices,
  • aggregate network measures (example in construction).

Traffic example collects values from individual turtles per each time step:

  • definition of “agents step” measure,
  • visualizing several agents’ position and speed in time.

DLA (diffusion-limited aggregation) example demonstrates how to read position and other variables from NetLogo patches (after simulation run).

  • definition of “patches_after”" measure,
  • visualizing patches.

Parameter Sets

The following examples show how to define parameter value sets. See also examples in Sensitivity Analysis for other parameter space exploring methods.

Ants example demonstrates experiment definition with full factorial design and mapping parameters to NetLogo variables.

  • Define parameter value sets as a combination from a list of values
  • Map parameter names to NetLogo variables
  • Visualize several temporal measures with 2D parameter space

Fur Patterns demonstrates explicit definition of parameter value sets with transformed parameter space.

  • Create parameter values
  • Transform values to NetLogo model variables
  • Define experiment with a data frame of parameter sets

Flocking Example demonstrates temporal measure definition and visualization of temporal measures in the parameter space:

  • temporal measure with custom step definition (one step includes several ticks in NetLogo)
  • simulation repetitions of stochastic model with predefined random seeds

It is the first in a series of parameter space exploration of the Flocking model


Categorical Criteria example explores parameter space with full factorial design and categorical criteria:

  • Parameter sets are defined as all combination of values,
  • temporal measures are aggregated in time and used to define a categorical criteria,
  • parameter space is visualized with categorical criteria.

Hyper Latin Cube Sampling examples demontrate how to explore parameter space with categorical criteria and sampling methods.

  • Explore parameter space with categorical criteria (how to define categorical measures from temporal measures)
  • Full factor design and LHC random sampling

Sensitivity Analysis

Example Random sampling explores 5-dimensional parameter space of NetLogo Flocking model with random sampling and scatter plots.

One-at-a-time example demonstrates sensitivity analysis with OAT method.

Example FAST demonstrates sensitivity analysis with Fourier Amplitude Sensitivity Test (FAST).

Optimization

Parameter fitting with best-fit criterion and optimization methods.

Package Documentation

Use R help for function reference. Download documentation in pdf or use package documentation online.