Simple Economy Updated
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
ACKNOWLEDGMENT
This model is from Chapter Two of the book "Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo", by Uri Wilensky & William Rand.
- Wilensky, U. & Rand, W. (2015). Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo. Cambridge, MA. MIT Press.
This model is in the IABM Textbook folder of the NetLogo Models Library. The model, as well as any updates to the model, can also be found on the textbook website: http://www.intro-to-abm.com/.
WHAT IS IT?
This model is a very simple model of economic exchange. It is a thought experiment of a world where, in every time step, each person gives one dollar to one other person (at random) if they have any money to give. If they have no money then they do not give out any money.
HOW IT WORKS
The SETUP for the model creates 500 agents, and then gives them each 100 dollars. At each tick, they give one dollar to another agent if they can. If they have no money then they do nothing. Each agent also moves to an x-coordinate equal to its wealth.
HOW TO USE IT
Press SETUP to setup the model, then press GO to watch the model develop.
THINGS TO NOTICE
Examine the various graphs and see how the model unfolds. Let it run for many ticks. The WEALTH DISTRIBUTION graph will change shape dramatically as time goes on. What happens to the WEALTH BY PERCENT graph over time?
THINGS TO TRY
Try running the model for many thousands of ticks. Does the distribution stabilize? How can you measure stabilization? Keep track of some individual agents. How do they move?
EXTENDING THE MODEL
Change the number of turtles. Does this affect the results?
Change the rules so agents can go into debt. Does this affect the results?
Change the basic transaction rule of the model. What happens if the turtles exchange more than one dollar? How about if they give a random amount to another agent at each tick? Change the rules so that the richer agents have a better chance of being given money? Or a smaller chance? How does this change the results?
NETLOGO FEATURES
NetLogo plots have an auto scaling feature that allows a plot's x range and y range to grow automatically, but not to shrink. We do, however, want the y range of the WEALTH DISTRIBUTION histogram to shrink since we start with all 500 turtles having the same wealth (producing a single high bar in the histogram), but the distribution of wealth eventually flattens to a point where no particular bin has more than 40 turtles in it.
To get NetLogo to correctly adjust the histogram's y range, we use set-plot-y-range 0 40
in the histogram's pen update commands and let auto scaling set the maximum higher if needed.
RELATED MODELS
Wealth Distribution.
CREDITS AND REFERENCES
Models of this kind are described in:
- Dragulescu, A. & V.M. Yakovenko, V.M. (2000). Statistical Mechanics of Money. European Physics Journal B.
HOW TO CITE
This model is part of the textbook, “Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo.”
If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.
For the model itself:
- Wilensky, U. (2011). NetLogo Simple Economy model. http://ccl.northwestern.edu/netlogo/models/SimpleEconomy. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
Please cite the NetLogo software as:
- Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.
Please cite the textbook as:
- Wilensky, U. & Rand, W. (2015). Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo. Cambridge, MA. MIT Press.
COPYRIGHT AND LICENSE
Copyright 2011 Uri Wilensky.
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.
Comments and Questions
;; Modified and detailed commented by 深度碎片 ;; originally written by Uri Wilensky ;; Background of this model, quotes from Wilensky's book at https://github.com/EmbraceLife/shendusuipian/issues/51 ;; concept for analyzing this model at https://github.com/EmbraceLife/shendusuipian/issues/53 ;; updated model at https://github.com/EmbraceLife/NetLogo-Modeling/tree/master/finished%20models ;; What are the basic rules created such exponential inequality? ;; rules ;; 1. total wealth stays the same; ;; rules ;; 2. the population stays the same; ;; rules ;; 3. each agent has the same initial wealth; ;; rules ;; 4. each iteration, for any one of the agents gives away 1 dollar, and one other agent receives one dollar ;; insights ;; a great example of making assumptions to build a simple model ;; globals, properties, classes globals [ top-20pct ;; top 20% agents in wealth bottom-20pct ;; bottom 20% agents in wealth ] turtles-own [ wealth ;; wealth as new property to agent ] to setup ;; build the world clear-all ;; wipe out everything create-turtles 500 [ ;; create 500 agents, ask each to do the following set wealth 100 ;; has wealth of 100 set color green ;; color itself green set shape "circle" ;; make itself circle-like set size 2 ;; make itself twice big setxy wealth random-ycor ;; put itself horizontally based on wealth and vertically with random ] reset-ticks ;; set clock to 0 end to go ;; running the world ask turtles with [ wealth > 0 ] [ ;; ask all agents with positive wealth to do transact ;; transact money to each other ] ask turtles [ ;; ask all agents ifelse wealth <= max-pxcor ;; if wealth is not over the board (set board long enough ) [ set xcor wealth ] ;; stay horizontally where its wealth is [ set xcor max-pxcor set size 1.5 ] ;; otherwise, stay horizontal at the border edge and make self twice big ] plot-wealth-gap ;; plot the wealth gap between the top 20% vs the bottom 80% plot-wealth-distribution ;; plot wealth distribution of the population if track? [ ;; click on track to execute once set top-20pct max-n-of (count turtles * 0.2) turtles [wealth] ;; get the top 20% agents at this moment ask top-20pct [ set color red set size 3 ;; ask them to be red and triple in size ] set bottom-20pct min-n-of ( count turtles * 0.2 ) turtles [wealth] ;; get the bottom 20% agent at this same moment ask bottom-20pct [ set color blue set size 3 ;; ask them to be red and triple in size ] set track? false ;; make sure track only happen once ] if top-20pct != 0 and any? top-20pct [ ;; if top-20pct agents do exist ( not 0 not empty ) let top-20-now max-n-of (count turtles * 0.2) turtles [wealth] ;; get current top-20pct agents in wealth let min-top-20 min [wealth] of top-20-now ;; get the minimum wealth value of the current top-20pct agents let num-reach-top-20 count top-20pct with [wealth > min-top-20] ;; count the number of agents of top-20pct who belong to current top-20pct let pct-reach-top-20 num-reach-top-20 / count top-20pct * 100 ;; calc its ratio of original top-20pct let top-40-now max-n-of (count turtles * 0.4) turtles [wealth] let min-top-40 min [wealth] of top-40-now let num-reach-top-40 count top-20pct with [wealth > min-top-40] let pct-reach-top-40 num-reach-top-40 / count top-20pct * 100 ;; calc the ratio of original top-20pct which belong to current top-40pct let top-50-now max-n-of (count turtles * 0.5) turtles [wealth] let min-top-50 min [wealth] of top-50-now let num-reach-top-50 count top-20pct with [wealth > min-top-50] let pct-reach-top-50 num-reach-top-50 / count top-20pct * 100 ;; calc the ratio of original top-20pct which belong to current top-50pct plot-top20pct-stability pct-reach-top-20 pct-reach-top-40 pct-reach-top-50 ;; plot the three ratios above ] if bottom-20pct != 0 and any? bottom-20pct [ ;; if bottom-20pct agents do exist (not 0 not empty) let bottom-20-now min-n-of (count turtles * 0.2) turtles [wealth] ;; get current bottom 20pct agents in wealth let max-bottom-20 max [wealth] of bottom-20-now ;; get the maximum wealth value of the current bottom 20pct agent let num-above-bottom-20 count bottom-20pct with [wealth > max-bottom-20] ;; count the number of agents in original bottom 20pct go above current bottom 20pct let pct-above-bottom-20 num-above-bottom-20 / count bottom-20pct * 100 ;; calc the ratio of original bottom-20pct let bottom-40-now min-n-of (count turtles * 0.4) turtles [wealth] let max-bottom-40 max [wealth] of bottom-40-now let num-above-bottom-40 count bottom-20pct with [wealth > max-bottom-40] let pct-above-bottom-40 num-above-bottom-40 / count bottom-20pct * 100 ;; calc the ratio of original bottom-20pct which stay above to current bottom-40pct let bottom-50-now min-n-of (count turtles * 0.5) turtles [wealth] let max-bottom-50 max [wealth] of bottom-50-now let num-above-bottom-50 count bottom-20pct with [wealth > max-bottom-50] let pct-above-bottom-50 num-above-bottom-50 / count bottom-20pct * 100 ;; calc the ratio of original bottom-20pct which stay above to current bottom-50pct plot-bottom20pct-stability pct-above-bottom-20 pct-above-bottom-40 pct-above-bottom-50 ;; plot the three ratios above ] tick end to transact ;; transact wealth set wealth wealth - 1 ;; give away 1 unit of wealth ask one-of other turtles [ set wealth wealth + 1 ] ;; another agent receive 1 unit of wealth end to-report top-20-pct-wealth ;; report wealth sum of top 20pct agent to `top-20-pct-wealth` report sum [ wealth ] of max-n-of (count turtles * 0.2) turtles [ wealth ] end to-report bottom-80-pct-wealth ;; report wealth sum of bottom 80pct agent to `bottom-80-pct-wealth` report sum [ wealth ] of min-n-of (count turtles * 0.8) turtles [ wealth ] end to plot-wealth-gap set-current-plot "wealth gap" set-current-plot-pen "top 20%" plot top-20-pct-wealth set-current-plot-pen "bottom 80%" plot bottom-80-pct-wealth end to plot-wealth-distribution set-current-plot "wealth distribution" set-plot-y-range 0 40 set-current-plot-pen "dist" histogram [ wealth ] of turtles end to plot-top20pct-stability [ top20 top40 top50 ] set-current-plot "top-20pct-stability" set-current-plot-pen "stay top 20" plot top20 set-current-plot-pen "stay top 40" plot top40 set-current-plot-pen "stay top 50" plot top50 end to plot-bottom20pct-stability [ bottom20 bottom40 bottom50 ] set-current-plot "bottom-20pct-stability" set-current-plot-pen "above bottom 20" plot bottom20 set-current-plot-pen "above bottom 40" plot bottom40 set-current-plot-pen "above bottom 50" plot bottom50 end
There is only one version of this model, created almost 7 years ago by 深度碎片 Kenny.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Simple Economy Updated.png | preview | Preview for 'Simple Economy Updated' | almost 7 years ago, by 深度碎片 Kenny | Download |
This model does not have any ancestors.
This model does not have any descendants.