Dario Galluccio Francesco Gianotti

Simulation models for economics

Project work on

"Microcredit in a district."

 

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: microcredit_in_a_district.nlogo

WHAT IS IT?

Our model is an attempt of simulating the activity of a microcredit institution in a little economy. The microcredit represent a way of getting a loan for those persons who are in a difficult economic situation. The loan allows them to start a new little activity that can get them out poverty.
Our model represents an industrialized district (for the data we have looked to Ivrea which is a little city in the north of Italy). Consequently the microcredit loans are bigger than the usual microcredit loans in the third world and are given to those persons who don’t have very high guarantees and can’t get a loan from a traditional bank.
Our aim is to monitor the benefits that the institution could give to the environment, even during crisis periods.


HOW IT WORKS

The bank in the model is represented by the orange house, while the microcredit institution is the yellow house. Peoples are placed in the space on the basis of their breed, we have the managers on the top, then the workers (divided in middle managers and normal workers) and, on the bottom the poor. If a manager get a loan (from the bank) he becomes an entrepreneurs (with white color until he is a borrower and purple when he has finished to repay his debt) and he moves in a topper place in the space. Contemporaneously he hired some poor (if there are any) who become recruits with orange color and move in a topper place.
The same thing happens when a lower class worker get a loan from the microcredit institution. In this case the worker becomes a small entrepreneurs (s_entrepreneur) and he can hires one (or zero, it depends on the relative switch) poor who become a yellow recruits.
Both borrowers own a certain percentage (lower for the small entrepreneurs) of not being able to repay their debt.
We can also monitor the environment in the case of a financial crisis which brings negative income to the agents.


HOW TO USE IT

Start the simulation by clicking the button “setup”. After clicking “go” the turtles start interacting in the way explained above. They keep on doing so until the button “go” is clicked again. If you want to see what happens in one single click you can press “step” instead of “go”.

Button: setup
It cleans the environment by resetting everything to the initial values.

Button: go
It runs the model until you press it again.

Button: step
It runs the model for one cycle.

Button: crisis
It introduce the financial crisis in the environment.

Button: stop_crisis
It ends the crisis period.

Switch: microcredit
The microcredit is active only if it is “on”.

Sliders: n_managers – n_workers – n_poors
By moving this sliders you can choose the percentage of poor people in the environment.

Sliders: n_hired_by_entrepreneurs – n_hired_by_s_entrepreneurs.
You can choose the number of poor who can be hired respectively by the entrepreneur (between 1 and 5) and by the small entrepreneur (0 or 1).

Sliders: n_installments_bank_loan – n_installments_microcredit_loan
You can choose the number of installments respectively for the bank loan and the microcredit loan.

Sliders: bank_interest_rate – microcredit_interest_rate
You can change the interest rate for both the kind of loans.

Sliders: percentage_m – percentage_w
They represent the probability of obtaining a loan at each tick for the managers and the workers.

Monitors: poor – managers – workers – middle_managments
They reports the number of agents who own those breeds in the environment.

Monitors: recruits_by_entrepreneurs – recruits_s_entrepreneurs
They display the number of agent hired by the entrepreneurs and by the small entrepreneurs.

Monitors: entrepreneurs – s_entrepreneurs
They shows the number of entrepreneurs and of small entrepreneurs.

Monitor: recruits_fired
It reports the number of poor who got a job and then loose it.

Monitors: entrepreneurs_failed – s_entrepreneurs_failed
They display the number of entrepreneurs who are failed but are not completely poor (indeed they have brown color and they are placed a little bit topper than the normal poor).

Monitor: poors_dead
It reports the number of poor who aren’t able to get out from their situation for a long period, and so they are no more active in the model.

Plot: Total wealth
It shows the wealth of those agents who are involved in the new enterprises.

Plot: failure
It shows the entrepreneurs and small entrepreneurs who are failed in the period in which we run the model.

Plot: poors_population
It shows the variation in the number of poor during the period.


THINGS TO NOTICE

It’s interesting to look at the differences in the “poor_population” plot when the microcredit is either on or off. It’s easy to see that it is steeper when the microcredit is active.It is the easiest way to understand the importance that this institution can have in defeating the unemployment rate.


THINGS TO TRY

It is interesting to see what happens when there is a crisis of a certain amount of year in the model, and you can notice the difference in the environment between the case with the microcredit active and the case without it.
Moreover it’s interesting to change the percentage of poor.


RELATED MODELS

Microcredit: a Micro Way for a Macro Challenge.


CREDITS AND REFERENCES

www.comune.ivrea.to.it
www.bancaditalia.it
www.pie.camcom.it
www.odmconsulting.com


