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

950 views

Published on

Published in: Education, Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
950
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
61
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

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

  1. 1. Introduction to Computing for Complex Systems (Lab Session 3) daniel martin katz illinois institute of technology chicago kent college of law @computationaldanielmartinkatz.com computationallegalstudies.com
  2. 2. A Few Books Worth Considering
  3. 3. Goals for Today Finish Exploration of the Forest Fire Model Begin exploration of the Schelling Segregation Model
  4. 4. Every item in our Model is: Important Principles from Our Last Session (1) Defined within the Model (2) Is a Primitive that is defined in the Netlogo Dictionary OR (remember we can think of primitives as the raw materials of models) (such as in Globals, Breeds or in a subroutine)
  5. 5. Exploring the Forest Fire Model http://ccl.northwestern.edu/netlogo/models/Fire (CONDT.)
  6. 6. The Forest Fire Model
  7. 7. The Forest Fire Model
  8. 8. 3-D Forest Fire Model
  9. 9. (1) Modify the Color of the Forest to Blue (2) Make the Fire Move North to South Instead of West to East How Did We Do?
  10. 10. Modify the Color of the Forest to Blue
  11. 11. What Elements of the Code Do We Modify?
  12. 12. The Forest Fire Model Procedures
  13. 13. The Forest Fire Model Procedures
  14. 14. Make the Fire Move North to South Instead of West to East
  15. 15. Make the Fire Move North to South Instead of West to East
  16. 16. What Elements of the Code Do We Modify?
  17. 17. The Forest Fire Model Procedures
  18. 18. The Forest Fire Model Procedures Try this Instead:
  19. 19. In what sense is this model random? In what sense is this model deterministic? Thinking conceptually about the model procedures all of these models involve a mixture of determinism and randomness
  20. 20. In what sense is this model random? Thinking conceptually about the model procedures Placement of the patches subject to the selected density level
  21. 21. Watch the Model in 3D
  22. 22. Watch the Model in 3D
  23. 23. Watch the Model in 3D
  24. 24. Watch the Model in 3D
  25. 25. In what sense is this model deterministic? Thinking conceptually about the model procedures The fire is really for G.U.I. purposes result is basically already determined before the fire spreads
  26. 26. Back to the Forest Fire Model Procedures
  27. 27. relies upon: if not any? stop ask fires ask neighbors4 fade-embers ignite tick The ‘To Go’ Procedure
  28. 28. if is a condition and you can think of it as: if x condition is met than do action y (otherwise move on to the next line) The ‘To Go’ Procedure
  29. 29. This is going to kill the model if condition is achieved vs. Forever Button Once-only Button The ‘To Go’ Procedure
  30. 30. Why is this Arguably the KEY piece of code? What does it mean in plain english? The ‘To Go’ Procedure
  31. 31. What is neighbors4? Remember our basic rule: The ‘To Go’ Procedure It is defined within the program or it is one of the netlogo primitives
  32. 32. The ‘To Go’ Procedure
  33. 33. Neighbors and Neighbors4 turtle turtle neighbors4 neighbors (think of this as the 8 neighbors) turtle
  34. 34. (a) we are asking “fires” The ‘To Go’ Procedure (b) to ask their 4 neighbors (c) the 4 neighbors that are green (d) to run the “ignite” protocol (e) and then set their breed to embers (f) now run the “fade-embers” protocol
  35. 35. The ‘To Go’ Procedure
  36. 36. The ‘To Go’ Procedure
  37. 37. The ‘To Go’ Procedure When is this finally going to halt? It is a forever button which can be halted using “STOP” “STOP” is triggered when the “if” condition is satisfied
  38. 38. Lets Discuss Some Extensions of The Forest Fire Model
  39. 39. Extensions of The Forest Fire Model What are the actual dynamics that generate and sustain forest fires? What else could we incorporate into this model?
  40. 40. A Non-Exhaustive List Differential Levels of Moisture Variable Terrain (Rivers, etc.) Prior Interventions (Firewalls, etc) Wind and other Weather Patterns
  41. 41. Some of the Existing Extensions
  42. 42. different forms of implementation may impact the results Implementation Matters different forms of implementation may be more qualitatively appropriate sophistication regarding implementation allows you to be a more critical consumer of scholarship
  43. 43. the neighbors4 example
  44. 44. Neighbors and Neighbors4 turtle turtle neighbors4 neighbors (think of this as the 8 neighbors) turtle
  45. 45. Neighbors and Neighbors4 neighbors (think of this as the 8 neighbors) what did the implementer of the model decide? neighbors4 decided that the fire could not move diagonally this is probably not qualitatively reasonable
  46. 46. Step 1: map the dependancies Step 2: learn the syntax and functionality for all unknown primitives Protocol to Decode 3rd Party Implementation Step 3: read each line of code and determine what it doing
  47. 47. Mapping of the Code
  48. 48. just some examples of primitives from the dictionary that we have already learned Protocol to Decode 3rd Party Implementation
  49. 49. Next We Went Line by Line Through the Code
  50. 50. Step 4: sketch a procedures map that follows the chronology of your program There is one additional step that often proves useful Protocol to Decode 3rd Party Implementation Particularly when you are writing a model from scratch
  51. 51. Very Rough Sketch of the Fire Procedures Map (1) (2) (1)(a)(i) (1)(a) (1)(a)(ii) (1)(b) the point is just to aid in your understanding (2)(a) (2)(a)(i) (2)(a)(i)(I) (2)(b) (2)(b)(i) (3) - End Loop Until “if” Condition is met
  52. 52. The Value for Global Must Get “Set” Somewhere in the Model Procedures Globals -- one other note
  53. 53. Mapping of the Code
  54. 54. Introduction to the Schelling Segregation Model
  55. 55. What Does this Title Mean? What is the micro to macro disconnect? relationship to the ecological inference fallacy?
  56. 56. Schelling Social Segregation Model
  57. 57. Schelling Social Segregation Model
  58. 58. Schelling Social Segregation Model
  59. 59. Schelling Social Segregation Model
  60. 60. Schelling Social Segregation Model
  61. 61. Schelling Social Segregation Model
  62. 62. Schelling Social Segregation Model versus note: stopped model before % unhappy = 0
  63. 63. Schelling Social Segregation Model Test these Parameters and report Results
  64. 64. Schelling Social Segregation Model
  65. 65. Schelling Social Segregation Model
  66. 66. Schelling Social Segregation Model
  67. 67. Schelling Social Segregation Model versus
  68. 68. Schelling Social Segregation Model
  69. 69. the full model
  70. 70. Print This and Draw the Connections for a Full Map of the Schelling Code
  71. 71. Mapping of the Schelling Code (%-similar-wanted is a slider)
  72. 72. Learn the Syntax and Functionality for all unknown Primitives (starting with “to setup”)
  73. 73. Again this is the conditional “if” statement It is relying upon “number” Is number a netlogo primitive?
  74. 74. It is the name of the slider How could I rename this “totalagents”? Take 5 minutes and Try to Figure it out
  75. 75. (1) Right Click (ctrl + Click on Mac) on the “number” slider (2) change the global variable name from “number” to “totalagents” Modifying the name (or values) of a Slider
  76. 76. Modifying the name (or values) of a Slider Notice the error Message Must Change all instances from “number” to “totalagents” Then double check by hitting the “check” Button
  77. 77. We have learned a small exception to our rule Revised Rule --> everything in the model: (1) defined somewhere in the code (2) is a primitive (3) it is something like a slider
  78. 78. What is this doing in plain english? clear everything if the end user selects a slider value that exceeds the number of patches tell that end user to modify and try again
  79. 79. (1) Close Netlogo (2) Discard the Changes (3) Restart the Segregation model Quick Reset
  80. 80. Open the Schelling Segregation Model Delete all procedures except those shown to left What is has this done to the model? <Only Red Turtles> <“Go” button is red>
  81. 81. What is this doing in plain english? asks all of the patches to randomly “sprout” 1 turtle per patch and make that turtle color = red
  82. 82. What is this doing in plain english? now take half of those turtles and set turtle color = green
  83. 83. We Need to see What “update- varables” is Actually Doing
  84. 84. Here we are going to “set” some of our “turtles-own” variables
  85. 85. “Set” the Turtles-own Variable “similar-nearby” to the count of “turtles-on” neighbors (8 of them) but only those with color = my color
  86. 86. “Set” the Turtles-own Variable “similar-nearby” to the count of “turtles-on” neighbors (8 of them) but only those with color = not my color
  87. 87. 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”

×