Spatial Opinion Dynamics with Two Types of Mixing

Spatial Opinion Dynamics with Two Types of Mixing preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.1 • Viewed 646 times • Downloaded 71 times • Run 0 times
Download the 'Spatial Opinion Dynamics with Two Types of Mixing' modelDownload this modelEmbed this model

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


WHAT IS IT?

This model shows the spatial dynamics of attitude formation and the effects of two different types of mixing in the population. "Relocation" switches the spatial location of individuals, while "Telephoning" has individuals interact with another random individual in the population.

HOW IT WORKS

Agents select a neighbor to interact with according to an influence function. If that neighbor has the same opinion (i.e., both attitudes are positive or both are negative) then there is some probability that the focal agent "amplifies" their opinion by changing their attitude to become more extreme. This creates clusters that increase in size and have boundaries with different types of behaviors (see section on THINGS TO NOTICE). If, however, Telephoning is turned on, then some fraction of the agents interact with a random individual instead of their local neighbor. If, on the other hand, Relocation is turned on, then some fraction of the agents will switch places with others (but still have an interaction).

HOW TO USE IT

There are four main sets of parameters that determine how attitudes will change over time. The "Influence" button controls how focal agents select a neighbor. If "uniform" is selected, then each neighbor has the same chance of being picked for an interaction, regardless of their attitude. The options "linear" and "quadratic" bias those neighbors with more extreme opinions (higher absolute-valued attitudes), while options "co-linear" and "co-quadratic" bias more moderate opinions (attitudes closer to zero). Note that there are no zero attitudes.

The second main parameter is "opinion-amplification". If a focal agent shares the same opinion type of the neighbor that's been selected for interaction, then with probability p the focal individual adopts a more extreme attitude, where p is specified by the value of opinion-amplification.

The other two sets of parameters are Relocation and Telephone. When Relocation is ON, then with the specified frequency (relocate-freq) some fraction of the population (frac-to-relocate) moves to a new spatial location. When Telephone is ON, then with the specified frequency (frac-to-telephone) some fraction of the population (frac-to-telephone) interact with a random agent rather than with a local agent.

The model can be initialized with respect to both the distribution of attitudes on a spectrum and their spatial location. The size of the attitude spectrum is set by "max-entrench" - it specifies what the most extreme attitudes can be. E.g., if "max-entrench" is set to 3, then the possible attitudes are {-3,-2,-1,1,2,3}. "init-attitude" specifies the range of attitudes that the simulation will start with, and "positive-to-negative-ratio" determines the frequency of positive attitudes relative to negative attitudes.

If "rnd-initial" is ON, then attitudes will be randomly assigned in space. If it is OFF, then all the positive attitudes will form a circle in the middle. The size of the circle is controlled by "radius-size".

THINGS TO NOTICE

When there is enough opinion amplification and little to no mixing (either Relocate or Telephone), boundaries between clusters exhibit surface tension and straighten out with what appears to be motion by mean curvature. If one type of opinion is surrounded by the second type, the first type will tend to decrease in number and the cluster is "swallowed up". If bands form with straight boundaries, then both types of opinion will coexist for a very long time. Such boundaries, however, become less clear as mixing levels are increased. Note that, even though each agent has one interaction per time step, Relocate breaks down spatial structures more than Telephone.

The effect of amplification now varies. With little to no mixing, amplification produces polarizations. With increased mixing, however, amplification produces rapid consensus once one side of the attitude spectrum becomes larger than the other.

THINGS TO TRY

If you select "linear" or "quadratic" influence, then the surface tension effect is increased. If you select "co-linear" influence, then you need to increase the amplification level to produce the surface tension effect, and even more so if you pick "co-quadratic" influence.

Turn off "rnd-initial" so that the simulation starts with a well defined boundary in the form of a circle. Notice that for uniform influence, you only need a little bit of amplification (e.g., 0.05) to keep the form of the circle. Also notice that the circle slowly decreases in size.

EXTENDING THE MODEL

Interactions are local in this model. Add code for "global" interactions, that is, create a new slider such that with some probability a focal agent will select a person from the population at random. As this probability is increased, the system becomes noisier and consensus is reached more quickly (i.e., one opinion type wins).

NETLOGO FEATURES

This model makes use of the "rnd" extension. The influence function is a weighted probability. When it is "linear" then the weights of more extreme opinions grow linearly with the absolute value of the attitude. When it is "quadratic" then the weights grow by the square.

