Spatial Dynamics of Attitude Formation
Model was written in NetLogo 5.3
•
Viewed 368 times
•
Downloaded 37 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
extensions [rnd];This extension can be dowloaded at https://github.com/NetLogo/Rnd-Extension globals [ fizz ; measures the frequency of attitudes that change at each step left-freq ;frequency of negative attitudes right-freq ; frequency of positive attitudes ] turtles-own [ old-attitude new-attitude id-neighbors ] to setup clear-all ask patches [set pcolor gray] set-default-shape turtles "square" make-turtle-distribution ask turtles [ set size 1.2 set old-attitude new-attitude set color 5 - ((old-attitude / max-entrench) * 4.9) ] ;; in order to do synchronous updating, we need to delay when agents update their attitudes, so we separate attitudes into new and old set fizz 0 measure-frequency-over-time reset-ticks end to go ask turtles [ local-interactions ] set fizz (count turtles with [old-attitude != new-attitude]) / count turtles ask turtles [ set old-attitude new-attitude set color 5 - ((old-attitude / max-entrench) * 4.9) ] measure-frequency-over-time tick end to local-interactions let j nobody ; j will be the other agent, which we initially set as nobody ifelse influence = "max-inf" or influence = "min-inf" [ if influence = "max-inf" [ set j max-one-of turtles-on neighbors [abs old-attitude] ] if influence = "min-inf" [ set j min-one-of turtles-on neighbors [abs old-attitude] ] ] [ let localsum 0 ; This will be sum of the neighbour attitudes, weighted by the influence function. let pairlist [] ; this is going to be the list of pairs with a turtle first and a probability second ask turtles-on neighbors [ set localsum localsum + abs influence-function [old-attitude] of self ] ask turtles-on neighbors [ let prob 0 if localsum != 0 [set prob (abs influence-function [old-attitude] of self) / localsum] let pair [] set pair lput self pair set pair lput prob pair set pairlist lput pair pairlist ] set j first rnd:weighted-one-of pairlist [last ?] ] if is-turtle? j [ ;it is possible that no agent ends up getting picked in the line above, so this checks that someone has ifelse random-float 1 < opinion-amplification [ if [old-attitude] of j > 0 [ if abs old-attitude < max-entrench [ ifelse old-attitude = -1 [set new-attitude 1] [ set new-attitude old-attitude + 1 ]] ] if [old-attitude] of j < 0 [ if abs old-attitude < max-entrench [ ifelse old-attitude = 1 [set new-attitude -1] [set new-attitude old-attitude - 1 ]] ]] [ if [old-attitude] of j > old-attitude [ ifelse old-attitude = -1 [set new-attitude 1] [ set new-attitude old-attitude + 1]] if [old-attitude] of j < old-attitude [ ifelse old-attitude = 1 [ set new-attitude -1][set new-attitude old-attitude - 1 ]] ] ] end to-report influence-function [item1] if influence = "linear" [ ifelse item1 = 0 [report 1] [report item1] ] ; this is the linear update function if influence = "square" [ ifelse item1 = 0 [report 1] [report (item1 ^ 2)]] ; this weighs extreme attitudes more than moderate ones if influence = "uniform" [ if item1 < 0 [report -1] if item1 > 0 [report 1] ] if influence = "co-linear" [ ifelse item1 = 0 [report 1] [report (max-entrench + 1 - abs item1) ] ] if influence = "co-square" [ ifelse item1 = 0 [report 1] [report (max-entrench + 1 - abs item1) ^ 2 ] ] end to make-turtle-distribution ifelse rnd-initial [ ask patches [;; every patch will either have a positive or negative attitude placed on them. The probability of one over the other is set by polluter-to-nonpolluter-ratio ifelse random-float 1 < positive-to-negative-ratio [ sprout 1 [ set new-attitude (random init-attitude) + 1 ] ] [ sprout 1 [ set new-attitude 0 - (random init-attitude) - 1 ] ] ] ][;;otherwise, the positive attitudes are arranged to form a circle, with a radius set by radius-size ask patches [ ifelse (abs pxcor) ^ 2 + (abs pycor) ^ 2 <= radius-size ^ 2 [ sprout 1 [ set new-attitude max-entrench ] ] [ sprout 1 [ set new-attitude (0 - max-entrench) ] ] ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; STATISTICS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to measure-frequency-over-time set left-freq count turtles with [old-attitude <= -1] / count turtles set right-freq count turtles with [old-attitude >= 1] / count turtles end ;; Copyright Bert Baumgaertner ;; See info tab for credits
There are 2 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
rnd.jar | extension | Version of rnd extension required to run model. | almost 8 years ago, by Bert Baumgaertner | Download |
Spatial Dynamics of Attitude Formation.png | preview | Preview for 'Spatial Dynamics of Attitude Formation' | about 9 years ago, by Bert Baumgaertner | Download |
This model does not have any ancestors.
This model does not have any descendants.