knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "img/README-"
)

nlexperiment

Provides functions to define NetLogo1 experiments with parameter sets, measures and related simulation options in concise structure. The cycle of experiment definition, simulations, data analysis, visualisations and parameter fitting can be easily turned into readable and reproducible documents. It uses RNetLogo2 as an interface to NetLogo environment.

Documentation and Examples

See project website for more information or go through examples to learn how to define and run experiments.

Installation

devtools::install_github("bergant/nlexperiment")

Example

Simple experiment with NetLogo Fire model:3

library(nlexperiment)
nl_netlogo_path("c:/Program Files/NetLogo 6.0.1/app") 

Define the experiment:

experiment <- nl_experiment(
  model_file = "models/Sample Models/Earth Science/Fire.nlogo", 
  while_condition = "any? turtles",
  param_values = list(density = c(57, 59, 61)),
  random_seed = 1,
  step_measures = measures(
    percent_burned = "(burned-trees / initial-trees) * 100"
  )
)

Run the experiment:

result <- nl_run(experiment)  

Plot the results:

nl_show_step(result, x = "step_id", y = "percent_burned", x_param = "density")

See more examples on the project website.


1: Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

2: Jan C. Thiele (2014). R Marries NetLogo: Introduction to the RNetLogo Package. Journal of Statistical Software, 58(2), 1-41. URL http://www.jstatsoft.org/v58/i02/.

3: Wilensky, U. (1997). NetLogo Fire model. http://ccl.northwestern.edu/netlogo/models/Fire. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.



bergant/nlexperiment documentation built on May 12, 2019, 3:05 p.m.