PROCEDURES

globals [f_crisis?]

breed [managers manager]
breed [workers worker]
breed [poors poor]
breed [bank]
breed [microcredit_bank]
breed [entrepreneurs entrepreneur]
breed [s_entrepreneurs s_entrepreneur]
breed [recruits recruit]

managers-own
[wealth
   job?
   net_income
   borrower?
]

workers-own
[wealth
   job?
   net_income
   borrower?
]

poors-own
[wealth
  job?
  net_income
  pay?
  fire?
]

bank-own
[capital
  liquidity?
]

microcredit_bank-own
[capital
  liquidity?
]

entrepreneurs-own
[job?
  wealth
  borrower?
  stop_hiring?
  repayments
  pay?
  fire?
]

s_entrepreneurs-own
[ job?
  wealth
  borrower?
  stop_hiring?
  repayments
  pay?
  fire?
  ]

recruits-own
[wealth
  job?
]


;################################################################### SETUP ###################################################################


to setup
  ca
  setup-turtles
  set f_crisis? false
end

to setup-turtles
  create-bank 1                                                                          
   ask bank 
      [setxy 1 1
       set shape "house"
       set color orange
       set size 3
       set capital 1500000
       ]
  create-microcredit_bank 1
   ask microcredit_bank
      [setxy 49 1
       set shape "house"
       set color yellow
       set size 3
       set capital 50000
       ]
  create-managers n_managers
   ask managers
      [setxy random-pxcor 43
       set shape "person"
       set color green
       set wealth (5200 + random 520)
       set job? true
       set borrower? false
       ]
  create-workers n_workers
   ask workers 
      [set shape "person"
       set job? true
       set borrower? false
       ifelse random 100 < 66 [
        set wealth (1600 + random 160)
        set color cyan
        setxy random-pxcor 25]
       [set wealth (2900 + random 290)
        set color blue
        setxy random-pxcor 31]
       ]
  create-poors n_poors
   ask poors
      [setxy random-pxcor 7
       set shape "person"
       set color red
       set wealth (1000 + random 200)
       set job? false
       ]
end     


;################################################################### GO ###################################################################

  
to go
  tick
  earn
  ask managers [income]
  ask workers [income]
  ask poors [income]
  borrow
  microcredit
  produce
  hire 
  pay
  fire 
  probability_to_pay
  repay_micro
  repay_bank
  stop_repay_micro
  stop_repay_bank
  change_status
  stop_loan
  dead
  do_plots
end  

to earn
  if f_crisis? = false [
   ask managers [
      set net_income (3000 + random 500)]
   ask workers [
      ifelse color = cyan [
       set net_income (800 - random 850)]
      [set net_income (1400 + random 400)]]
   ask poors [
      set net_income (0 - random 10)]
   ]
  
end

to income
  set wealth (wealth + net_income - (net_income / 2))
end


;################################################################### BORROW ###################################################################


to borrow
  if f_crisis? = false[
  ask bank [if liquidity? = true and count managers > 0
    [ask one-of managers [
        if random 100.0 < percentage_m and borrower? = false
        [ set wealth (wealth + 250000)
          set borrower? true
          set color white
          set breed entrepreneurs
          set shape "person"
          setxy random-pxcor 49
          set stop_hiring? false
          set fire? false
          set pay? true
          ask bank [
          set capital (capital - 250000)]
         ]]]]
   ]
end


;################################################################### MICROCREDIT ###################################################################


to microcredit
  if f_crisis? = false [
    if activate_microcrocredit[
  ask microcredit_bank [if liquidity? = true and count workers > 0 
    [ask one-of workers [
        if random 100 < percentage_w and borrower? = false and color = cyan
        [ set wealth (wealth + 2500)
          set borrower? true
          set color white
          set breed s_entrepreneurs
          set shape "person"
          setxy random-pxcor 37
          set stop_hiring? false
          set fire? false
          set pay? true
          ask microcredit_bank [
          set capital (capital - 2500)
          ]
         ]]]]]]
end


;################################################################### PRODUCE ###################################################################


to produce
  ifelse f_crisis? = false[
  ask entrepreneurs [
     set wealth (wealth + random 8000)]
  ask s_entrepreneurs [
     set wealth (wealth + random 2500)]]
  [ask entrepreneurs [
     set wealth (wealth - random 3000)]
  ask s_entrepreneurs [
     set wealth (wealth - random 500)]]
end


;################################################################### HIRE ###################################################################


