NetLogo banner

 NetLogo Publications
 Contact Us

 Modeling Commons

 User Manuals:
 Farsi / Persian


NetLogo User Community Models

(back to the NetLogo User Community Models)

[screen shot]

If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".

Try It in NetLogo Web


This model simulates the distribution of wealth. "The rich get richer and the poor get poorer" is a familiar saying that expresses inequity in the distribution of wealth. In this simulation, we see Pareto's law, in which there are a large number of "poor" or red people, fewer "middle class" or green people, and many fewer "rich" or blue people.
; { Modifications from the original Wealth Distribution Model made by }
; { Michael Gizzi, Tom Lairson and Richard Vail between July 15 and October 25, }
; { 2003 are indicated using { }. }
; { For a summary of changes made set the procedures tab. }
; { Numbers are used to correlate the code changes. }
; { 7. Capture wealth for inheritance }
; { - For death by old age capture the old-wealth }
; { - transfer it to the new generation of turtles }
; { - share 50 / 50 with new siblings }
; { - add generation counter (number of times inherited wealth) }
; { - add % gen 0 monitor (percent that starved in the last life) }
; { after the first generation dies off }
; { 8. If the turtles starve 30 % of them will die. }
; { - % generation 0 indicates how inheritence is going and how many starve. }
; { 9. Add choices and buttons for various changes, for experimentation. }
; { - patch-productivity increases - on or off. }
; { - pop-growth - none, equal, starvation. }
; { - settling? - none, settlers, employees. }
; { - inherit? - on or off. }
{ We plan to make significant modifications to this model. }
{ As we make modifications to this model, they will be discussed below in inset brackets. }
{ Coding of the modifications is noted in comments on the procedures. }


This model is adapted from Epstein & Axtell's "Sugarscape" model. It uses grain instead of sugar. Each patch has an amount of grain and a grain capacity (the amount of grain it can grow). People collect grain from the patches, and eat the grain to survive. How much grain each person accumulates is his or her wealth.

The model begins with a roughly equal wealth distribution. The people then wander around the landscape gathering as much grain as they can. Each person attempts to move in the direction where the most grain lies. Each time tick, each person eats a certain amount of grain. This amount is called their metabolism. People also have a life expectancy. When their lifespan runs out, or they run out of grain, they die and produce a single offspring. The offspring has a random metabolism and a random amount of grain, ranging from the poorest person's amount of grain to the richest person's amount of grain. (There is no inheritance of wealth.)

To observe the equity (or the inequity) of the distribution of wealth, a graphical tool called the Lorenz curve is utilized. We rank the population by their wealth and then plot the percentage of the population that owns each percentage of the wealth (e.g. 30% of the wealth is owned by 50% of the population). Hence the ranges on both axes are from 0% to 100%.

Another way to understand the Lorenz curve is to imagine that there are 100 dollars of wealth available in a society of 100 people. Each individual is 1% of the population and each dollar is 1% of the wealth. Rank the individuals in order of their wealth from greatest to least: the poorest individual would have the lowest ranking of 1 and so forth. Then plot the proportion of the rank of an individual on the y-axis and the portion of wealth owned by this particular individual and all the individuals with lower rankings on the x-axis. For example, individual Y with a ranking of 20 (20th poorest in society) would have a percentage ranking of 20% in a society of 100 people (or 100 rankings) -- this is the point on the y-axis. The corresponding plot on the x-axis is the proportion of the wealth that this individual with ranking 20 owns along with the wealth owned by the all the individuals with lower rankings (from rankings 1 to 19). A straight line with a 45 degree incline at the origin (or slope of 1) is a Lorenz curve that represents perfect equality -- everyone holds an equal part of the available wealth. On the other hand, should only one family or one individual hold all of the wealth in the population (i.e. perfect inequity), then the Lorenz curve will be a backwards "L" where 100% of the wealth is owned by the last percentage proportion of the population. In practice, the Lorenz curve actually falls somewhere between the straight 45 degree line and the backwards "L".
; { Modifications from the original Wealth Distribution Model made by }
; { 1. Another way to visualize this is to look at the percent of wealth }
; { controlled by quintiles of the population. The Quintile Wealth histogram }
; { shows this. The wealthest 20% will control more than 20 percent of the }
; { wealth. The poorest 20% will control less. Moves in Quintile Wealth are }
; { similar to the Lorenz curve. For clarity it is worth noting that the }
; { Quintile of a turtle is only roughly related to the class noted above. }
; { When the richest turtle has much more wealth than most of the rest of the }
; { turtles, the lower class is huge, but will be distributed across several }
; { quintiles. Comparison to Bill Gates makes most of us look very very poor. }

