Using models for science
Class #6 (Thu., Jan 25)
- Railsback & Grimm, Ch. 5.
This reading sets the stage for answering the big question, “How can we use agent-based models to do science?” There are several aspects to this question, which this chapter will introduce:
- How can we produce quantitative output from our models?
- How can your models read and write data to and from files? (This is important for connecting your model to other parts of your project)
- How should we test our models to make sure they do what we think they do? (More on this in Chapter 6)
- Making your research reproducible by using version control and documentation.
A number of you like to use Excel or statistical analysis tools, such as
Stata. The material in this chapter about
importing and exporting data using text or
.csv files will be very useful for this.
By default, NetLogo only allows you to read in data in simple text files. However, if comes with some extensions that you can use to read in
data from other common file formats, including
.csv and ArcGIS shapefiles and raster (grid) files.
If you want to read in data from csv files, you may want to
look at the documentation for the extension to NetLogo. To use it, you just put the line
includes [csv] as the first line of your
model, and then use functions from the extension, such as
let data csv:from-file "myfile.csv".
To read in date from ArcGIS files, look at the documentation for the extension. You would put the line
extensions [ gis ] as the
first line of your model, and then use functions, such as
gis:load-dataset, which can load vector shape files (
and raster grid files (
.asc). The GIS extension offers a lot of functions for working with vector and raster GIS data.
If you’re interested in using GIS data in your models, take a look at the GIS examples in the NetLogo model library.
You can download the data file with the elevations for the realistic butterfly model from https://ees4760.jgilligan.org/files/models/chapter_05/ElevationData.txt
Errata for Chapter 5:
Page 68: Replace the statement
export-plot "Corridor width" word "Corridor-output-for-q-" q
export-plot "Corridor width" (word "Corridor-output-for-q-" q ".csv")
The revised statement appends the file extension “
.csv” to the file name created via the
wordprimitive. Note that when
wordis used to concatenate more than two values tovether, it and all the values must be inside parentheses.