Dario Sansone

Simulation models for economics

Project work on

"Agriculture and competition."

 

The applet requires Java 1.4.1 or higher. It will not run on Windows 95 or Mac OS 8 or 9. Mac users must have OS X 10.2.6 or higher and use a browser that supports Java 1.4. (Safari works, IE does not. Mac OS X comes with Safari. Open Safari and set it as your default web browser under Safari/Preferences/General.) On other operating systems, you may obtain the latest Java plugin from Sun's Java site.


powered by NetLogo

view/download model file: agriculture_and_competition.nlogo

WHAT IS IT?

The model explores the stability, the evolution and the sustainability of a system with technical progress, random shocks, non renewable resources, birth control and a welfare state.


HOW IT WORKS

The program creates a world with renewable resources and in which each citizen is generated, moves, eats, reproduces, gets old and dies.
The user, thanks to different sliders and switches, can introduces more variables and he can implement different kind of policies.
The fertility rate and the life expectancy change over time.


HOW TO USE IT

1. Adjust the slider parameters (see below), or use the default settings.
2. Press the SETUP button.
3. Press the GO button to begin the simulation.
4. Look at the monitors to check the variables of this model
5. Look at the TOTAL and POPULATION COMPOSITION plots to watch the population fluctuation over time

Parameters:

NUMBER-OF-CITIZENS: The initial size of the population
TECHNICAL-PROGRESS?:Whether or not to introduce progress by means of increasing productivity
SHOW-ENERGY?: Whether or not to show the energy of each citizen as a number
NON-RENEWABLE-RESOURCES?: Whether or not to reduce gradually the growth rate of the resources
BIRTH-CONTROL?: Whether or not to enable only adults citizen with less than 50 children to reproduce themselves
SHOCKS?: Whether or not to introduce random shocks which may modify the composition of the population
REDISTRIBUTION?: Whether or not to introduce a welfare state
EDUCATION?:Whether or not to introduce an education system
MARGINAL-TAX-RATE: the tax burden, i.e. citizens have to pay a tax which is equal to the marginal tax rate multiplied by their energy
POVERTY-LINE: citizens which have less energy than the poverty line are considered poor
POVERTY-REDUCTION: the import of the subsidy received by poor citizens is equal to poverty reduction times the difference between poverty line and the energy of the citizen
EDUCATION-EXPENDITURE-PERCAPITA: public expenditure per capita in order to offer a public education to young citizens


THINGS TO NOTICE

See the different patterns of population and population composition when different switches are activated. Some choice are sustainable in the long run and other ones tends to bring citizens towards extinction or are financial unsustainable.

Note that is very important the time in which some policies such as education system or welfare state are implemented. The results may be very different both in the short run and in the long run.

Note that the tax burder play a key role in stimulating or dampening the population growth.


THINGS TO TRY

Try to modify the initial number of citizens. Does the shorth run equilibrium change?

Try to activate only some switches and see the effects.

Try to balance a good welfare state and education sistem with their financial sustainability: if the government debt is more than 500000, there is the default of the State.

Try to see, modifing sliders and activating switches, if there is a long-run equilibrium, a trend or if the model is instable.


EXTENDING THE MODEL

Some interesting things to add would be: pollution, diseases and health system, happyness of population and possibility of rebellions, different breeds which compete to survive.


NETLOGO FEATURES

Note the use of let in order to create temporary variables.
Note the use of global variables in order to set variables which affect all the citizens, such as productivity, life expectancy, grass growth rate, knowledge and government budget.
Note the use of mathematical function, such as the square root or the natural logarithm, in order to consider decreasing marginal improvement in progress, life expectancy and growth rate of natural resources.


RELATED MODELS

Look at Wolf Sheep Predation for a model of interacting populations with limited resources and instability problems.


CREDITS AND REFERENCES

Paolo Bosi (a cura di), "Corso di scienza delle finanze", 2010 - Quinta edizione, Il Mulino. Cap. 7 - La spesa per il Welfare State