to hire
  ask entrepreneurs [
    if f_crisis? = false and stop_hiring? = false [if (count poors > n_hired_by_entrepreneurs)
       [employ_m] 
     ]]
  ask s_entrepreneurs [
    if f_crisis? = false and stop_hiring? = false [if (count poors > n_hired_by_s_entrepreneurs)
       [employ_w] 
     ]]
end

to employ_m
  if count poors with [shape = "person"] > n_hired_by_entrepreneurs[
  let hired 0
  set hired n-of n_hired_by_entrepreneurs poors with [shape = "person"]
  if hired != nobody [
    ask hired [      
      set job? true
      set breed recruits
      set shape "person"
      set color orange
      setxy random-pxcor 19
    ]]
    ask entrepreneurs [
      set stop_hiring? true]]
end

to employ_w
  if count poors with [shape = "person"] > n_hired_by_s_entrepreneurs[
  let hired 0
  set hired n-of n_hired_by_s_entrepreneurs poors with [shape = "person"]
  if hired != nobody [
    ask hired [      
      set job? true
      set breed recruits
      set shape "person"
      set color yellow
      setxy random-pxcor 13
    ]]
    ask s_entrepreneurs [
      set stop_hiring? true]]
end 
  
to pay
  if (count recruits with [color = orange] > 0) [
    ask entrepreneurs [
      set wealth (wealth - 1300 * n_hired_by_entrepreneurs)]
    ask recruits with [color = orange] [
      ifelse job? = true [
      set wealth (wealth + 650 - random 700 - ((650 - random 700) / 2))]
      [set wealth (wealth - random 200)]]            
      ]
if (count recruits with [color = yellow] > 0) [
   ask s_entrepreneurs [
     set wealth (wealth - 1000 * n_hired_by_s_entrepreneurs)]
   ask recruits with [color = yellow] [
      ifelse job? = true [
     set wealth (wealth + 500 - random 550 - ((500 - random 550) / 2))]
      [set wealth (wealth - random 150)]
        ]
  ]  
end  
  

;################################################################### FIRE ###################################################################

    
to fire
  if count recruits with [color = yellow] > 0[
  ask s_entrepreneurs with [fire? = false] [
    if wealth <= ((2500 + (microcredit_interest_rate * 2500)) * 2)
    [set wealth (wealth + 1000 * n_hired_by_s_entrepreneurs)      
     set fire? true
     ask n-of n_hired_by_s_entrepreneurs recruits with [color = yellow] [
      set job? false]]]]
  if count recruits with [color = yellow] > 0 [
  ask poors with [color = brown + 1 and fire? = false and pay? = false]
    [set wealth (wealth + 1000 * n_hired_by_s_entrepreneurs)      
     set fire? true
     ask n-of n_hired_by_s_entrepreneurs recruits with [color = yellow] [
      set job? false]]]
  if count recruits with [color = orange] > 0[
  ask entrepreneurs with [fire? = false] [
    if wealth <= ((250000 + (bank_interest_rate * 250000)) * 2 / 3)
    [set wealth (wealth + 1300 * n_hired_by_entrepreneurs) 
     set fire? true
     ask n-of n_hired_by_entrepreneurs recruits with [color = orange] [
      set job? false]]]]
  if count recruits with [color = orange] > 0 [
  ask poors with [color = brown - 1 and fire? = false and pay? = false]
    [set wealth (wealth + 1300 * n_hired_by_entrepreneurs)      
     set fire? true
     ask n-of n_hired_by_entrepreneurs recruits with [color = orange] [
      set job? false]]]
end
    
      
;################################################################### REPAY ###################################################################


to probability_to_pay
  if count entrepreneurs > 0[
  ask one-of entrepreneurs[
    if borrower? = true and random 1000 < 8
    [set pay? false]]]
  if count s_entrepreneurs > 0[
  ask one-of s_entrepreneurs[
    if borrower? = true and random 1000 < 5
    [set pay? false]]]
  end

to repay_micro
  ask s_entrepreneurs [
  if borrower? = true and pay? = true [
  set wealth (wealth - ((2500 / n_installments_microcredit_loan) + (microcredit_interest_rate / n_installments_microcredit_loan) * 2500))
  set repayments (repayments + ((2500 / n_installments_microcredit_loan) + (microcredit_interest_rate / n_installments_microcredit_loan) * 2500))
  ask microcredit_bank [
  set capital (capital + ((2500 / n_installments_microcredit_loan) + (microcredit_interest_rate / n_installments_microcredit_loan) * 2500))]]]
end

