The applet requires Java 5 or higher. Java must be enabled in your browser settings. Mac users must have Mac OS X 10.4 or higher. Windows and Linux users may obtain the latest Java from Sun's Java site.
powered by NetLogo
view/download model file: social_influence.nlogo
The simulation in this model tries to show the effect of social influence in a group of people, that is a complete connected graph: studying the initial median of people’ opinions and its difference with on the go median, it is possible to observe how people influence each other, creating none, one or several patches of opinions.
According to Deffuant and Hegselmann-Krause models, when people meet each other they change their own opinion towards another: a new opinion depending on mu for Deffuant, the avarage opinion of other people in radius vision for Hegselmann-Krause.
Before running the procedure, the user has to choose how many agents he wants to create and the distribution of opinions, with its relative parameter (“power-law-exponent” or “lambda-exponent”). “Setup” button actually creates people.
Pressing “go” the user can observe the evolving system and the median of the distribution of opinions: changing “epsilon” and “mu” is useful to create or destroy patches of opinions and setting the speed of achievement of consensus.
Slider “vision” changes the radius of every people in which others agents are chosen to modify opinions.
The two different opinion models can be chosen from “OpinionModel” button.
The color of the agents is set equal to their opinion: for this reason the probability distributions of opinions are normalized on [0,140] instead of [0,1].
An extended value of “vision” drastically reduces the continuous refresh of agents’ movement on the world.
The user should try both models: beginning from a low “epsilon”, he could increase its value to observe fast achievement of consensus. With Hegselmann-Krause model, moreover, he should not observe any difference in changing “mu”.
The effect of social influence in this model is studied on complete connected graph: the user could change this situation creating a random graph, or a Watts-Strogatz one or Barabasi one.
extensions [array] breed [people person] globals [ med0 med ] people-own[opinion] to setup ;; (for this model to work with NetLogo's new plotting features, ;; __clear-all-and-reset-ticks should be replaced with clear-all at ;; the beginning of your setup procedure and reset-ticks at the end ;; of the procedure.) __clear-all-and-reset-ticks setup-people tick do-plots end to setup-people create-people number ask people [ set shape "person" setxy random-xcor random-ycor setup-opinion set color opinion ] set med0 median [opinion] of people end to setup-opinion if (distribution = "power-law")[ if (power-law-exponent <= 0) [ user-message ( word "Error: the power law exponent must be greater than 0" ) stop ] set opinion 140 * random-float 1.0 ^ (1 / (1 + power-law-exponent)) ] if (distribution = "exponential")[ if (lambda-exponent = 0)[ user-message ( word "Error: the lambda exponent must be different from 0" ) stop ] set opinion (-1 / lambda-exponent) * ln(1 - (random-float 1.0) * (1 - e ^ (- 140 * lambda-exponent))) ] end to go move-people ask people [change-opinion] set med median [opinion] of people tick do-plots end to move-people ask people [ right random 360 forward 1 ] end to change-opinion if(OpinionModel = "Deffuant")[Deffuant] if(OpinionModel = "Hegselmann-Krause")[Hegselmann-Krause] ifelse show-opinion? [set label opinion] [set label ""] end to Deffuant if (any? other people in-radius vision)[ let othe one-of other people in-radius vision if (abs ([opinion] of self - [opinion] of othe) < epsilon) [ let increment opinion - [opinion] of othe set opinion opinion - mu * increment ask othe [set opinion opinion + mu * increment] ] ] set color opinion end to Hegselmann-Krause if (any? other people in-radius vision)[ let vectorOthers ([opinion] of other people in-radius vision) let vectorOpinion filter [abs(? - [opinion] of self) < epsilon] vectorOthers if (length vectorOpinion != 0) [ set opinion mean vectorOpinion set color opinion ] ] end to do-plots set-current-plot "Medians" set-current-plot-pen "Initial-median" plot med0 set-current-plot-pen "On-the-go-median" plot med end