Giovanni Pavanelli, "Valore, distribuzione, moneta: un profilo di storia del pensiero economico", 2010 - Seconda edizione, FrancoAngeli. Cap. 5.1 - Malthus e il Saggio sul principio della popolazione

The World Bank, World Development Report 2008, "Agriculture for Development", Overview


PROCEDURES

globals [productivity-reds
         productivity-blues
         life-expectancy-reds
         life-expectancy-blues
         grass-growth-rate
         energy-from-grass-reds
         energy-from-grass-blues
         government-budget-reds
         government-budget-blues
         knowledge-reds
         knowledge-blues
         productivity-of-the-young-reds
         productivity-of-the-young-blues]

turtles-own [energy
             age
             children]

breed [blue-turtles blue-turtle]
breed [red-turtles red-turtle]       

to setup
  ca
  ask patches [set pcolor one-of [green brown]]
  create-blue-turtles initial-number-of-blue-citizens [setxy random-xcor random-ycor
                                                       set energy random 10
                                                       set color blue
                                                       set size 2
                                                       set age random 180]
  create-red-turtles initial-number-of-red-citizens  [setxy random-xcor random-ycor
                                                      set energy random 10
                                                      set color red
                                                      set size 2
                                                      set age random 180]
  do-plots  
end

to go
  ifelse technical-progress-reds? [set-productivity-reds]
                                  [set productivity-reds 0]
  ifelse technical-progress-blues? [set-productivity-blues]
                                   [set productivity-blues 0]
  set energy-from-grass-reds 25 + productivity-reds
  set energy-from-grass-blues 25 + productivity-blues
  set life-expectancy-reds 180 + sqrt (ticks + productivity-reds)
  set life-expectancy-blues 180 + sqrt (ticks + productivity-blues)
  ifelse non-renewable-resources? [set-grass-growth-rate]
                                  [set grass-growth-rate 10]
  ask turtles[move-turtle
              display-label]
  let temp random 2
  ifelse temp = 0 [ask red-turtles [eat-grass-reds
                                    death-reds]
                   ask blue-turtles [eat-grass-blues
                                     death-blues]]
                  [ask blue-turtles [eat-grass-blues
                                     death-blues]
                   ask red-turtles [eat-grass-reds
                                    death-reds]]
  ask patches  with [pcolor = brown] [grow-grass]
  if redistribution-reds? or education-reds? [ask red-turtles [pay-taxes-reds]]
  if redistribution-blues? or education-blues? [ask blue-turtles [pay-taxes-blues]]
  if redistribution-reds? [ask red-turtles [redistribution-of-resources-reds]]
  if redistribution-blues? [ask blue-turtles [redistribution-of-resources-blues]]
  if education-reds? [implement-education-system-reds]
  if education-blues? [implement-education-system-blues]
  ifelse birth-control-reds? [reproduction-conditions1-reds]
                             [reproduction-conditions2-reds]
  ifelse birth-control-blues? [reproduction-conditions1-blues]
                              [reproduction-conditions2-blues]
  ask patches  with [pcolor = brown] [grow-grass]
  if shocks? [do-shock]
  if count red-turtles = 0 or count blue-turtles = 0 [stop]
  if government-budget-reds < -500000 [user-message ( word "Default of the State of the reds")
                                       ask red-turtles [die]] 
  if government-budget-blues < -500000 [user-message ( word "Default of the State of the blues")
                                        ask blue-turtles [die]]                      
  tick
  do-plots
end

to implement-education-system-reds
  let education-expenditure-reds (education-expenditure-percapita-reds * 
                                  count red-turtles with [age < (30 + round(life-expectancy-reds / 10))])
  set government-budget-reds (government-budget-reds - education-expenditure-reds - 2000)
  set knowledge-reds (knowledge-reds + (1 + random 1) * education-expenditure-reds)
  set productivity-of-the-young-reds (2 * education-expenditure-percapita-reds)
end

