KIN_PROPINQUITY_RESIDENTIAL_MOBILITY_AND_ETHNIC SEGREGATION

No preview image

1 collaborator

Default-person Eduardo Tapia (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.2.2 • Viewed 246 times • Downloaded 13 times • Run 0 times
Download the 'KIN_PROPINQUITY_RESIDENTIAL_MOBILITY_AND_ETHNIC SEGREGATION' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


ACKNOWLEDGMENT

This model is from Chapter Three of the book "Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo", by Uri Wilensky & William Rand.

  • Wilensky, U. & Rand, W. (2015). Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo. Cambridge, MA. MIT Press.

This model is in the IABM Textbook folder of the NetLogo Models Library. The model, as well as any updates to the model, can also be found on the textbook website: http://www.intro-to-abm.com/.

WHAT IS IT?

This project models the behavior of two types of turtles in a mythical pond. The red turtles and green turtles get along with one another. But each turtle wants to make sure that it lives near some of "its own." That is, each red turtle wants to live near at least some red turtles, and each green turtle wants to live near at least some green turtles. The simulation shows how these individual preferences ripple through the pond, leading to large-scale patterns.

This project was inspired by Thomas Schelling's writings about social systems (particularly with regards to housing segregation in cities).

This model is a simplified version of the Segregation model that is in the Social Science section of the NetLogo models library.

HOW TO USE IT

Click the SETUP button to set up the turtles. There are equal numbers of red and green turtles. The turtles move around until there is at most one turtle on a patch. Click GO to start the simulation. If turtles don't have enough same-color neighbors, they jump to a nearby patch.

The NUMBER slider controls the total number of turtles. (It takes effect the next time you click SETUP.) The %-SIMILAR-WANTED slider controls the percentage of same-color turtles that each turtle wants among its neighbors. For example, if the slider is set at 30, each green turtle wants at least 30% of its neighbors to be green turtles.

The "PERCENT SIMILAR" monitor shows the average percentage of same-color neighbors for each turtle. It starts at about 0.5, since each turtle starts (on average) with an equal number of red and green turtles as neighbors. The "PERCENT UNHAPPY" monitor shows the percent of turtles that have fewer same-color neighbors than they want (and thus want to move). Both monitors are also plotted.

THINGS TO NOTICE

When you execute SETUP, the red and green turtles are randomly distributed throughout the pond. But many turtles are "unhappy" since they don't have enough same-color neighbors. The unhappy turtles jump to new locations in the vicinity. But in the new locations, they might tip the balance of the local population, prompting other turtles to leave. If a few red turtles move into an area, the local green turtles might leave. But when the green turtles move to a new area, they might prompt red turtles to leave that area.

Over time, the number of unhappy turtles decreases. But the pond becomes more segregated, with clusters of red turtles and clusters of green turtles.

In the case where each turtle wants at least 30% same-color neighbors, the turtles end up with (on average) 70% same-color neighbors. So relatively small individual preferences can lead to significant overall segregation.

THINGS TO TRY

Try different values for %-SIMILAR-WANTED. How does the overall degree of segregation change?

If each turtle wants at least 40% same-color neighbors, what percentage (on average) do they end up with?

NETLOGO FEATURES

In the UPDATE-GLOBALS procedure, note the use of SUM, COUNT and WITH to compute the percentages displayed in the monitors and plots.

RELATED MODELS

Segregation

CREDITS AND REFERENCES

This model is a simplified version of:

The original work by Thomas Schelling was published in: Schelling, T. (1978). Micromotives and Macrobehavior. New York: Norton.

See also: Rauch, J. (2002). Seeing Around Corners; The Atlantic Monthly; April 2002;Volume 289, No. 4; 35-48. http://www.theatlantic.com/magazine/archive/2002/04/seeing-around-corners/302471/

HOW TO CITE

This model is part of the textbook, “Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo.”

If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

Please cite the NetLogo software as:

Please cite the textbook as:

  • Wilensky, U. & Rand, W. (2015). Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo. Cambridge, MA. MIT Press.

COPYRIGHT AND LICENSE

Copyright 2006 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

;;Paper: “KIN PROPINQUITY, RESIDENTIAL MOBILITY, AND ETHNIC SEGREGATION”.
;; Jarvis, B., Chihaya Da Silva, G., & Tapia, E. (2022).
;; The ABM is based on Schelling´s model of segregation (1971,1969).

extensions [ rnd ]

globals [
  prop_neighborhood
  euclidean_distance
  index_of_dissimilarity
]

turtles-own [
  similar-nearby  ;; in-group turtles at my NBH (Moore neighborhood)
  total-nearby    ;; turtles at my NBH
  proportion_similar ;; similar-nearby / total-nearby
  kin ;; unique ID number to identify agents' kin
  total_utility_current_NBH ;; b1 (ethnic_share) + b3 (kin-distance to NBH)
  mover ;; if the household has been selected to move, mover = 1.
]

patches-own [
  NBH_id

]
breed [slots slot]  ;; slot = empty dwelling
breed [households household]

;############################ S E T U P #####################################

to setup
  ca
  resize-world 0 world_size 0 world_size
  set-patch-size patch_size ; 7 o 36
  let number_of_patches precision ((count patches * Perc_Agents ) / 100 ) 0
  ask n-of number_of_patches patches [ sprout-households 1 ]
  ;; majority (green agents)
  ask households [ set color green set shape "square"]
  ;; minority (red agents)
  ask n-of (( number_of_patches * %_minority_group_RED ) / 100 ) households [ set color red set shape "square"]
  ;; kin
  kinship
  ask patches with [ not any? turtles-here ] [ sprout-slots 1 [ set color black ]]

  current-NBH-utility
  selecting-movers
  create_NBH
  calculate_index

  reset-ticks
end 

to create_NBH

    let temp (world_size + 1) /   NBHsize_mXm
    let pool n-values temp [ i -> i ]
  foreach pool [
    x -> ask patches with [pycor >= (x * NBHsize_mXm) and pycor < (x * NBHsize_mXm) + NBHsize_mXm] [
set NBH_id int(pxcor / NBHsize_mXm) + ((x * ( (world_size + 1) /   NBHsize_mXm) ) + 1)
]
]
end 

to kinship
  let NumRed count turtles with [ color = red ]
  let NumGreen count turtles with [ color = green ]
  let NumgroupsRed floor ( NumRed / Kin_size )
  let NumgroupsGreen floor ( NumGreen / Kin_size )
  let greenlist n-values NumgroupsGreen [i -> i + 1]
  let redlist n-values NumgroupsRed [i -> i + (NumgroupsGreen + 1)]
  foreach greenlist [i -> ask n-of Kin_size households with [color = green and kin = 0] [ set kin i ]  ]
  foreach redlist   [i -> ask n-of Kin_size households with [color = red   and kin = 0] [ set kin i ]  ]
  ;; dropping unmatched agents
  ask turtles with [ kin = 0 ] [ die ]
end 

to current-NBH-utility

 ask households
  [
  ;; household color?
  let mycolor [color] of self

  ;; Calculating utility current NBH
  ;----------------------------------
  ;; (A) Ethnic Share utility
  set similar-nearby count (households-on neighbors) with [color = mycolor]
  set total-nearby count (households-on neighbors)
  ifelse (total-nearby > 0) [ set proportion_similar similar-nearby / total-nearby ] [set proportion_similar 0] ;; or 1?
  let utility_share_own_NBH ( proportion_similar * beta_ethnic )
  ;; (B) Kin-distance utility
  let yo [who] of self
  let mykin [kin] of self
  let mykins [who] of other households with [kin = mykin]
  let tempo2 []  ;; to save kin distances
  foreach mykins
  [
    i -> let x i
    let distance_to_temp euclidean_distancia x yo
    set tempo2 lput distance_to_temp tempo2
  ]

  let averg_kin_distance mean tempo2
  ;; normalizing kin distance
  let averg_kin_distance_NORM   averg_kin_distance / (world_size / 2)
  let utility_kin_distance_own_NBH ( averg_kin_distance_NORM * beta_kin )
  ;; household utility
  set total_utility_current_NBH utility_share_own_NBH + utility_kin_distance_own_NBH

  ]
end 

to selecting-movers
  let num_movers precision (( %_movers * count households ) / 100 ) 0
  ask min-n-of num_movers households [total_utility_current_NBH] [ set mover 1 ]
end 

to initialize
  ifelse (burning = "A")
  [
  ifelse (ticks < 150)
  [
    set beta_ethnic 1
    set beta_kin -1
  ]
  [
    set beta_ethnic beta_ethnic2
    set beta_kin beta_kin2
  ]
  ]
  [
  ifelse (ticks < 150)
  [
    set beta_ethnic 0
    set beta_kin -1
  ]
  [
    set beta_ethnic beta_ethnic2
    set beta_kin beta_kin2
  ]
  ]
end 

;#############################################################################



;############################  G O  #####################################

to go
  if (ticks = 300) [stop]
  initialize
  move-households
  resetting-mover-list
  current-NBH-utility
  selecting-movers
  calculate_index
 tick
end 

;#########################################################################

to move-households
  ifelse (All_move? = "yes")
  [
   ask households with [ mover = 1 ]
  [
    evalute_select_and_movingin_neighborhoods
  ]
  ]
  [
   ask one-of households with [ mover = 1 ]
  [
    evalute_select_and_movingin_neighborhoods
  ]
  ]
end 

to resetting-mover-list
  ask households [ set mover 0 ]
end 

to evalute_select_and_movingin_neighborhoods

  ;; creating a raw list of NBHS
  let candidates [who] of slots
  let mycolor [color] of self
  ;; calculating distance to each of NBHs candidates
  let my [who] of self

  ;; calculating b1 = ethnic share
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  let ethnic_share map [i -> prop_same_group i mycolor] candidates

  ;; calculating b2 = distance
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  let distance_to_slots2 map [i -> euclidean_distancia my i] candidates
  let distance_to_slots_normalized map [i -> normalize2 i ] distance_to_slots2

  ;; calculating b3 = kin distance
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  let mykin [kin] of self
  let mykins [who] of other households with [kin = mykin]
  let tempo2 []
  let temp3 n-values (length candidates) [i -> 0]

  foreach mykins
  [
    i -> let x i
    let pos position x mykins
    let distance_to_temp map [r -> euclidean_distancia x r] candidates
    set tempo2 temp3
    set temp3 []
    (foreach distance_to_temp tempo2 [ [a b] -> let suma (a + b) set temp3 lput suma temp3 ])
   ]

  let averg_kin_distance map [i -> i / (Kin_size - 1)] temp3
  let averg_kin_distance_normalized map [i -> normalize2 i ] averg_kin_distance

  ;; calculating utility
  ;;;;;;;;;;;;;;;;;;;;;;;
  let utility_share map [i -> i * beta_ethnic] ethnic_share
  ;; household distance
  let utility_distance map [i -> i * beta_distance] distance_to_slots_normalized
  ;; kin-distance
  let utility_kin_distance map [i -> i * beta_kin] averg_kin_distance_normalized
  let added_utility2 []
  (foreach utility_share utility_distance utility_kin_distance [ [a b c] -> let suma (a + b + c) set added_utility2 lput suma added_utility2 ])
  ;; Exp utility
  let added_utility map [i -> exp i ] added_utility2
  ;; Calculating probabilities
  let tot_utility sum added_utility
  let NBH_probabilities map [i -> i / tot_utility] added_utility
  ;; Joining final utilities and NBHs' ids
  let final_pool (map list candidates NBH_probabilities)

  ;; selecting and moving
  ;;;;;;;;;;;;;;;;;;;;;;;
  let origin_place patch-here
  let decision select_and_move my final_pool origin_place
end 


;; F U N C T I O N S
;;;;;;;;;;;;;;;;;;;;

to-report select_and_move [a b c]
 ask turtle a [
  if ( (length b) > 0 )
    [
    let chosen_NBH first rnd:weighted-one-of-list b [ [p] -> last p ]
    move-to slot chosen_NBH
    ask slot chosen_NBH [
      move-to c ]

  ]
  ]
  report []
end 

to-report prop_same_group [a mycolor]
   ask turtle a [
    let similar_nearby count (households-on neighbors) with [color = mycolor]
    let total_nearby count (households-on neighbors)
    ifelse (total_nearby > 0)    [set prop_neighborhood   (similar_nearby / total_nearby)] [ set prop_neighborhood 0]

    ]
  report prop_neighborhood
end 

to-report euclidean_distancia [my neighborhood]
   ask turtle my [
    set euclidean_distance distance turtle neighborhood
    ]
  report euclidean_distance
end 

to-report normalize2 [ current_distance ]
  let b precision ( current_distance / ( world_size / 2 )) 4
  report b
end 

to calculate_index
  let num_NBHs ((world_size + 1) / NBHsize_mXm) ^ 2
  let neig n-values num_NBHs [ ?1 -> ?1  + 1]
  let segre_by_n map [ ?1 -> abs (((count (households-on patches with [NBH_id = ?1]) with [ color = red ]) / (count households with [ color = red]) ) - ((count (households-on patches with [NBH_id = ?1]) with [ color = green ]) / (count households with [ color = green]) )) ] neig
  set index_of_dissimilarity sum segre_by_n / 2
end 

There is only one version of this model, created almost 3 years ago by Eduardo Tapia.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.