Continuous Opinion Dyanmics under Bounded Confidence

No preview image

1 collaborator

Sg_jan_small Jan Lorenz (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0 • Viewed 745 times • Downloaded 47 times • Run 0 times
Download the 'Continuous Opinion Dyanmics under Bounded Confidence' modelDownload this modelEmbed this model

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


# Continuous Opinion Dynamics under Bounded Confidence

## WHAT IS IT?

A model of **continuous opinion dynamics under bounded confidence**, which includes

* its two main variants of communication regimes (as in [Deffuant et al 2000](http://dx.doi.org/10.1142/S0219525900000078) with μ=0.5 and as in [Hegselmann and Krause 2002](http://jasss.soc.surrey.ac.uk/5/3/2.html))

* alternative aggregation of opinions by the median instead of the mean

* heterogeneous bounds of confidence coming from a four parameter [beta distribution](http://en.wikipedia.org/wiki/Beta_distribution)

* noise via random reset of opinions (as in [Pineda et al 2009](http://dx.doi.org/10.1088/1742-5468/2009/08/P08001))

* one-sided and two-sided extremism (similar to [Deffuant et al 2002](http://jasss.soc.surrey.ac.uk/5/4/1.html))

Visualizations:

* a rolling colored histogram of opinion density over time

* rolling trajectories of opinions over time colored by the bound of confidence

* a bar plot histogram of current opinions

* trajectories of the mean and the median opinion over time.

## HOW IT WORKS

### In a nutshell

Agents adjust their opinion gradually towards the opinions of others when the distance in opinion is within their bound of confidence. Sometimes agents change their opinion to a new one at random. When agents hold extremal opinions they might get extremists which never adjust opinions.

### Variables

Each of N agent has its **opinion** between 0.0 and 1.0 as a dynamic variable and its **bound of confidence** (eps) as a static variable. Other static variables are global and regard the type of communication and aggregation, the probability of random reset of opinion and the type and size of extremism zones.

### Setup

Each agent is assigned its initial opinion as a random number between 0.0 and 1.0 from the uniform distribution. Each agent is assigned its bound of confidence as a random number form a [beta-distribution](http://en.wikipedia.org/wiki/Beta_distribution) between min_eps and max_eps.

### Dynamics

Each tick agents are asked to adjust their opinions with respect to the opinions of others and their bound of confidence (eps).

**1. Communication and aggregation:**

* "DW (select one)": Each tick each agent is asked to select a random partner and changes its opinion to the average of the two opinions but only when the opinion of the partner is closer than eps to the own opinion.

When original=On, N randomly selected agents are chosen each tick (so some agents possibly more than once) and both agents (the selected one and the randomly selected partner) both adjust opinions. (This is the version of Deffuant et al 2000, differences to original=Off are mostly minor.)

* "HK (select all)": Each tick each agent is asked to change its opinion to the aggregated opinion of all opinions which are closer than eps to its opinion. The aggregate opinion can be the mean or the median. When original=On is checked all agents do the change simultaneously. (This is the version of Hegselmann and Krause 2002, differences are minor.) With original=Off an agent's change of opinion can immediately takes place and the new opinion might already effect the adjustments of the next agent even in the same tick.

**2. Probability of random opinion reset**

After the update of opinion each agent is asked to select a new opinion (in the same way as its initialization) but only with probability given by the variable entry_exit_rate.

**3. Heterogeneous bounds of confidence**

Notice that under heterogeneous bounds of confidence it might be that one agent has confidence in another but not vice versa!

**4. Extremists**

Extremism zones are intervals in the opinion space from 0.0 to 1.0 which are determined by the parameter extremism_range. The extremism intervals are from 0.0 to extremism_range for the selection "one side" and additionally from 1.0-extremism_range to 1.0 for the selection "two side". Agents which are located in the extermism zone never change their opinion. But still other non-extremist agents might adjust their opinion with respect to the opinions of extremists. Extremists still undergo change of opinion due to random reset of opinions.

## HOW TO USE IT

Click "setup" to inititialize agents with opinions random and uniformly distributed between 0.0 and 1.0. Agents are located at the left border of the world with their opinions spreading over the vertical axis. Further, on confidence bounds are initialized for each agent as random draws from a beta distribution under the current choice of the four parameters.

Click "go" to start the simulation. Agents move with ticks from left to right, displaying their opinion with the position on the vertical axis. This goes over into a "rolling" graphic in the world, where the last 120 ticks are shown (respectively the last max-pxcor ticks). Visualization can be chosen as trajectories of agents or as color-coded histograms. In colored histograms each patch's color is associated to the number of agents at this patch.

A change of the variables communication regime, original, aggregation_in_HK, entry_exit_rate, extremism_range, and extremism_type is immediately effective in a running simulation.

A change of the variable number_of_agents immediately changes the color axis in the "Colored histogram over time"-visualization and the vertical axis in the histogram of current opinions.

A change of the four parameters of the distribution of eps (min_eps, max_esp, alpha, beta) immediately effect only the plot of the pdf of the distribution, but not the eps in the running simulation (click "new_confidence_bounds" for this).

Click "new_confidence_bounds" to make new random draws for eps for each agent. Draws come from the beta distribution with the current parameters. (The same procedure is called when clicking "setup".)

## THINGS TO NOTICE

Agents move towards the right-hand side of the world with one step each tick. This goes over into a "rolling" plot.

Notice how agents form **clusters** in the opinion space. See how these clusters **evolve**, **drift** and **unite** in the "**Colored histograms over time**"-visualization.

Look at the role of agents with different bounds of confidence in the "**Agents' trajectories**"-visualization.

Look at the current distribution of opinions in the **bar plot histogram** on the right hand side and compare it to the colored histogram (the most recent colored vertical line in the world at the right hand side).

Look how the **mean and the median opinion** evolve over time. The mean represents the center of mass of the distribution (cf. the current histogram). The median represents an unbeatable opinion under pairwise majority decisions. (This holds when agents have single-peaked preferences with peaks at their opinion, cf. [median voter theorem](http://en.wikipedia.org/wiki/Median_voter_theorem)).

Look how the histogram of bounds of confidence matches the probability density function of the beta distribution when you click "new_confidence_bounds".

## THINGS TO TRY

Try the **original models of homogeneous DW and HK communication without noise**: Set entry_exit_rate to zero, min_eps and max_eps to the same value, and extremism_range to zero. See how a stable configuration of clusters evolves. Check how the **number**, **sizes** and **locations** of clusters depend on the bound of confidence. Try to determine critical bounds of confidence where the evolving cluster pattern changes significantly. Use the setup button to rerun with a new initial configuration.

Try to understand the impact of **noise** (entry_exit_rate) under homogeneous bounds of confidence: Set up a homogeneous eps (min_eps=max_eps), run the simulation and play with the entry_exit_rate slider (reasonable values are low, e.g. between 0.01 and 0.1). There are bounds of confidence, where the cluster pattern oscillates between two numbers of clusters. Under different entry_exit_rates the two patterns become differently likely.

Play with **hetergeneous bounds of confidence** (min_epshttp://dx.doi.org/10.1002/cplx.20295)): Set N=500, DW communication, original=off, entry_exit_rate=extremism_range=0, alpha=beta=0.1, min_eps=0.24, max_eps=0.24. See by several runs (repeatedly click "setup") that consensus is not (or very rarely) possible. Now set min_eps=0.1 and see that the bimodal distribution (half of the population with eps=0.1 and half with eps=0.24) makes it possible that almost all agents unite in a single cluster. Beware, this does not happen all the time and might takes a lot of time (rerun and wait!). The phenomenon is better understood in the "Agents' trajectories"-visualization.

Play with **extremism** under homogeneous bounds of confidence and no noise (entry_exit_rate=0). Observe the pattern of convergence under different bounds of confidence. Under what bounds of confidence does global extremism (at one or both extremes) occur? Use small extremism ranges (between 0.01 and 0.05) and play with one or two-sided extremism. Compare to [Deffuant et al 2002](http://jasss.soc.surrey.ac.uk/5/4/1.html).

Try to find differences between the original versions of the DW and HK models and the one implemented when original=off.

Try to calibrate parameters which represent an evolution of the political landscape of opinions which looks to you as a realistic evolution of a party system (regarding location and size of opinion clusters in the left--right continuum).

## RELATED MODELS AND PAPERS

**Original HK and DW models**

Hegselmann, R. & Krause, U. [Opinion Dynamics and Bounded Confidence, Models, Analysis and Simulation](http://jasss.soc.surrey.ac.uk/5/3/2.html) Journal of Artificial Societies and Social Simulation, 2002, 5, 2

Deffuant, G.; Neau, D.; Amblard, F. & Weisbuch, G. [Mixing Beliefs among Interacting Agents](http://dx.doi.org/10.1142/S0219525900000078) Advances in Complex Systems, 2000, 3, 87-98

Weisbuch, G.; Deffuant, G.; Amblard, F. & Nadal, J.-P. [Meet, discuss, and segregate!](http://dx.doi.org/10.1002/cplx.10031) Complexity, 2002, 7, 55-63

**General model including HK and DW**

Urbig, D.; Lorenz, J. & Herzberg, H. [Opinion dynamics: The effect of the number of peers met at once](http://jasss.soc.surrey.ac.uk/11/2/4.html) Journal of Artificial Societies and Social Simulation, 2008, 11, 4

**On noise:**

Pineda, M.; Toral, R. & Hernandez-Garcia, E. [Noisy continuous-opinion dynamics](http://stacks.iop.org/1742-5468/2009/P08001) Journal of Statistical Mechanics: Theory and Experiment, 2009, 2009, P08001 (18pp)

M_s, M.; Flache, A. & Helbing, D. [Individualization as Driving Force of Clustering Phenomena in Humans](http://dx.doi.org/10.1371/journal.pcbi.1000959) PLoS Comput Biol, Public Library of Science, 2010, 6, e1000959

**On heterogeneous bounds of confidence**

Lorenz, J. [Heterogeneous bounds of confidence: Meet, Discuss and Find Consensus!](http://dx.doi.org/10.1002/cplx.20295) Complexity, 2010, 15, 43-52

**On extremism**

Deffuant, G.; Neau, D.; Amblard, F. & Weisbuch, G. [How Can Extremism Prevail? A Study Based on the Relative Agreement Interaction Model](http://jasss.soc.surrey.ac.uk/5/5/1.html) Journal of Artificial Societies and Social Simulation, 2002, 5, 1

Deffuant, G. [Comparing Extremism Propagation Patterns in Continuous Opinion Models](http://jasss.soc.surrey.ac.uk/9/3/8.html) Journal of Artificial Societies and Social Simulation, 2006, 9, 8

**Survey, Motivation and Variation**

Lorenz, J. [Continuous Opinion Dynamics under bounded confidence: A Survey](http://dx.doi.org/10.1142/S0129183107011789) Int. Journal of Modern Physics C, 2007, 18, 1819-1838

Urbig, D. [Attitude Dynamics with Limited Verbalisation Capabilities](http://www.jasss.surrey.ac.uk/6/1/2.html) Journal of Artificial Societies and Social Simulation, 2003, 6, 2

Lorenz, J. & Urbig, D. [About the Power to Enforce and Prevent Consensus by Manipulating Communication Rules](http://dx.doi.org/10.1142/S0219525907000982) Advances in Complex Systems, 2007, 10, 251

Amblard, F. & Deffuant, G. [The role of network topology on extremism propagation with the relative agreement opinion dynamics](http://dx.doi.org/10.1016/j.physa.2004.06.102) Physica A: Statistical Mechanics and its Applications, 2004, 343, 725-738

Groeber, P.; Schweitzer, F. & Press, K. [How Groups Can Foster Consensus: The Case of Local Cultures](http://jasss.soc.surrey.ac.uk/12/2/4.html) Journal of Artificial Societies and Social Simulation, 2009, 12, 4

## CREDITS AND REFERENCES

Copyright 2012 Jan Lorenz. http://janlo.de, post@janlo.de

![Creative Commons Attribution-ShareAlike 3.0 Unported License](http://i.creativecommons.org/l/by-sa/3.0/88x31.png)

This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ .

Comments and Questions

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

Click to Run Model

turtles-own [opinion eps opinion-list extremist?]
;; eps is the bound of confidence, opinion-list is to hold the list of the last max-pxcor opinions, extremist? checks if the turtle is in an opinion interval of extremism
globals [ current_min_eps current_max_eps current_alpha current_beta]
;; variables to display the parameters of the beta distribution from which the current eps-values are drawn
;; the slider-variables min_eps, max_eps, alpha, beta are changed to current_... when new_confidence_bounds is called

;; BUTTON PROCEDURES

to setup
  clear-all
  ask patches [set pcolor white]
  create-turtles number_of_agents
  ask turtles [
    set opinion new-opinion 
    set opinion-list (list opinion)
    setxy 0 (opinion * max-pycor) 
    ]
  new_confidence_bounds ;; see procedure
  reset-ticks
end 

to go
  ask turtles [ set opinion-list lput opinion opinion-list ] ;; put opinion after opinion-list to use it as "old" value for simulatanous update in HK
  ifelse (communication_regime = "DW (select one)") and (original = true) 
    [repeat count turtles [ask one-of turtles [ update-opinion ]]] ;; in original DW we chose N random pairs each tick
    [ask turtles [ update-opinion ]] ;; in all other versions there is an update for each agent every tick
    ;; for "update-opinion" see the procedure
  ask turtles [ set opinion-list replace-item ( length opinion-list - 1) opinion-list opinion ] ;; update the opinion-list
  ask turtles [ if (length opinion-list = max-pxcor + 1) [ set opinion-list butfirst opinion-list ] ] ;; cut oldest values for "rolling" opinion list
  ask turtles [ entry-exit ] ;; see the procedure
  draw-trajectories  ;; see the procedure
  tick
end 

to new_confidence_bounds
  set current_min_eps min_eps
  set current_max_eps max_eps
  set current_alpha alpha
  set current_beta beta
  ask turtles [
    let x random-gamma alpha 1
    set eps ( x / ( x + random-gamma beta 1) ) ;; set eps a random number from distribution Beta(alpha,beta) (between 0 and 1)
    set eps min_eps + (eps * (max_eps - min_eps)) ;; scale and shift eps to lie between min_eps and max_eps
    set color colorcode eps 0.5 ;; see reporter colorcode
    ] 
  update-plots
end 

;; INTERNAL PROCEDURES

to update-opinion
  ;; detect if in extremism zone
  if (extremism_type = "two side") [set extremist? (0.5 - abs(opinion - 0.5) < extremism_range)]
  if (extremism_type = "one side") [set extremist? (opinion < extremism_range)]
  ;; change of opinion
  if (communication_regime = "DW (select one)") [
   ;; adjust opinion with random partner
   let partner one-of turtles
   if (abs (opinion - [opinion] of partner) < eps ) and (not extremist?) [
     set opinion (opinion + [opinion] of partner) / 2 
     if (original = true) [ ;; also partner updates opinion, this increases number of average activities of agents per time step from 1 to 2
       ask partner [
         if (extremism_type = "two side") [set extremist? (0.5 - abs(opinion - 0.5) < extremism_range)]
         if (extremism_type = "one side") [set extremist? (opinion < extremism_range)]         
         if (abs (opinion - [opinion] of myself) < eps ) and (not extremist?) [set opinion (opinion + [opinion] of myself) / 2] 
         ]
       ]
     ]
   ]
  if (communication_regime = "HK (select all)") [
   ;; adjust opinion to mean of all in agents closer than eps
   if not extremist? [
     ifelse (original = true) 
        [ set opinion aggregate ( filter [abs( ? - last opinion-list) < eps] [last opinion-list] of turtles ) ]
        [ set opinion aggregate ( filter [abs( ? - opinion) < eps] [opinion] of turtles ) ]
        ;; for aggregate see the reporter 
        ]
  ]
end 

to entry-exit
  ;; randomly reset opinion with probability entry_exit_rate
  if (random-float 1 < entry_exit_rate) [set opinion new-opinion]
end 

to draw-trajectories
  ;; let turtles move with their opinion trajectories from left to right across the world drawing trajectories or coloring patches
  clear-drawing
  ask turtles [
    pen-up
    setxy 0 (item 0 opinion-list * max-pycor)
  ]
  ifelse (visualization = "Colored histogram over time") [ ask turtles [ pen-up ] ] [ask turtles [ pen-down ] ]
  let t-counter 1
  while [ t-counter < (length ( [opinion-list] of turtle 1 )) ] [ 
    ask turtles [setxy t-counter (item t-counter opinion-list * max-pycor)]
    ifelse (visualization = "Colored histogram over time") 
      [ ask patches with [pxcor = t-counter ] [ set pcolor colorcode ((count turtles-here) / number_of_agents) 0.2 ] ] ;; see reporter colorcode
      [ ask patches [ set pcolor white ] ]
    set t-counter t-counter + 1 
  ]
end 

;; REPORTERS

to-report new-opinion
  report random-float 1
end 

to-report aggregate [opinions]
   if (aggregation_in_HK = "mean") [report mean opinions]
   if (aggregation_in_HK = "median") [report median opinions]
end 

to-report colorcode [x max_x]
  ;; report a color as "x=0 --> violet", "x=max_x --> red" on the color axis violet,blue,cyan,green,yellow,orange,red 
  report hsb (190 - 190 * (x / max_x)) 255 255
end 

;; Copyright 2012 Jan Lorenz
;; See Info tab for full copyright and license

There is only one version of this model, created about 12 years ago by Jan Lorenz.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.