to implement-education-system-blues
  let education-expenditure-blues (education-expenditure-percapita-blues * 
                                   count blue-turtles with [age < (30 + round(life-expectancy-blues / 10))])
  set government-budget-blues (government-budget-blues - education-expenditure-blues - 2000)
  set knowledge-blues (knowledge-blues + (1 + random 1) * education-expenditure-blues)
  set productivity-of-the-young-blues (2 * education-expenditure-percapita-blues)
end

to set-productivity-reds
  set productivity-reds sqrt (0.1 * ticks + 
                              2 * count red-turtles with [age >= (30 + round(life-expectancy-reds / 10)) and 
                                                          age <= (150 + round(life-expectancy-reds / 20))] + 
                             (0.5 - productivity-of-the-young-reds) * count red-turtles with [age < (30 + round(life-expectancy-reds / 10))] + 
                              0.2 * count red-turtles with [age > (150 + round(life-expectancy-reds / 20))]+
                              0.1 * knowledge-reds +
                              random-normal 0 1)
end

to set-productivity-blues
  set productivity-blues sqrt (0.1 * ticks + 
                               2 * count blue-turtles with [age >= (30 + round(life-expectancy-blues / 10)) and 
                                                            age <= (150 + round(life-expectancy-blues / 20))] + 
                              (0.5 - productivity-of-the-young-blues) * count blue-turtles with [age < (30 + round(life-expectancy-blues / 10))] + 
                               0.2 * count blue-turtles with [age > (150 + round(life-expectancy-blues / 20))]+
                               0.1 * knowledge-blues +
                               random-normal 0 1)
end

to set-grass-growth-rate
  set grass-growth-rate 10 - ln (1 + 0.001 * ticks + 0.00001 * count turtles)
end

to move-turtle
  let steps random 10
  right random 360 
  fd steps
  set energy energy - steps
  set age (age + 1)
end

to eat-grass-reds
  if pcolor = green [set pcolor brown
                     set energy (energy + energy-from-grass-reds)]
end

to eat-grass-blues
  if pcolor = green [set pcolor brown
                     set energy (energy + energy-from-grass-blues)]
end

to death-reds
  if energy < 0 or age > life-expectancy-reds [die]
end

to death-blues
  if energy < 0 or age > life-expectancy-blues [die]
end

to reproduction-conditions1-reds
  ask red-turtles with [age >= (30 + round(life-expectancy-reds / 10)) and 
                        age <= (150 + round(life-expectancy-reds / 20)) and 
                        children < 51] 
                           [generate-red-turtle]  
end

to reproduction-conditions2-reds
  ask red-turtles with [age >= (30 + round(life-expectancy-reds / 10)) and 
                        age <= (150 + round(life-expectancy-reds / 20))] 
                           [generate-red-turtle] 
end

to generate-red-turtle
  if count red-turtles in-radius 1 > 2 
     and energy > 50 + round (count red-turtles / 10) [set energy (energy / 2)
                                                       set children (children + 1) 
                                                       hatch 1[set energy random 50
                                                               set age 0]]
end 

to reproduction-conditions1-blues
  ask blue-turtles with [age >= (30 + round(life-expectancy-blues / 10)) and 
                         age <= (150 + round(life-expectancy-blues / 20)) and 
                         children < 51] 
                           [generate-blue-turtle]  
end

to reproduction-conditions2-blues
  ask blue-turtles with [age >= (30 + round(life-expectancy-blues / 10)) and 
                         age <= (150 + round(life-expectancy-blues / 20))] 
                           [generate-blue-turtle] 
end

to generate-blue-turtle
  if count blue-turtles in-radius 1 > 2 
     and energy > 50 + round (count blue-turtles / 10) [set energy (energy / 2)
                                                        set children (children + 1) 
                                                        hatch 1[set energy random 50
                                                                set age 0]]
end  

to grow-grass
  if random-float 100 < grass-growth-rate [set pcolor green]
end

to display-label
  ifelse show-energy? [set label round energy][set label "" ]
end

to pay-taxes-reds
  set energy (energy - marginal-tax-rate-reds * energy)
  set government-budget-reds (government-budget-reds + marginal-tax-rate-reds * energy)
end

