Simone Fiammengo Alessia Giglio Marco Miramondi Federica Odifreddi

Simulation models for economics

Project work on

"Import duties and consumption."

 

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 Import duties and consumption application.


powered by NetLogo

view/download model file: import_duties_and_consumption.nlogo

WHAT IS IT?

The simulation is based on the study of the effect of duties on internal coffee consumption. The goal of the model is to provide how consumers react when we introduce duties, given their wealth, level of education, economic and political freedom. The introduction of variables regarding economic and political freedom for each country can modify strongly the consumer behavior, having effects on consumption and trade.

HOW IT WORKS

We create X individuals for each country (where X reflects the cardinality of the population in every country).
The three Nations (Brazil, Argentina, Venezuela) produce coffee in different proportions and quantities. Agents consume one of the two types of coffee produced and the amount depends mainly on their income.
At the beginnings of every cycle (i.e. every 4 ticks) every Country has a given probability of introducing a new import duty; at the same time the duty can be removed with a given probability.
Then, if the duty is effectively introduced in a Country, individuals react and reduce their consumption with a certain lag. This lag in their reaction depends positively on their wealth and negatively on their education and economic and political freedom of the country.

HOW TO USE IT

Click the SET UP button to set up the operators (agents).
Click the GO button to run the simulation.
Click the Set Display button to change the interface (change the coordinates of the axes within the same simulation).
The agents are divided in three breeds: Brazilians (green), Argentinians (white) and Venezuelans (red).
Click on CHOOSERY to change variable (income or education) on the y-axis.
Click on CHOOSERX to change variable (quantity of brazilian coffee or quantity of venezuelan coffee or the sum of the two) on the x-axis.
The SLIDERS show the probability that a duty is introduced (one slider for each country), the magnitude of the duty (one slider for each country) and the probability that the duty is eliminated.
The NATIONAL CONSUMPTION PLOT shows how the coffee consumption in each country and the total coffee consumption change over time.
The COFFEE TYPE CONSUMPTION PLOT shows how the total consumption of brazilian coffee, the total consumption of venezuelan coffee and the sum of the two change over time.
The INPUT BUTTONS show if the duty has effectively been introduced at each cycle in the countries.
The other INPUT BUTTON show the lag corresponding to the tick in every cycle.

THINGS TO TRY

With CHOOSERY and CHOOSERX it is possible to change variable on y-axis and x-axis respectively.
With the SLIDERS it is possible to change the probability that a duty is introduced (one slider for each country) or to change the magnitude of the duty (one slider for each country) or to change the probability that the duty is eliminated.

EXTENDING THE MODEL

An interesting extention could be to introduce more commodities in order to see different reactions in complement or substitute goods when a duty is introduced on a certain one.
An even more important extention could be to increase the interaction among countris. The idea is that the probability of introducing a new duty increases if another country has introduced a new one in the previous period (sort of duty war).
The possibility of eliminating duties does not depend on a given probability but is decided jointly by the three nations when consumptions decrease over a certain level.

NETLOGO FEATURES

Interesting functions in the Code tab are :
- ask N-OF 184 brazilians : ask 184 randomly chosen brazilians to do something.
- random-float 1 < Venezuela-DutyProbability : useful to make the given value for the probability of introducing a duty, a probability.

CODE

breed [brazilians brazilian]
breed [argentinians argentinian]
breed [venezuelans venezuelan]

turtles-own [
  economic-freedom        ; composed by level of propety right protection, governement spending, labor and monetary freedom, trade freedom 
  governement             ; if democracy 0, if dictatorship 1
  press-liberty           ; from a survey about direct attacks on journalists and indirect sources of pressure against the free press
  income                  ; obtained from cdf of income across population
  education               ; obtained from average individual expenditure on education as a share of income 
  coffee-brazil           ; individual consumption of coffee produced in Brazil
  coffee-venezuela        ; individual consumption of coffee produced in Venezuela  
  class-brazil            ; class of the income distribution in Brazil
  class-argentina         ; class of the income distribution in Argentina
  class-venezuela         ; class of the income distribution in Venezuela
  SAVE-coffee-brazil      ; individual consumption of brazilian coffee when there in no duty 
  SAVE-coffee-venezuela   ; individual consumption of venezuelan coffee when there in no duty
  VarLag                  ; variable
  Lag                     ; time needed for the adjustment of the coffee quantity after the duty (a lag correspond to a quarter)
  time
  duty
 ]