to repay_bank
ask entrepreneurs [
  if borrower? = true and pay? = true [
  set wealth (wealth - ((250000 / n_installments_bank_loan) + (bank_interest_rate / n_installments_bank_loan) * 250000))
  set repayments (repayments + ((250000 / n_installments_bank_loan) + (bank_interest_rate / n_installments_bank_loan) * 250000))
  ask bank 
  [set capital (capital + ((250000 / n_installments_bank_loan) + (bank_interest_rate / n_installments_bank_loan) * 250000))]]]
end 

to stop_repay_micro
  let c 2500 + (microcredit_interest_rate * 2500)
  ask s_entrepreneurs[
    if borrower? = true and repayments >= c and wealth >= ( c - repayments)  [
      set borrower? false
      set color gray
      set repayments 0
      stop (repay_micro)]]
end

to stop_repay_bank
  let c 250000 + (bank_interest_rate * 250000)
  ask entrepreneurs[
    if borrower? = true and repayments >= c and wealth >= ( c - repayments) [
      set borrower? false
      set color violet
      set repayments 0
      stop (repay_bank)]]
end


;################################################################### CRISIS ###################################################################


to crisis
    set f_crisis? true
    if f_crisis? = true[
    ask managers[
      set net_income random -1000]
    ask workers [ ifelse color = cyan [
      set net_income random -250]
    [set net_income random -450]]
    ]
end

to stop_crisis
  set f_crisis? false
end  


;################################################################### CHANGE-STATUS ###################################################################


to change_status
   ask poors [ if (wealth > 1300) and color = red[
    set breed workers
    set shape "person"                          
    setxy random-pxcor 25                                                       
    set color cyan
    set net_income (800 - random 850)]]  
   ask one-of workers[if random 100 < 10 and color = blue and wealth >= 100000 [
    set breed managers
    set shape "person"
    set color green
    setxy random-pxcor 43
    set net_income (3000 + random 500)]]                                                         
   ask workers [if (wealth < 1300)[
    set breed poors
    set shape "person"
    setxy random-pxcor 7
    set color red
    set net_income (0 - random 10)
    set job? false]]
  ask managers [ if (wealth < 1300)[
    set breed poors
    set shape "person"
    setxy random-pxcor 7
    set color red
    set net_income (0 - random 10)
    set job? false]]
  ask s_entrepreneurs [ if (wealth < 1300)[
    set breed poors
    set shape "person"
    setxy random-pxcor 10
    set color gray + 2
    set net_income (0 - random 10)
    set job? false]]
  ask s_entrepreneurs [ if pay? = false[
    set breed poors
    set shape "person"
    setxy random-pxcor 10
    set color brown + 1
    set net_income (0 - random 10)
    set job? false]]
  ask entrepreneurs [ if (wealth < 1300)[
    set breed poors
    set shape "person"
    setxy random-pxcor 10
    set color violet + 2
    set net_income (0 - random 10)
    set job? false]]
  ask entrepreneurs [ if pay? = false[
    set breed poors
    set shape "person"    
    setxy random-pxcor 10
    set color brown - 1
    set net_income (0 - random 10)
    set job? false]]    
  ask recruits[
    if  job? = false [                      
    set breed poors
    set shape "person"
    setxy random-pxcor 9
    set color red + 2
    set net_income (0 - random 10)]]
end


;################################################################### STOP-LOAN ###################################################################


to stop_loan
  ask bank [ ifelse capital > 250000
    [set liquidity? true]
    [set liquidity? false]]
  ask microcredit_bank [ifelse capital > 0
    [set liquidity? true]
    [set liquidity? false]]
end
    
    
;################################################################### DEAD ###################################################################


to dead
ask poors with [wealth <= 0][
set shape "x"
setxy 0 4]
end    
     
         
;################################################################### PLOTS ###################################################################


to do_plots
  set-current-plot "failure"
  set-current-plot-pen "entrepreneurs_failed"
  plot count poors with [color = brown - 1]
  set-current-plot-pen "s_entrepreneurs_failed"
  plot count poors with [color = brown + 1]
  set-current-plot-pen "entrepreneurs_failed_by_crisis"
  plot count poors with [color = violet + 2]
  set-current-plot-pen "s_entrepreneurs_failed_by_crisis"
  plot count poors with [color = gray + 2]
 
  set-current-plot "Total Wealth"
  set-current-plot-pen "recruits"
  plot sum [wealth] of recruits with [color = orange]
  set-current-plot-pen "s_recruits"
  plot sum [wealth] of recruits with [color = yellow]
  set-current-plot-pen "entrepreneurs"
  plot sum [wealth] of entrepreneurs
  set-current-plot-pen "s_entrepreneurs"
  plot sum [wealth] of s_entrepreneurs
  
  
  set-current-plot "poors_population"
  set-current-plot-pen "poors"
  plot count poors
end