to pay-taxes-blues
  set energy (energy - marginal-tax-rate-blues * energy)
  set government-budget-blues (government-budget-blues + marginal-tax-rate-blues * energy)
end

to redistribution-of-resources-reds
  if energy < poverty-line-reds [let subsidy poverty-reduction-reds * (poverty-line-reds - energy)
                                 set energy (energy + subsidy)
                                 set government-budget-reds (government-budget-reds - subsidy - 1)]
end

to redistribution-of-resources-blues
  if energy < poverty-line-blues [let subsidy poverty-reduction-blues * (poverty-line-blues - energy)
                                  set energy (energy + subsidy)
                                  set government-budget-blues (government-budget-blues - subsidy - 1)]
end
   
to do-shock
  let probability-of-shock random-float 1
  let population-striken random 4
  if population-striken = 0[if  probability-of-shock < 0.05 and probability-of-shock > 0.001 
                                [ask n-of ((count turtles) * random-float 0.1) turtles [die]]
                            if  probability-of-shock < 0.001 
                                [ask n-of ((count turtles) * random-float 0.4) turtles [die]]]
  if population-striken = 1[if  probability-of-shock < 0.05 and probability-of-shock > 0.001 
                                [ask n-of ((count turtles with [age < 50]) * random-float 0.1) turtles with [age < 50] [die]]
                            if  probability-of-shock < 0.001 
                                [ask n-of ((count turtles with [age < 50]) * random-float 0.4) turtles with [age < 50] [die]]]
  if population-striken = 2[if  probability-of-shock < 0.05 and probability-of-shock > 0.001 
                                [ask n-of ((count turtles with [age >= 50 and age <= 150]) * random-float 0.1) turtles with [age >= 50 and age <= 150][die]]
                            if  probability-of-shock < 0.001 
                                [ask n-of ((count turtles with [age >= 50 and age <= 150]) * random-float 0.4) turtles with [age >= 50 and age <= 150][die]]]
  if population-striken = 3[if  probability-of-shock < 0.05 and probability-of-shock > 0.001 
                                [ask n-of ((count turtles with [age > 150]) * random-float 0.1) turtles with [age > 150] [die]]
                            if  probability-of-shock < 0.001 
                                [ask n-of ((count turtles with [age > 150]) * random-float 0.4) turtles with[age > 150] [die]]]
end
     
to do-plots
  set-current-plot "Totals"
  set-current-plot-pen "red-citizens"
  plot count red-turtles
  set-current-plot-pen "blue-citizens"
  plot count blue-turtles
  set-current-plot-pen "resources"
  plot (count patches with [pcolor = green])
  set-current-plot-pen "red-poor"
  plot count red-turtles with [energy < poverty-line-reds]
  set-current-plot-pen "blue-poor"
  plot count blue-turtles with [energy < poverty-line-blues]
  
  set-current-plot "Population composition reds"
  set-current-plot-pen "young"
  plot ((count red-turtles with [age < (30 + round(life-expectancy-reds / 10))]) / count red-turtles)
  set-current-plot-pen "old"
  plot ((count red-turtles with [age > (150 + round(life-expectancy-reds / 20))]) / count red-turtles)
  set-current-plot-pen "adult"
  plot ((count red-turtles with [age >= (30 + round(life-expectancy-reds / 10)) and 
                                 age <= (150 + round(life-expectancy-reds / 20))]) / count red-turtles)
  
  set-current-plot "Population composition blues"
  set-current-plot-pen "young"
  plot ((count blue-turtles with [age < (30 + round(life-expectancy-blues / 10))]) / count blue-turtles)
  set-current-plot-pen "old"
  plot ((count blue-turtles with [age > (150 + round(life-expectancy-blues / 20))]) / count blue-turtles)
  set-current-plot-pen "adult"
  plot ((count blue-turtles with [age >= (30 + round(life-expectancy-blues / 10)) and 
                                  age <= (150 + round(life-expectancy-blues / 20))]) / count blue-turtles)
end

; Copyright 2011 Dario Sansone. All rights reserved.
; Supervisor: Pietro Terna, Faculty of Economics, University of Turin