to setup
  clear-all
  
  create-brazilians 194 [ 
    set shape "person"
    set color green
    set economic-freedom 58
    set governement 0
    set press-liberty 35
  ]
  
  ask brazilians [
    let s random-normal 0 5
    let c random-float 1.0
      if c <= 0.2 [
        set class-brazil 1
        set income (7.3 + s)
        set size 0.5
        ] 
      if c > 0.2 and c <= 0.4 [
        set class-brazil 2
        set income (18.4 + s)
        set size 0.5
        ] 
      if c > 0.4 and c <= 0.6 [
        set class-brazil 3
        set income (32 + s)
        set size 1
        ]
      if c > 0.6 and c <= 0.8 [
        set class-brazil 4
        set income (49.1 + s)
        set size 1
        ]
      if c > 0.8 and c <= 1 [
        set class-brazil 5
        set income (151 + s)
        set size 2.5
        ]
      if income < 0 [
        set income 0
        ]
      
     let j (random-normal 1 0.025) * (0.05 * income)
     set education (0.05 * income + j)
       
  ]
  
  ask n-of 184 brazilians [
    if class-brazil = 1 [set coffee-brazil 1.2 + (222.44 / 184 + random-normal 0 0.1)] 
    if class-brazil = 2 [set coffee-brazil 2.417 + (222.44 / 184 + random-normal 0 0.1)] 
    if class-brazil = 3 [set coffee-brazil 6.044 + (222.44 / 184 + random-normal 0 0.1)]
    if class-brazil = 4 [set coffee-brazil 6.044 + (222.44 / 184 + random-normal 0 0.1)]
    if class-brazil = 5 [set coffee-brazil 8.462 + (222.44 / 184 + random-normal 0 0.1)]
  ]
  
  
  ask brazilians with [coffee-brazil = 0] [
    if class-brazil = 1 [set coffee-venezuela 0.26 + (2.6 / 10 + random-normal 0 0.1)] 
    if class-brazil = 2 [set coffee-venezuela 0.52 + (2.6 / 10 + random-normal 0 0.1)] 
    if class-brazil = 3 [set coffee-venezuela 1.3 + (2.6 / 10 + random-normal 0 0.1)]
    if class-brazil = 4 [set coffee-venezuela 1.3 + (2.6 / 10 + random-normal 0 0.1)]
    if class-brazil = 5 [set coffee-venezuela 1.82 + (2.6 / 10 + random-normal 0 0.1)]
    
  ]
                
        
     
  create-argentinians 41 [ 
    set shape "person"
    set color white
    set economic-freedom 48
    set governement 0
    set press-liberty 14
  ]
  
  ask argentinians [
    let g random-normal 0 15
    let f random-float 1.0
      if f <= 0.2 [
        set class-argentina 1
        set income (53 + g)
        set size 1
        ] 
      if f > 0.2 and f <= 0.4 [
        set class-argentina 2
        set income (113 + g)
        set size 2
        ] 
      if f > 0.4 and f <= 0.6 [
        set class-argentina 3
        set income (180 + g)
        set size 2.5
        ]
      if f > 0.6 and f <= 0.8 [
        set class-argentina 4
        set income (270 + g)
        set size 3
        ]
      if f > 0.8 and f <= 1 [
        set class-argentina 5
        set income (602 + g)
        set size 4
        ]
      if income < 0 [
        set income 0
        ]
      
     let k (random-normal 1 0.019) * (0.038 * income)
     set education (0.038 * income + k)
 
  ]
  
  
  ask n-of 25 argentinians [
    if class-argentina = 1 [set coffee-brazil 0.72 + (6 / 25 + random-normal 0 0.1)] 
    if class-argentina = 2 [set coffee-brazil 0.72 + (6 / 25 + random-normal 0 0.1)] 
    if class-argentina = 3 [set coffee-brazil 0.96 + (6 / 25 + random-normal 0 0.1)]
    if class-argentina = 4 [set coffee-brazil 0.96 + (6 / 25 + random-normal 0 0.1)]
    if class-argentina = 5 [set coffee-brazil 1.44 + (6 / 25 + random-normal 0 0.1)]
  ]
  
  ask argentinians with [coffee-brazil = 0] [
    if class-argentina = 1 [set coffee-venezuela 0.412 + (2.2 / 16 + random-normal 0 0.1)] 
    if class-argentina = 2 [set coffee-venezuela 0.412 + (2.2 / 16 + random-normal 0 0.1)] 
    if class-argentina = 3 [set coffee-venezuela 0.55 + (2.2 / 16 + random-normal 0 0.1)]
    if class-argentina = 4 [set coffee-venezuela 0.55 + (2.2 / 16 + random-normal 0 0.1)]
    if class-argentina = 5 [set coffee-venezuela 0.825 + (2.2 / 16 + random-normal 0 0.1)]
    
  ]
  
  
     
  create-venezuelans 29 [ 
    set shape "person"
    set color red
    set economic-freedom 38
    set governement 1
    set press-liberty 55
  ]
  
  ask venezuelans [
    let t random-normal 0 50
    let i random-float 1.0
      if i <= 0.2 [
        set class-venezuela 1
        set income (73.8 + t)
        set size 1.5
        ] 
      if i > 0.2 and i <= 0.4 [
        set class-venezuela 2
        set income (164.1 + t)
        set size 2.5
        ] 
      if i > 0.4 and i <= 0.6 [
        set class-venezuela 3
        set income (251.7 + t)
        set size 3
        ]
      if i > 0.6 and i <= 0.8 [
        set class-venezuela 4
        set income (382.4 + t)
        set size 3.5
        ]
      if i > 0.8 and i <= 1 [
        set class-venezuela 5
        set income (852 + t)
        set size 4.5
        ]
      if income < 0 [
        set income 0
        ]
      
     let l (random-normal 1 0.026) * (0.052 * income)
     set education (0.052 * income + l)
 
  ]
  
  
  ask n-of 20 venezuelans [
    if class-venezuela = 1 [set coffee-venezuela 0.6 + (6 / 20 + random-normal 0 0.1)] 
    if class-venezuela = 2 [set coffee-venezuela 0.9 + (6 / 20 + random-normal 0 0.1)] 
    if class-venezuela = 3 [set coffee-venezuela 1.2 + (6 / 20 + random-normal 0 0.1)]
    if class-venezuela = 4 [set coffee-venezuela 1.5 + (6 / 20 + random-normal 0 0.1)]
    if class-venezuela = 5 [set coffee-venezuela 1.8 + (6 / 20 + random-normal 0 0.1)]
  ]
  
  ask venezuelans with [coffee-venezuela = 0] [
    if class-venezuela = 1 [set coffee-brazil 0.728 + (3.28 / 9 + random-normal 0 0.1)] 
    if class-venezuela = 2 [set coffee-brazil 1.093 + (3.28 / 9 + random-normal 0 0.1)] 
    if class-venezuela = 3 [set coffee-brazil 1.457 + (3.28 / 9 + random-normal 0 0.1)]
    if class-venezuela = 4 [set coffee-brazil 1.822 + (3.28 / 9 + random-normal 0 0.1)]
    if class-venezuela = 5 [set coffee-brazil 2.186 + (3.28 / 9 + random-normal 0 0.1)]
    
  ]
  
  
  ask turtles [
    if chooserX = "coffee-brazil" [set xcor coffee-brazil * 10]
    if chooserX = "coffee-venezuela" [set xcor coffee-venezuela * 10]
    if chooserX = "coffee-brazil&coffee-venezuela" [set xcor (coffee-brazil + coffee-venezuela) * 10]  
    if chooserY = "income" [set ycor income / 10]
    if chooserY = "education" [set ycor education ]
    set Period "0"
    set DutyBrazilOnVenezuelanCoffee " "
    set DutyArgentinaOnBrazilianCoffee " "
    set DutyArgentinaOnVenezuelanCoffee " "
    set DutyVenezuelaOnBrazilianCoffee " "
  ]
  
  
  ask turtles [
    set SAVE-coffee-brazil coffee-brazil
    set SAVE-coffee-venezuela coffee-venezuela
  ]
  
  ask turtles [
    Set VarLag (income - education - press-liberty + (governement * 10)) 
    if VarLag <= 100 [set lag 1]
    if VarLag > 100 and VarLAg <= 300 [set lag 2]
    if VarLag > 300 and VarLAg <= 600 [set lag 3]
    if VarLag > 600 [set lag 4]
 ]
  
  
  let TotalCoffeeBrazil sum [coffee-brazil] of turtles
  show TotalCoffeeBrazil
  
  let TotalCoffeeVenezuela sum [coffee-venezuela] of turtles
  show TotalCoffeeVenezuela
  
  let Sum1CoffeeBrazil sum [coffee-brazil] of brazilians
  show Sum1CoffeeBrazil
  
  let Sum1CoffeeVenezuela sum [coffee-venezuela] of brazilians
  show Sum1CoffeeVenezuela
  
  let Sum2CoffeeBrazil sum [coffee-brazil] of argentinians
  show Sum2CoffeeBrazil
  
  let Sum2CoffeeVenezuela sum [coffee-venezuela] of argentinians
  show Sum2CoffeeVenezuela
  
  let Sum3CoffeeBrazil sum [coffee-brazil] of venezuelans
  show Sum3CoffeeBrazil
  
  let Sum3CoffeeVenezuela sum [coffee-venezuela] of venezuelans
  show Sum3CoffeeVenezuela
  
  
  reset-ticks     
  end


