Simple Economy by Quintile
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This model explores how wealth inequality can emerge purely by chance in a simple economy. In this model, agents start with an equal amount of wealth and repeatedly exchange wealth randomly with one another. No agent has any advantage, and all exchanges are fair and random.
Over time, despite the randomness, a clear pattern emerges: some agents become much richer while others become poorer, illustrating how inequality can arise even in a system without inherent differences in ability or opportunity.
To help visualize this, the agents are divided into five wealth quintiles, each represented by a different color. The model shows:
- The agents’ current wealth, colored by quintile.
- The distribution of wealth over time.
- Total wealth of top 10% vs bottom 50% overtime.
- The Lorenz curve to show the wealth inequality.
- The Gini index overtime
- Total wealth of each quintile.
- Median wealth of all agents.
- Avegare and median wealth of middle class.
This setup allows you to see not only how wealth becomes unevenly distributed but also how different segments of the population (quintiles) experience this process. The model demonstrates a key concept in economics: random interactions alone can generate significant inequality.
HOW IT WORKS
The model simulates wealth exchange among agents using a simple random process. Each tick, every agent:
- Chooses another agent at random.
- Transfers a fixed amount of wealth to that agent. The parameter in the model is this transaction-amount, which controls how much wealth is exchanged in each interaction.
Agents continue exchanging wealth in this way over time. Because exchanges are completely random, no agent has an inherent advantage. Despite this, wealth inequality naturally emerges, with some agents accumulating more wealth while others become poorer.
To visualize the process:
- Agents are colored according to wealth quintiles (five groups based on current wealth).
- Plots show the distribution of wealth for each quintile, allowing you to observe how different segments of the population change over time.
This simple setup demonstrates that even random, fair transactions can produce significant inequality in a population.
HOW TO USE IT
Set the transaction-amount using the slider. This controls how much wealth is exchanged in each interaction. Larger amounts make wealth shift faster, while smaller amounts slow down the process.
Use the debt? switch to decide whether agents can go into debt. When this switch is off, agents cannot have negative wealth, and transactions that would result in debt do not occur. When it is on, agents are allowed to go into debt, with the maximum debt determined by the debt-limit setting.
Click the Setup button to create the agents. All agents start with equal wealth and are divided into five quintiles, each represented by a different color.
Click the Go button to start the simulation. Agents will randomly give wealth to one another each tick, allowing you to observe how wealth becomes unevenly distributed over time.
The plot shows relevant information about the wealth distribution. Watch how the colors of the agents and the plots evolve as inequality emerges.
You can experiment by changing the transaction-amount, toggling the debt? switch, or adjusting the debt-limit (which only takes effect when debt? is on), then restarting the model to see how these settings affect the speed and extent of wealth inequality.
THINGS TO NOTICE
Even though all agents start with the same wealth and exchange money randomly, inequality quickly appears.
Some agents accumulate large amounts of wealth, while others lose most or all of theirs. The overall amount of wealth in the system stays constant, but its distribution becomes increasingly uneven over time.
The plot shows how the richest group gains a larger share while the poorer groups lose theirs. The positions of agents on the screen may not change, but their colors shift as they move between wealth quintiles.
In the world view, a vertical line represents zero wealth. Agents positioned to the left of this line are in debt, while those to the right have positive wealth. The process is entirely random, yet the outcome consistently leads to unequal wealth distribution.
THINGS TO TRY
Change the transaction-amount to see how it affects the speed at which inequality emerges.
Try very small transaction amounts and observe whether inequality still appears, but more slowly.
Try very large transaction amounts and notice how quickly wealth becomes concentrated in a few agents.
Stop the simulation at different times to observe how the colors of agents change as they move between wealth quintiles.
Restart the model several times with the same settings to see if the overall pattern of inequality is similar each time.
Watch the wealth distribution plot to see whether the shape of the distribution stabilizes or continues to change over time.
Use the debt? switch to decide whether agents can go into debt. When this switch is off, agents cannot have negative wealth, and transactions that would result in debt do not occur. When it is on, agents are allowed to go into debt, and the debt-limit slider can be used to control the maximum debt an agent can take on. By default, the limit is –50, which is half of the initial wealth, but users can adjust it to explore how different debt limits affect the simulation.
EXTENDING THE MODEL
- Introduce a saving behavior where agents keep a fraction of their wealth before making transactions.
- Add a tax or redistribution mechanism to explore how policy interventions affect inequality.
- Give agents different probabilities of being selected for transactions to represent unequal opportunities.
- Introduce income or production so that new wealth enters the system over time.
- Explore what happens when the number of agents changes or when agents interact only with others in the same or similar social class instead of randomly.
NETLOGO FEATURES
The model relies on core NetLogo functionality, including agents, random interactions, and plots.
No advanced NetLogo features or extensions are required.
RELATED MODELS
- Wilensky, U. & Rand, W. (2015). Simple Economy. Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo. Cambridge, MA. MIT Press.
- Snare, Carl (2019). New Simple Economy 2.0.1, https://blog.modelingcommons.org/browse/one_model/5988#model_tabs_browse_info
See the CREDITS AND REFERENCES section for details.
CREDITS AND REFERENCES
This model is a modification of the textbook model “Simple Economy.” I also drew inspiration from the model “New Simple Economy 2.0.1” created by Carl Snare.
The “Simple Economy” 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 and William Rand. The model is located in the IABM Textbook folder of the NetLogo Models Library. The model, as well as any updates, can also be found on the textbook website: http://www.intro-to-abm.com/
- Wilensky, U. & Rand, W. (2015). Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo. Cambridge, MA. MIT Press.
- Snare, Carl (2019). New Simple Economy 2.0.1, https://blog.modelingcommons.org/browse/one_model/5988#model_tabs_browse_info
- "Gini coefficient." Wikipedia: The Free Encyclopedia. Wikimedia Foundation, https://en.wikipedia.org/wiki/Gini_coefficient
- "Middle class." Wikipedia: The Free Encyclopedia. Wikimedia Foundation, https://en.wikipedia.org/wiki/Middle_class
Comments and Questions
globals [ gini-index lorenz-points NUMBER-OF-TURTLES INITIAL-WEALTH ] turtles-own [ wealth quintile ] to setup clear-all set NUMBER-OF-TURTLES 1000 set INITIAL-WEALTH 100 create-turtles NUMBER-OF-TURTLES [ set wealth INITIAL-WEALTH set shape "circle" set color lime set size 3 setxy wealth random-ycor ; all agents have same initial wealth ] ;; draw verticial line for wealth = 0 position ask patches with [pxcor = 0 ] [ set pcolor white ] update-quintiles update-lorenz-and-gini reset-ticks end to go ;; allow only agent with enough wealth to transact ifelse debt? [ask turtles [if wealth >= debt-limit + transaction-amount [ transact ] ]] [ask turtles [if wealth >= transaction-amount [ transact ] ]] ;; prevent wealthy turtles from moving too far to the right ask turtles [ ifelse wealth <= max-pxcor [ set xcor wealth ] [ set xcor max-pxcor]] ; xcor can't exceed max-pxcor update-quintiles recolor-turtles update-lorenz-and-gini tick end to transact ;; give transaction-amount to another turtle set wealth wealth - transaction-amount ask one-of other turtles [ set wealth wealth + transaction-amount ] end to update-lorenz-and-gini ;; this procedure calculate Lorenzo point and gini index ;; initialize variables before computing Lorenz curve and Gini let sorted-wealths sort [wealth] of turtles let total-wealths sum sorted-wealths let wealth-sum-so-far 0 let gini-index-calc 0 let index 0 set gini-index 0 set lorenz-points [] ;; now actually plot the Lorenz curve and the gini index repeat NUMBER-OF-TURTLES [ set wealth-sum-so-far (wealth-sum-so-far + item index sorted-wealths) set lorenz-points lput ((wealth-sum-so-far / total-wealths) * 100) lorenz-points set gini-index-calc (gini-index-calc + (index + 1) * (item index sorted-wealths)) set index (index + 1) ; counts the number of agents in this loop ] set gini-index (2 * gini-index-calc / NUMBER-OF-TURTLES / total-wealths - (NUMBER-OF-TURTLES + 1) / NUMBER-OF-TURTLES) end to update-quintiles let turtles-order-by-wealth sort-on [wealth] turtles ;; sort wealth ascending let index 0 repeat NUMBER-OF-TURTLES [ let t (item index turtles-order-by-wealth) ask t [set quintile ceiling ((index + 1) * 5 / NUMBER-OF-TURTLES)] set index (index + 1) ] end to recolor-turtles ask turtles [ (ifelse quintile = 1 [set color yellow + 1] quintile = 2 [set color violet] quintile = 3 [set color lime] quintile = 4 [set color gray + 2] quintile = 5 [set color red] ) ] end to-report top-1-wealth report sum [ wealth ] of max-n-of 1 turtles [ wealth ] end to-report top-1-percent-wealth report sum [ wealth ] of max-n-of (NUMBER-OF-TURTLES * 0.01) turtles [ wealth ] end to-report top-10-percent-wealth report sum [ wealth ] of max-n-of (NUMBER-OF-TURTLES * 0.10) turtles [ wealth ] end to-report bottom-50-percent-wealth report sum [ wealth ] of min-n-of (NUMBER-OF-TURTLES * 0.50) turtles [ wealth ] end to-report wealth-by-quintile [q] report sum [ wealth ] of turtles with [ quintile = q] end to-report wealth-1st-quintile report (wealth-by-quintile 1) end to-report wealth-2nd-quintile report (wealth-by-quintile 2) end to-report wealth-3rd-quintile report (wealth-by-quintile 3) end to-report wealth-4th-quintile report (wealth-by-quintile 4) end to-report wealth-5th-quintile report (wealth-by-quintile 5) end to-report median-wealth report median [ wealth ] of turtles end to-report middle-class-average-wealth report mean [ wealth ] of turtles with [ quintile = 2 or quintile = 3 or quintile = 4 ] end to-report middle-class-median-wealth report median [ wealth ] of turtles with [ quintile = 2 or quintile = 3 or quintile = 4 ] end
There are 2 versions of this model.
This model does not have any ancestors.
This model does not have any descendants.