Using models for science

Class #6 (Thu., Jan 25)

Reading:

  • Railsback & Grimm, Ch. 5.

Reading Notes:

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:

  1. How can we produce quantitative output from our models?
  2. 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)
  3. How should we test our models to make sure they do what we think they do? (More on this in Chapter 6)
  4. Making your research reproducible by using version control and documentation.

A number of you like to use Excel or statistical analysis tools, such as R, SPSS, or 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 (.shp) and raster grid files (.grd or .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

    with this:

    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 word primitive. Note that when word is used to concatenate more than two values tovether, it and all the values must be inside parentheses.

arrow_back Prev: Class #5 "Your first model" Next: Class #7 "Testing and validating models" arrow_forward