NetLogo provides powerful tools for data collection without programming complex analysis routines.
Monitors: Real-Time Data Tracking¶
Monitors show live values as your model runs:
; In interface, create monitor that shows:
count turtles with [carrying-food?]
; Label it: "Ants with Food"
mean [pheromone] of patches with [pheromone > 0]
; Label it: "Average Pheromone"
ticks
; Label it: "Time Steps"
Strategic monitor placement:
- Outcome variables: Your main research question measures
- Sanity checks: Total population, conservation laws
- Process indicators: Rates of change, intermediate states
Plots: Visualizing Change Over Time¶
Plots track multiple variables and show patterns:
Basic setup in Interface tab:
- Click “Plot” button to create new plot
- Name it (e.g., “Population Dynamics”)
- Set X and Y axis labels and ranges
- Add “pens” for different variables
Code to update plots:
to update-plots
; This automatically runs every tick
; Plot 1: Population by type
set-current-plot "Population Dynamics"
set-current-plot-pen "Cooperators"
plot count turtles with [strategy = "cooperate"]
set-current-plot-pen "Defectors"
plot count turtles with [strategy = "defect"]
; Plot 2: Average satisfaction
set-current-plot "Satisfaction Levels"
set-current-plot-pen "satisfaction"
plot mean [satisfaction] of turtles
end
Histograms: Understanding Distributions¶
See how values are distributed across your population:
; In interface, create histogram
; Set pen update to:
histogram [age] of turtles
; Or show distribution of some other property:
histogram [count link-neighbors] of turtles ; Network degree
histogram [money] of turtles ; Wealth distribution
histogram [satisfaction] of turtles ; Satisfaction levels
Activity: Build Analysis Dashboard¶
Create a complete monitoring system:
- Add 3-4 monitors tracking key variables in your model
- Create 2 plots showing how important things change over time
- Add 1 histogram showing distribution of agent properties
- Run your model and observe what patterns emerge
BehaviorSpace: Systematic Experiments¶
BehaviorSpace runs multiple experiments automatically with different parameter combinations.
Setting up experiments:
- Tools menu → BehaviorSpace
- Click “New” to create experiment
- Vary parameters systematically:
["tolerance" [0.1 0.2 0.3 0.4 0.5]]
["population-size" [100 200 500]]
- Set number of repetitions (e.g., 10 runs per combination)
- Choose which variables to measure:
count turtles with [color = red]
segregation-index
mean [satisfaction] of turtles
- Run experiment (can take a while!)
BehaviorSpace generates spreadsheet with all results for further analysis.