Francesco Carbonero Federico Gaido Fabio Scalabrino

Simulation models for economics

Project work on

"Altruism, cooperation and contribution among closed groups."

 

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 Oracle's Java site.


Here you can find an introduction to the Altruism, cooperation and contribution among closed groups application.


powered by NetLogo

view/download model file: altruism_cooperation_and_contribution_among_closed_groups.nlogo

WHAT IS IT?

The model wants to print out how interection among agents, divided in four groups, defines the level of contribution for public goods, where the main elements that influence the decision of how much contribute are altruism, prestige and contribution of other agents of the group.
In our model we condider the reputation as what each agent wants other agents think about itself and altruism as “taking pleasure in others’ pleasure”.

HOW IT WORKS

Starting from Fowler - Christakis model, when agents interacte with groupmate, they are influenced to change their own level of contribution in order to not make a poor impression on the other.

Improving this vision, when an agent goes in a new group, initially he sees and is influenced only by the average level of contribution, but some people have an high level of contribution because are more interested in reputatin than altruism, then the willingness of having high reputation influences the level of contribution. After some ticks that two agents are linked, they become able to see the real reasons of others’ contribution: if contribution is given by an high level of reputation and not by altruism, “my” contribution goes down and viceversa.

HOW TO USE IT

Before running the procedure, the user has to choose how many agents he wants to create, level of altruism for each group, while the level of reputation is random for every people, and after how many time agents know real intentions of others agents. Setting “t”, user could decide the importance of reputation that each turtles gives to his reputation seen from other agents.
Setup button actually creates people.

Pressing go the user can observe the evolving system and we have agents moving randomly that create links with agents of same groups, leaving die links with agents of the previous groups. In any period each agents decide their level of contribution according to their level of altruism and reputation, the average contribution of the group. After ‘time to know’, links become black because agents see real intentions of each other and level of contribution ia now influenced also by the difference between altruism and reputation of other agents.

THINGS TO NOTICE

The color of the agents is set equal to their level of contribution: free-rider people are black and the most altruistic people tend to white

RELATED MODELS

“Cooperative behaviour cascades in human social networks” by James Fowler and Nicholas A. Christakis

“Conditional cooperation and voluntary contribution to public good” by Claudia keser and Frans van Winden

“Impure altruism and donation to public goods: a theory of warm-glow giving”
Andreoni

“A standard protocol for describing individual-based and agent-based models”
Various authors

CODE

turtles-own [group altruism reputation contribution initial-group ]  
;define the nature of group and other characteristics

links-own [life difference]



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
  ;to see the charactheristic of create-wall, see below  
  
  set-default-shape turtles "person"
  create-turtles number-of-turtles ; this is usefull for the turtles interface bar 
  
  
  ask patches [set pcolor green] 
  
   create-wall 
  
  ask turtles [setxy random-xcor random-ycor] ;so turtles start randomly 
  
  ask turtles [create-initial-groups] ; we see creation of groups below 
  
  ask turtles [ if pcolor = yellow [die]]
  
  
  
  ask turtles [set reputation random 10] ;we define a random level of reputation for all agents
  
 
  
  ask turtles [if initial-group = 1 [set altruism altruism-group-1]]
  
  ask turtles [if initial-group = 2 [set altruism altruism-group-2]]
  
  ask turtles [if initial-group = 3 [set altruism altruism-group-3]]
  
  ask turtles [if initial-group = 4 [set altruism altruism-group-4]]
  ;we fix the initial level of reputation for any turtle according to their position on the map
 
  
  ask links [ set life ticks ] 
  ;we count how many ticks a link is alive
  
  create-links
  
  ask turtles [set contribution (altruism + reputation * t)] ;we fix the initial level of contribution of all agents
  
  ask turtles [if contribution < 0 [set contribution 0]]

  ask turtles [if contribution > 9.9999999999999 [set contribution 9.9]]
  
  ask turtles [set color contribution]
  end


to go
  
  ask turtles ;so turtles move randomly 
  [lt random 360
    fd 1]

  ask turtles
  [if pcolor = yellow [ jump 2 fd 2]]
   
  tick
  
  ask turtles [ 
  if pxcor > 0 and pycor > 0 [set group 1] 
  if pxcor > 0 and pycor < 0 [set group 2]
  if pxcor < 0 and pycor < 0 [set group 3]
  if pxcor < 0 and pycor > 0 [set group 4]]
  
  ask turtles [set color contribution]
  
  computation-contribution
  computation-reputation
  create-links
  ask links [ if [group] of (end1) != [group] of (end2) [ die ]] ;we kill links when a turtle changes group 
  plot-contribution

