ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

96
Introduction to Computing for Complex Systems (Lab Session 1) Daniel Martin Katz Michigan State University College of Law

description

 

Transcript of ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Page 1: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Introduction to Computing for Complex Systems

(Lab Session 1)

Daniel Martin KatzMichigan State University

College of Law

Page 2: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Implementation: From Concept to Product

Page 3: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Implementation

It is important to understand the canonical scholarship as highlighted in the lecture

However, model implementation and the mechanics of other forms of analysis is often the barrier to entry for most scholars

Implementation is the link between concept and scientific product

Page 4: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Different Software Packages

Netlogo = Introductory Modeling Environment (Agent Based Models & System Dynamics)

R = Platform for Statistical Analysis (Includes the IGraph Library for Networks)

Vensim / Nova = Development of System Dynamics and Ecological Models

Pajek = Basic Software for Empirical Analysis & Visualization of Networks

Python = Object Oriented Programming Language Flexible and Fast but High Bar to Entry

Page 5: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Getting Started In

Page 6: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Getting Started In Netlogo

Netlogo is an Introductory Modeling Environment

Developed By Uri Wilensky @ Northwestern in 1999

Maintained by Center for Connected Learning & Computer-Based Modeling @ Northwestern

Page 7: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Getting Started In Netlogo

Syntax is Inherited from the old “Logo” Language

Resnick (1991)

Wilensky (1999)

Papert & Minsky (1967)

Page 8: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Getting Started In Netlogo

Features Aspects of Programming But is Not a General Language ( C++, Python, Java)

Arguably Easier To Learn Than A General Language

Serves the Implementation Needs of Many Modelers

Page 9: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Getting Started In Netlogo

Agent Based Models, System Dynamics Models, Network Models, GIS, Etc.

Download @ ccl.northwestern.edu/

Should Also Acquire User Manual & Dictionary

Version 4.1, Version 4.1 3D, Version 3.1.5

Page 10: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Getting Started In Netlogo

HIV / AIDS VOTING

Page 11: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Where To Get Help

Page 12: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Where To Get Help

Page 13: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Netlogo Front Page

Page 14: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Getting Started in Netlogo

Page 15: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Getting Started in Netlogo

Files Have a Extension of .nlogo

Page 16: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Interface

Information

Procedures

Page 17: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Interface

Information

Procedures

Page 18: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Edit theInformation

Page 19: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Interface

Information

Procedures

Page 20: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Code for the

Schelling’sSegregation

Model

Page 21: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz
Page 22: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Models Library

Explore the Available Models

Page 23: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Getting Started in Netlogo

Page 24: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz
Page 25: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz
Page 26: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Getting Started in Netlogo

Page 27: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Getting Started in Netlogo

Page 28: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz
Page 29: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Getting Started in Netlogo

Page 30: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Controls

executes specific commands “on the fly”

Buttons

Command Center

“once” buttons execute one Action

“forever” buttons repeat the same action (Until Stopped)

Page 31: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Settings

Sliders

Switchers

Select a value from a list

Adjust a quantity by increments

Choosers

Set a Boolean variable (true/false)

Page 32: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Monitors

Plots

Offers the Current Value of Variables

Displays the Time Series Plot for a Given Variable or Variables

Views

Page 33: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Netlogo Language

Page 34: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Four Types of Agents

Patches

Turtles

Links

The Observer

Page 35: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Patches

Tile  System  with  (0,0)  Center  Origin

pxcormin-­‐pxcormax-­‐pxcorworld-­‐heightworld-­‐width

Page 36: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

View the Settings

Page 37: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

View the Settings

Page 38: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

View the Settings

Page 39: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

View the Settings

Page 40: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

View the Settings

Page 41: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

What is a Torus?

Why is It 33 x 33?

View the Settings

Page 42: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Patches: Key Things

Patches do not move -- they are fixed

Patches can breed turtles

Patches can have assigned variables

Patches belong to an agent set

Page 43: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Consulting the Netlogo Dictionary

Descriptions of Patch Primitives Can Be Accessed

Through theNetlogo

Dictionary

Page 44: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Turtles

Turtles  move  on  top  of  the  patches

Have  decimal  coordinates  (xcor,  ycor)  

Have  an  orientation  (heading)  

Can  have  different  shapes  

Page 45: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Turtles

Classic  Hawk  &  Dove  Model  from  Evolutionary  Game  Theory

Runs  in  Netlogo  Version  3.1.5

Page 46: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Inspect Turtles

Right Click on a Turtle (Ctrl + Click on Mac)

Page 47: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Watch a Specific Turtle

Right Click on a Turtle (Ctrl + Click on Mac)

Page 48: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Lots of Different Turtle Shapes

Page 49: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Turtles: Key Things

Turtles move around the environment

Turtles can have various shapes

Turtles can have different variables

Turtles belong to an agent set

Page 50: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Colors

color  =  agentspcolor  =  patches

Select  a  Major  Color  by  Name  

Customize  Colors  Using  ##  from  Chart

Page 51: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz
Page 52: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Exploring the Forest Fire Model

http://ccl.northwestern.edu/netlogo/models/Fire

Page 53: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Page 54: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Page 55: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Page 56: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Page 57: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Page 58: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Page 59: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Page 60: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Page 61: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Page 62: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Page 63: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Page 64: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Page 65: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Page 66: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Page 67: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Page 68: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

http://ccl.northwestern.edu/netlogo/models/Fire

Page 69: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

http://ccl.northwestern.edu/netlogo/models/Fire

Page 70: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

http://ccl.northwestern.edu/netlogo/models/Fire

Page 71: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

http://ccl.northwestern.edu/netlogo/models/Fire

Page 72: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

http://ccl.northwestern.edu/netlogo/models/Fire

Page 73: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

http://ccl.northwestern.edu/netlogo/models/Fire

Page 74: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

http://ccl.northwestern.edu/netlogo/models/Fire

The Forest Fire Model

Page 75: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Tally the Average of five model runs

For Values

50, 55, 60, 65

Page 76: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Average2.6

Page 77: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Average2.6

Average5.8

Page 78: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Average2.6

Average5.8

Average66.5

Page 79: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Average2.6

Average5.8

Average66.5

Average93.9

Page 80: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Average5.8

Average66.5

Parallel Processing on Percolation Threshold

Page 81: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Lets Do Some additional in Class Data Collection

On Our Fire Model

56

57

58

59

Page 82: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Now LetsDiscuss

The Results

Page 83: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

Explore the Code

Page 84: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz
Page 85: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz
Page 86: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Page 87: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz
Page 88: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

;; is for CommentsNot Active

code

Page 89: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

What is a Global?

Look it up in the dictionary

Page 90: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

What is a Global?

Page 91: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz
Page 92: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz
Page 93: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

What is a breed?

again, look it up in the dictionary

Page 94: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

What is a breed?

Page 95: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model

Page 96: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 1 - Professor Daniel Martin Katz

The Forest Fire Model