to SetDisplay
  
  ask turtles [
    if chooserX = "coffee-brazil" [set xcor coffee-brazil * 10]
    if chooserX = "coffee-venezuela" [set xcor coffee-venezuela * 10]
    if chooserX = "coffee-brazil&coffee-venezuela" [set xcor (coffee-brazil + coffee-venezuela) * 10]  
    if chooserY = "income" [set ycor income / 10]
    if chooserY = "education" [set ycor education]
  ]
  
end


to go
  
  ask turtles [
    if time < 5 [set time (time + 1)]
    if time = 5 [set time 1]
  ]
    
  ask brazilians [
    if coffee-brazil = 0 [
      if time = 1 [
        if random-float 1 < Brazil-DutyProbability [ set duty 1 ] 
      ]
      if time = lag and duty = 1 [ set coffee-venezuela (coffee-venezuela + (dutyBrazil * (-0.6) + random-normal 0 0.05)) ]
      if coffee-venezuela < 0 [ set coffee-venezuela 0 ]
      if time = 1 [
        if random-float 1 < NoDuty-Probability [ set coffee-venezuela SAVE-coffee-venezuela ]
      ]
    ]
  ]
    
  ask argentinians [
    if coffee-venezuela = 0 [
      if time = 1 [
        if random-float 1 < Argentina-DutyProbability [ set duty 2 ]
      ]
      if time = lag and duty = 2 [ set coffee-brazil (coffee-brazil + (dutyArgentina * (-0.5) + random-normal 0 0.05)) ]
      if coffee-brazil < 0 [ set coffee-brazil 0 ]
      if time = 1 [
      if random-float 1 < NoDuty-Probability [ set coffee-brazil SAVE-coffee-brazil ]
      ]
    ]
    
    if coffee-brazil = 0 [
      if time = 1 [
        if random-float 1 < Argentina-DutyProbability [ set duty 3 ]
      ] 
      if time = lag and duty = 3 [ set coffee-venezuela (coffee-venezuela + (dutyArgentina * (-0.5) + random-normal 0 0.05)) ]
      if coffee-venezuela < 0 [ set coffee-venezuela 0 ]
      if time = 1 [
      if random-float 1 < NoDuty-Probability [ set coffee-venezuela SAVE-coffee-venezuela ]
      ]
    ]
  ]
  
  ask venezuelans [
    if coffee-venezuela = 0 [
      if time = 1 [
        if random-float 1 < Venezuela-DutyProbability [ set duty 4 ]
      ]
      if time = lag and duty = 4 [ set coffee-brazil (coffee-brazil + (dutyVenezuela * (-0.7) + random-normal 0 0.05)) ]
      if coffee-brazil < 0 [ set coffee-brazil 0 ]
      if time = 1 [
      if random-float 1 < NoDuty-Probability [ set coffee-brazil SAVE-coffee-brazil ]
      ]
    ]
  ]
  
  ask turtles [
    if chooserX = "coffee-brazil" [set xcor coffee-brazil * 10]
    if chooserX = "coffee-venezuela" [set xcor coffee-venezuela * 10]
    if chooserX = "coffee-brazil&coffee-venezuela" [set xcor (coffee-brazil + coffee-venezuela) * 10]  
    if chooserY = "income" [set ycor income / 10]
    if chooserY = "education" [set ycor education]
  ]
    
  
  ask turtles [
    if time = 1 [set Period "1"]
    if time = 2 [set Period "2"]
    if time = 3 [set Period "3"]
    if time = 4 [set Period "4"]
    if time = 1 and random-float 1 < Brazil-DutyProbability [set DutyBrazilOnVenezuelanCoffee "YES"]
    if time = 1 and random-float 1 < Argentina-DutyProbability [set DutyArgentinaOnBrazilianCoffee "YES"]
    if time = 1 and random-float 1 < Argentina-DutyProbability [set DutyArgentinaOnVenezuelanCoffee "YES"]
    if time = 1 and random-float 1 < Venezuela-DutyProbability [set DutyVenezuelaOnBrazilianCoffee "YES"]
    if time = 1 and random-float 1 > Brazil-DutyProbability [set DutyBrazilOnVenezuelanCoffee "NO"]
    if time = 1 and random-float 1 > Argentina-DutyProbability [set DutyArgentinaOnBrazilianCoffee "NO"]
    if time = 1 and random-float 1 > Argentina-DutyProbability [set DutyArgentinaOnVenezuelanCoffee "NO"]
    if time = 1 and random-float 1 > Venezuela-DutyProbability [set DutyVenezuelaOnBrazilianCoffee "NO"]
  ]
  
  
  let TotalCoffeeBrazil sum [coffee-brazil] of turtles
  show TotalCoffeeBrazil
  
  let TotalCoffeeVenezuela sum [coffee-venezuela] of turtles
  show TotalCoffeeVenezuela
  
  tick
end