CREDITS AND REFERENCES

Copyright 2016 Bert Baumgaertner.

Thanks to collaborators Steve Krone and Rebecca Tyson.

This project was funded by CLASS Excellence in Teaching the Humanities Endowment and NIH Grant P20GM104420.

Comments and Questions

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

Click to Run Model

extensions [rnd]

globals [
  fizz ; measures the frequency of attitudes that change at each step
  L2 ;frequency of -2 attitudes
  L1 ;frequency of -1 attitudes
  R1 ;frequency of 1 attitudes
  R2 ;frequency of 2 attitudes
  interface-density
  relocate-timer
  telephone-timer
  num-turtles
  last-cross ;this is the last time step where the centers cross (1 if they never did)
  last-op-cross ; this is the last time step where the opinions cross (1 if they never did)
  higher-center ; this keeps track of which center has the higher frequency
  higher-op
]

turtles-own [
  old-attitude
  new-attitude
]

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
  set num-turtles count turtles
  ifelse L1 > R1 [set higher-center "L1"] [set higher-center "R1"]
  ifelse (L1 + L2) > (R1 + R2) [set higher-op "L"] [set higher-op "R"]
  set last-cross 1
  if measure-interface-density [measuring-interface-density]
  reset-ticks
end 

to go
  if not any? turtles with [old-attitude >= 1] or not any? turtles with [old-attitude <= -1] [stop]
  ask turtles [ local-interactions ]
  if relocation [ relocate ]
  if telephone? [
    ifelse telephone-timer = 0 [set telephone-timer telephone-freq] [set telephone-timer telephone-timer - 1 ]
  ]
  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
  check-last-cross
  if measure-interface-density [measuring-interface-density]
  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] ]
  ]
  [
    ifelse telephone? and telephone-timer = 0 and random-float 1 < frac-to-telephone [
      set j one-of turtles
    ]
    [
      set j rnd:weighted-one-of (turtles-on neighbors) [abs influence-function [old-attitude] of self]
    ]
  ]
  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 relocate ; much faster then using "ask turtles []"
  let allagents [self] of n-of (floor (frac-to-relocate * num-turtles)) turtles ; create a list of all agents
  let total ((length allagents) - 1)
  let i 0
  while [i < total] ; for each 2 agents in a list
  [
    let tempx [xcor] of item i allagents
    let tempy [ycor] of item i allagents
    ask (item i allagents) [
      set xcor [xcor] of item (i + 1) allagents
      set ycor [ycor] of item (i + 1) allagents]
    ask (item (i + 1) allagents) [set xcor tempx set ycor tempy]
    set i (i + 2) ; increment index by 2
  ]
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 

to check-last-cross
  let hc ""
  ifelse L1 > R1 [set hc "L1"] [set hc "R1"]
  if higher-center != hc [
    set higher-center hc
    set last-cross ticks
  ]
  let ho ""
  ifelse (L1 + L2) > (R1 + R2) [set ho "L"] [set ho "R"]
  if higher-op != ho [
    set higher-op ho
    set last-op-cross ticks
  ]
end 

to measuring-interface-density
  let g []
  ask turtles [
    let d 0
    ask turtles-on neighbors [
      if ([old-attitude] of self * [old-attitude] of myself) < 0 [set d d + 1]
    ]
  set g fput (d / 8) g
  ]
  set interface-density mean g
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; STATISTICS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to measure-frequency-over-time
  set L2 count turtles with [old-attitude = -2] / count turtles
  set L1 count turtles with [old-attitude = -1] / count turtles
  set R1 count turtles with [old-attitude = 1] / count turtles
  set R2 count turtles with [old-attitude = 2] / count turtles
end 

;; Copyright Bert Baumgaertner
;; See info tab for credits

There are 3 versions of this model.

Uploaded by When Description Download
Bert Baumgaertner about 7 years ago Updated to work with NetLogo 6 Download this version
Bert Baumgaertner over 8 years ago Added instruction for rnd extension Download this version
Bert Baumgaertner over 8 years ago Initial upload Download this version

Attached files

File Type Description Last updated
rnd.jar extension Copy this extension into a folder you create called "rnd" in the extensions folder. about 7 years ago, by Bert Baumgaertner Download
Spatial Opinion Dynamics with Two Types of Mixing.png preview Preview for 'Spatial Opinion Dynamics with Two Types of Mixing' over 8 years ago, by Bert Baumgaertner Download

This model does not have any ancestors.

This model does not have any descendants.