For a numerical measurement of the inequity in the distribution of wealth, the Gini index (or Gini coefficient) is derived from the Lorenz curve. To calculate the Gini index, find the area between the 45 degree line of perfect equality and the Lorenz curve. Divide this quantity by the total area under the 45 degree line of perfect equality (this number is always 0.5 -- the area of 45-45-90 triangle with sides of length 1). If the Lorenz curve is the 45 degree line then the Gini index would be 0; there is no area between the Lorenz curve and the 45 degree line. If, however, the Lorenz curve is a backwards "L", then the Gini-Index would be 1 -- the area between the Lorenz curve and the 45 degree line is 0.5; this quantity divided by 0.5 is 1. Hence, equality in the distribution of wealth is measured on a scale of 0 to 1 -- more inequity as one travels up the scale.
; { 2. A random 40% chance for the max-grain-here to increase by 1 unit happens }
; { every 50 ticks. This is to simulate improvement in technology over time. }
; { The questions is does this sort of growth allow for improvement for the }
; { lowest class, or quartile?
; { 3. Population is fixed in the original model at 250. A random 10% chance for }
; { population to increase by 1 every time a turtle dies was added to explore }
; { What is the effect of increased population on distribution of wealth? }
; { When population growth was added to the model, it was necessary to use }
; { a count of turtles to keep the Lorenz curve and the Gini index useful. }
; { 4. Allows turtles who are wealthy enough to settle on a rich patch, and }
; { and become more stable and productive, by increasing grain production. }
; { This, of course, opens questions about distribution to others in the patch.}
; { In the settled model the settler gets all of the harvest from the patch. }
; { When settlers die, the patch becomes open for settlement by another turtle.}
; { 5. Allows up to two employees to be hired by settled turtles. Potential }
; { employees must cross the patch with at least 10 wealth. This increases }
; { land productivity, up to the max-grain-here limit of the patch. Settlers }
; { Settlers share 50/50 with employees. When an employee dies the position is }
; { opened. }
; { 6. This change added some displays to the model including a monitor for the }
; { showing the wealth percent of total wealth controlled by the top 1% of the }
; { of the population, the super rich. And the plot of quintile wealth. }
; { 7. What is the effect of inheritance? When a turtle dies of old age its }
; { wealth is captured - in the original model it just evaporates. This is }
; { transferred to a next generation - if two turtles are produced the wealth }
; { shared between the siblings 50/50. If a turtle dies of starvation the }
; { generation is reset to zero. A monitor was added to show the percent of }
; { turtle with no generations of inherited wealth. After startup effects this }
; { shows the percent of turtles that starved in the last generation. }
; { 8. When turtles die from starvation 30 % of them will die, with out off- }
; { spring. This was added to moderate the growth of population. }
; { 9. Exploring the impact of all of these changes at once led to confusion. So }
; { some switches and choice menus were added so that each modification could }
; { be on or off. }


The PERCENT-BEST-LAND slider determines the initial density of patches that are seeded with the maximum amount of grain. This maximum is adjustable via the MAX-GRAIN variable in the SETUP procedure in the procedures window. The GRAIN-GROWTH-INTERVAL slider determines how often grain grows. The NUM-GRAIN-GROWN slider sets how much grain is grown each time GRAIN-GROWTH-INTERVAL allows grain to be grown.

The NUM-PEOPLE slider determines the initial number of people. LIFE-EXPECTANCY-MIN is the shortest number of ticks that a person can possibly live. LIFE-EXPECTANCY-MAX is the longest number of ticks that a person can possibly live. The METABOLISM-MAX slider sets the highest possible amount of grain that a person could eat per clock tick. The MAX-VISION slider is the furthest possible distance that any person could see.

GO starts the simulation. The TIME ELAPSED monitor shows the total number of clock ticks since the last setup. The CLASS PLOT shows a line plot of the number of people in each class over time. The CLASS HISTOGRAM shows the same information in the form of a histogram. The LORENZ CURVE plot shows the Lorenz curve of the population at a particular time as well as the 45 degree line of equality. The GINI-INDEX V. TIME plot shows the Gini index at the time that the Lorenz curve is drawn. The LORENZ CURVE and the GINI-INDEX V. TIME plots are updated every 5 passes through the GO procedure.

; { 6. The simulation will automatically stop after the chosen NUM-STEPS. When }
; { the number of steps is finished, hitting the GO button again will continue }
; { the simulation for another NUM-STEPS, and again for a third round. }
; { 9. The PATCH-PRODUCTIVITY switch controls modification 2, slow growth of }
; { patch capacity. The POPULATION-GROWTH choice menu allows for the original }
; { static population (NONE); an EQUAL 10% chance of two off-spring when a }
; { turtle dies; or STARVATION where there is a 30% chance of no off-spring }
; { when a turtle starves and 10% chance of two off-spring when a turtle dies }
; { of old age. The SETTLING? choice menu allows for the original model with }
; { no settlers (NONE); SETTLERS which allows settlers as discribed in }
; { modification 4; or EMPLOYEES which allows for both settlers and employees }
; { as described in modifications 4 and 5. The INHERIT? switch turns }
; { inheritance on or off. Any combination of switches can be setup. }


Notice the distribution of wealth. Are the classes equal?

This model usually demonstrates Pareto's Law, in which most of the people are poor, fewer are middle class, and very few are rich. Why does this happen?

Do poor families seem to stay poor? What about the rich and the middle class people?

Watch the CLASS PLOT to see how long it takes for the classes to reach stable values.

As time passes, does the distribution get more equalized or more skewed? (Hint: observe the Gini index plot.)

Try to find resources from the U.S. Government Census Bureau for the U.S.' Gini coefficient. Are the Gini coefficients that you calculate from the model comparable to those of the Census Bureau? Why or why not?

Is there a trend in the plotting of the Gini index with respect to time? Does the plot oscillate? Or does it stabilize to a certain number?

; { 4. The number of settlers is heavily influenced by the PERCENT-BEST-LAND }
; { 8. Inheritance has some interesting effects, if the PERCENT-BEST-LAND is over }
; { about 15%. }


Are there any settings that do not result in a demonstration of Pareto's Law?

Play with the NUM-GRAIN-GROWN slider, and see how this affects the distribution of wealth.

How much does the LIFE-EXPECTANCY-MAX matter?

Change the value of the MAX-GRAIN variable (in the SETUP procedure in the procedures tab). Do outcomes differ?

Experiment with the PERCENT-BEST-LAND and NUM-PEOPLE sliders. How do these affect the outcome of the distribution of wealth?

Try having all the people start in one location. See what happens.

Try setting everyone's initial wealth as being equal. Does the initial endowment of an individual still arrive at an unequal distribution in wealth? Is it less so when setting random initial wealth for each individual?

Try setting all the individual's wealth and vision to being equal. Do you still arive at an unequal distribution of wealth? Is it more equal in the measure of the Gini index than with random endowments of vision?


Have each newborn inherit a percentage of the wealth of its parent.
; { 8. The addition of inheritance is a stab at this, but lots of things could be }
; { tried. }

Add a switch or slider which has the patches grow back all or a percentage of their grain capacity, rather than just one unit of grain.

Allow the grain to give an advantage or disadvantage to its carrier, such as every time some grain is eaten or harvested, pollution is created.

Would this model be the same if the wealth were randomly distributed (as opposed to a gradient)? Try different landscapes, making SETUP buttons for each new landscape.

Try allowing metabolism or vision or another characteristic to be inherited. Will we see any sort of evolution? Will the "fittest" survive?

Try adding in seasons into the model. That is to say have the grain grow better in a section of the landscape during certain times and worse at others.

How could you change the model to achieve wealth equality?
; { This was the focus of many of our changes and experiments. }

The way the procedures are set up now, one person will sometimes follow another. You can see this by setting the number of people relatively low, such as 50 or 100, and having a long life expectancy. Why does this phenomenon happen? Try adding code to prevent this from occurring. (HINT: When and how do people check to see which direction they should move in?)

; { There is still a lot of room for exploration in this model. Many choices were }
; { were made that could be sliders. For example, effects of how settlers and }
; { employees share wealth, or the number of employees could be very fruitful. }


Examine how the landscape of color is created -- note the use of the "scale-color" reporter. Each patch is given a value, and "scale-color" reports a color for each patch that is scaled according to its value.

Note the use of lists in drawing the Lorenz Curve and computing the Gini index.

; { Note the use of choice menus to set up experiments with various modifications.}
; { Significant time would have been saved if we had thought of this earlier. }


; This model cries out for scientific investigation of the various possible outcomes, in terms of changes in the ; gini-index when running different combinations of experiments.

; Multiple runs with the same settings are necessary to get a better sense of the impact of randomness on the ; model. Behavior space is the ideal tool to accomplish this, but does not have a built-in method of running ; several runs of the model with the same settings. An easy way to overcome this limitation is to add a slider ; to the model called "runs." While this slider has no impact on the model's code, it can be used in behavior ; space as the slider values to be varied. For example, set up the model to run a particular experiment; tell ; Behavior Space to vary "Runs" from 1 - 25 (for twenty five runs of the model), and set an exit condition of X ; time clicks (try 500 or 1000). For the reporter, change "count turtles" to "gini-count" and you'll be able to ; track the change in the gini-index over X time clicks, and X runs of the model.


For an explanation of Pareto's Law, see

This model is based on a model described in Epstein, J. & Axtell R. (1996). Growing Artificial Societies: Social Science from the Bottom Up. Washington, DC: Brookings Institution Press.

To refer to this model in academic publications, please use: Gizzi, Michael; Lairson, Tom; and Vail, Richard, Mesa State College, Center for Agent-Based Modeling, 1100 North Avenue, Grand Junction, CO. October 2003. Modifications to a original model created by: Wilensky, U. (1998). NetLogo Wealth Distribution model. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

(back to the NetLogo User Community Models)