end

to create-wall
  ;we create walls to divide area in four groups 
  
  ask patches with [pxcor = 0]
    [set pcolor yellow]
        
  ask patches with [pycor = 0]
    [set pcolor yellow]   
end

to create-initial-groups ;this just to creating groups using patches' coordinates
  
  if pxcor > 0 and pycor > 0 [set initial-group 1] 
  if pxcor > 0 and pycor < 0 [set initial-group 2]
  if pxcor < 0 and pycor < 0 [set initial-group 3]
  if pxcor < 0 and pycor > 0 [set initial-group 4]
end

to create-links
 
 ask turtles
   [if group = 1
   [create-links-to other turtles with [group = 1]]]
   
 ask turtles
   [if group = 2
   [create-links-to other turtles with [group = 2]]]

 ask turtles
   [if group = 3
   [create-links-to other turtles with [group = 3]]]

 ask turtles
   [if group = 4
   [create-links-to other turtles with [group = 4]]] 
  
 ask links [set life (life + 1)]
  
 ask links [if life < time-to-know [hide-link]]
 ask links [if life > time-to-know [show-link]]  
end

to computation-contribution
  
  let average-contribution-1 (mean [contribution] of turtles with [group = 1])

  let average-contribution-2 (mean [contribution] of turtles with [group = 2]) 
  
  let average-contribution-3 (mean [contribution] of turtles with [group = 3]) 

  let average-contribution-4 (mean [contribution] of turtles with [group = 4])
  
  ;given the initial level of contribution for any turtle, this value increases if the average contribution of the group
  ; is higher than mine, and viceversa
  
  ask turtles with [group = 1] [ifelse contribution > average-contribution-1 
    [set contribution (altruism + reputation * t - (0.2 * average-contribution-1))]
    [if contribution < average-contribution-1 
    [set contribution (altruism + reputation * t + (0.2 * average-contribution-1))]]]
  
   ask turtles with [group = 2] [ifelse contribution > average-contribution-2 
    [set contribution (altruism + reputation * t - (0.2 * average-contribution-2))]
    [if contribution < average-contribution-2 
    [set contribution (altruism + reputation * t + (0.2 * average-contribution-2))]]]
   
    ask turtles with [group = 3] [ifelse contribution > average-contribution-3 
    [set contribution (altruism + reputation * t - (0.2 * average-contribution-3))]
    [if contribution < average-contribution-3 
    [set contribution (altruism + reputation * t + (0.2 * average-contribution-3))]]]
    
     ask turtles with [group = 4] [ifelse contribution > average-contribution-4 
    [set contribution (altruism + reputation * t - (0.2 * average-contribution-4))]
    [if contribution < average-contribution-4 
    [set contribution (altruism + reputation * t + (0.2 * average-contribution-4))]]]
end

to computation-reputation
  
ask links [set difference ([altruism] of end1  - [reputation * t] of end1)]
        
ask links [if life > time-to-know  [ set color black]] 
;after tot ticks, any turtles is able to see real intentions in the contribution

ask links with [color = black]
  [ifelse difference > 0 
    [let diff abs difference ask end2 
      [set contribution (contribution + 0.3 * diff)]]
  [if difference < 0 
          [let diff abs difference  ask end2 
             [set contribution (contribution - 0.3 * diff)]]]]
  ;if a turtle sees that the another one has altruism < reputation, his contribution decrease and viceversa


ask turtles [if contribution < 0 [set contribution 0]]                   ;we impose an upper and lower bound to the contribution of agents

ask turtles [if contribution > 9.9999999999999 [set contribution 9.9]]
end
     
to plot-contribution
  
  let average-contribution-1 (mean [contribution] of turtles with [group = 1])

  let average-contribution-2 (mean [contribution] of turtles with [group = 2]) 
  
  let average-contribution-3 (mean [contribution] of turtles with [group = 3]) 

  let average-contribution-4 (mean [contribution] of turtles with [group = 4])
  
set-current-plot "total contribution"
set-current-plot-pen "contribution-1"
plot average-contribution-1
set-current-plot-pen "contribution-2"
plot average-contribution-2
set-current-plot-pen "contribution-3"
plot average-contribution-3
set-current-plot-pen "contribution-4"
plot average-contribution-4
end