icpsr - complex systems models in the social sciences - lab session 4 - professor daniel martin katz
DESCRIPTION
TRANSCRIPT
Introduction to Computing for Complex Systems
(Lab Session 4)
Daniel Martin KatzMichigan State University
College of Law
Take a Look at this Article
from the Economist
(July 22, 2010)
Agent Based Models and
Positive Economic Theory
Refer Back to my slides about equilibrium and its discontents
Schelling Social Segregation Model
the full model
Print This and Draw the Connections for a Full Map
of the Schelling Code
Mapping of the Schelling Code(%-similar-wanted is a slider)
We Need to see What “update-varables” is Actually Doing
Here we are going to “set” some of our “turtles-own” variables
“Set” the Turtles-own Variable “similar-nearby”
to the count of “turtles-on” neighbors (8 of them)
but only those with color = my color
“Set” the Turtles-own Variable “other-nearby”
to the count of “turtles-on” neighbors (8 of them)
but only those with color = not my color
Take a look at what is happening here
The “happy?” condition is going to be important
involves an agent by agent comparison of the spread between “similarity-wanted” & “similar-nearby”
Now Lets Look at “Update-globals”
It involves “lets” and “sets”
uses the globals but also some of the turtles-own variables
I will allow you to review this on your own
However, consider the syntax of “sum”
(1) Right Click (ctrl + Click on Mac) on the “percent-similar” plot
(2) This will appear and will allow for various modifications(color, interval, etc.)
We now consider the “to go” portion of the code
lets reduce the “to go” procedures
the “to go” portion of the code
above are the major new elements
remember conceptually the model relies upon movement if a turtle is unhappy
Again, we have the “if”
the “to go” portion of the code
The “to go” button with stop when all turtles are “happy?”
Here is how “Happy?” gets set:
model continues to tick until every agent is above the “%-similar-wanted” as set on the slider
create an agentset of “not happy?” turtles
the movement portion of the code
For that agentset we run the “find-new-spot” procedures
We know from the “to go” procedures that this is going to continue to run until the “if” condition is satisfied
the movement portion of the code
the movement portion of the code
the movement portion of the code
Notice that it is going to re-run the “find-new-spot”
If the “if” condition is met
In other words, agents are going to move until they find a open patch
then agent will occupy the center of open patch
Thinking about Extensions to the Schelling Model
This is closer to a “representative agent” model
Agents are homogenous in their %similar-wanted
In reality, there is likely variance across agents
In other words, comparing across agents there are differential preferences with respect to the %similar-wanted
Thinking about Extensions to the Schelling Model
spatial considerations
The 8 neighbors might not be how individuals actually make their assessments
agents might make choices based upon a wider assessment of the neighborhood
there might be different “prices” for different patches (i.e. a simulated housing market)
Thinking about Extensions to the Schelling Model
structural considerations
the model could encode certain barriers to entry to particular neighborhoods
barriers could be highly asymmetric(i.e. red turtles face no barriers and green turtles face high barriers)
An Exercise
Start With the Default Implementation of
Social Segregation
Imagine that you are interested in
developing a certain style of integration
Modify the Code as Needed in Order to Produce The Closest Possible Model Run to the Camouflage
Note: this involves 4 Groups not 2 Groups
Your Goal!
An Exercise
Send Me Your Best Effort
I will announce the Winner
Simple Birth Rates
Simple Birth Rates
Simple Birth Rates
Simple Birth Rates
take a few minutes and play around with the model
consider the questions offered above
Thinking Conceptually:Simple Birth Rates
What Does the Turtle Movement Add to the Model?
Are Turtles Added to the Model? and If So How?
Are Turtles Removed from the Model? and If So How?
Simple Birth Rates:Exploring the Code
Step 1: map the dependancies
Step 2: learn the syntax and functionality for all unknown primitives
Step 3: read each line of code and determine what it doing
Simple Birth Rates
Step 4: sketch a procedures map that follows the chronology of your program
At this point it is more Important for you to go though the models line by line on your own using
the above protocol
Simple Birth Rates
Experiment
Basic Setup
Simple Birth Rates
Death
Plots
Reproduction
Movement
Simple Birth Rates
“To Setup” Procedures
Simple Birth Rates
“To Go” Procedures
Simple Birth Rates
Turtle Movement Procedures
Simple Birth Rates
PleaseReview “ifelse”
How does it work?
Simple Birth Rates
Take a Look at the
Reproduction Procedures
Simple Birth Rates
Death Procedures
Plot Procedures
Simple Birth Rates
Right Click (ctrl + Click on Mac) on the “run experiment” Button
Simple Birth Ratesforever button
Notice observer is selected
Calls upon the go-experiment
sub-procedures
Name of our Button
Simple Birth Rates
Take a look at this for later in the week
Automation is really going to help us
ICPSR - Complex Systems Models in the Social Sciences - Lab Session 3 - Professor Daniel Martin Katz
ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz