New Simple Economy 2.0.1

New Simple Economy 2.0.1 preview image

1 collaborator

Thai_visa_cr Carl Snare (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0.4 • Viewed 480 times • Downloaded 39 times • Run 0 times
Download the 'New Simple Economy 2.0.1' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


ACKNOWLEDGMENT

This is a modifification by Carl Snare, February, 2019, of textbook model"Simple Economy" and the NetLogo Models Library model, "Wealth Distribution". It introduces various measures of inequality, including the Lorenz Curve and related Gini Index. from "Wealth Distribution." Additionally, sliders are included to facilitate changes to the number of agents, initial wealth and transaction amounts.

"Simple Economy" 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.* "Simple Economy" 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/.

"Wealth Distribution" is from the Models Library: Sample Models, Social Science. The 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.

  • Wilensky, U. & Rand, W. (2015). Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo. Cambridge, MA. MIT Press.

WHAT IS IT?

This model simulates the simple random 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.

It is a simple model of economic exchange between people of equal initial wealth. It operates on random chance, with no externalities involved in the creation of wealth. It looks to the question, "Why have you so much, and I have so little?" It examines a world where, at every time step, each person gives a fixed amount of money to another person, randomly chosen. The results indicate inequality of wealth increasing over time.

Randomness means that in the short term you cannot guess a value but in the long term all possible values will have occurred more or less equally often

HOW IT WORKS

The slider NUM-AGENTS creates the specified number of agents. Setup gives them shape, color, size and orientation. The INITIAL-WEALTHS slider gives each agent the same amount of starting wealth. Each agent then gives money to a randomly selected other agent in an amount determined by the TRANSACTION-AMOUNT slider. If an agent hasn't enough wealth to give money there is no transaction. Wealths is updated with deduction for the amount given and an addition for the amount received.

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 a society of 100 people with a fixed amount of wealth available. Each individual is 1% of the population. 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 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 “

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. Another way to understand (and equivalently compute) the Gini index, without reference to the Lorenz curve, is to think of it as the mean difference in wealth between all possible pairs of people in the population, expressed as a proportion of the average wealth (see Deltas, 2003 for more)L”.

HOW TO USE IT

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.

Press SETUP to setup the model, then press GO to watch the model develop.

THINGS TO NOTICE

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.’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?

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?

Does random selection of turtles always lead to inequality of wealth? Does the Pareto Principle of an 80/20 wealth distribution hold? What is the effect of changing the basic variables: NUM-AGENTS, TRANSACTION-AMOUNT and INITIAL-WEALTH?

In the model there is the probability of receiving money from n-1 other turtles, and the certainty of giving up a sum of money, TRANSACTION-AMOUNT, at each tick. In the best case an agent might receive money from all other turtles, while, in the worst case, the agent receives nonthing at all. In both cases the agent gives up some amount of money regardless of income. The agent could also receive the same amount he gave away, a breakeven situation. What does the probability distribution look like?

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?

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 arrive at an unequal distribution of wealth? Is it more equal in the measure of the Gini index than with random endowments of vision?

EXTENDING THE MODEL

Change the number of turtles, change the transaction amount., and/or Change the initial wealths. How does this affect 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

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.

*For more on the calculation of the Gini index see: Deltas, George (2003). The Small-Sample Bias of the Gini Coefficient: Results and Implications for Empirical Research. The Review of Economics and Statistics, February 2003, 85(1): 226-234.

In particular, note that if one is calculating the Gini index of a sample for the purpose of estimating the value for a larger population, a small correction factor to the method used here may be needed for small samples.

Lorenz curve and Gini index:

Pareto Principle (80/20 rule):

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 "Simple Economy" itself:

For the model "Wealth Distribution" itself:

Wilensky, U. (1998). NetLogo Wealth Distribution model. http://ccl.northwestern.edu/netlogo/models/WealthDistribution. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

Please cite the NetLogo software as:

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

"Simple Economy" and "Wealth Distribution" Copyright 2011 Uri Wilensky.

CC BY-NC-SA 3.0

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

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [
  gini-index-reserve
  lorenz-points
  Pareto-ratio
]

turtles-own [ wealth ]

to setup
 clear-all
  ask patches [ set pcolor white ]
  create-turtles num-agents [
    ;; everyone starts with the same amount of after-tax money
    set wealth initial-wealths
    set shape "circle"
    set color 125
    set size 3
    ;; visualize the turtles from left to right in ascending order of wealth
    setxy wealth random-ycor  ; all agents have same initial wealth
  ]
    update-lorenz-and-gini
  reset-ticks
end 

to recolor-turtles
  ;; Set the class of the turtles -- if a turtle has less than a third
  ;; the wealth of the richest turtle, color it red.  If between one
  ;; and two thirds, color it green.  If over two thirds, color it blue.

  ; ask turtles [set wealth sort wealth]
  let max-wealth max [wealth] of turtles
  ask turtles
    [ ifelse (wealth <= max-wealth / 3)
        [ set color red ] ; one-third of maximum wealth
        [ ifelse (wealth <= (max-wealth * 2 / 3))  ; two-thirds of maximum wealth
            [ set color green ]
        [ set color blue ] ]
  ]
end 

to go
  ;; agents with less than the transaction amount can't give it away
  ask turtles [if wealth >= transaction-amount [ transact-and-update ]]
  ;; prevent wealthy turtles from moving too far to the right
  ask turtles [ ifelse wealth <= max-pxcor [ set xcor wealth ] [ set xcor wealth * 2]] ; xcor can't exceed max-pxcor
  recolor-turtles
  update-lorenz-and-gini
  tick
end 

to transact-and-update
  ;; prevent rich turtles from going too far to the right
  if wealth >= max-pxcor [ set xcor max-pxcor ]
  ;; 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 recomputes the value of gini-index-reserve
  ;; and the points in lorenz-points for the Lorenz and Gini-Index plots
  ;; 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 index 0
  set gini-index-reserve 0
  set lorenz-points []

  ;; now actually plot the Lorenz curve -- along the way, we also
  ;; calculate the Gini index.
  ;; (see the Info tab for a description of the curve and measure)
  repeat num-agents [
    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 index (index + 1)  ; counts the number of agents in this loop
    set gini-index-reserve gini-index-reserve + (index / num-agents) - (wealth-sum-so-far / total-wealth)
  ]
end 

to-report top-10-pct-wealth
  report sum [ wealth ] of max-n-of (count turtles * 0.10) turtles [ wealth ]
end 

to-report top-20-pct-wealth
  report sum [ wealth ] of max-n-of (count turtles * 0.20) turtles [ wealth ]
end 

to-report bottom-50-pct-wealth
  report sum [ wealth ] of min-n-of (count turtles * 0.50) turtles [ wealth ]
end 

to-report bottom-80-pct
  report sum [ wealth ] of min-n-of (count turtles * 0.80) turtles [ wealth ]
end 

to-report total-wealth
  report sum [ wealth ] of turtles
end 

to-report Pareto-80/20-test
  report ((sum [ wealth ] of min-n-of (count turtles * 0.80) turtles [ wealth ]) - (sum [ wealth ] of max-n-of (count turtles * 0.20) turtles [ wealth ]))
end 

to-report wealth-by-class
  report (sum [ wealth ] of turtles with [ color = red ])
  report (sum [ wealth ] of turtles with [ color = green ])
  report (sum [ wealth ] of turtles with [ color = blue ])
end 

to-report top-wealth-%
  report ((sum [ wealth ] of turtles with [ color = blue]) / (sum [ wealth ] of turtles) * 100)
end 

to-report mid-wealth-%
   report ((sum [ wealth ] of turtles with [ color = green ]) / (sum [ wealth ] of turtles) * 100)
end 

to-report low-wealth-%
   report ((sum [ wealth ] of turtles with [ color = red ]) / (sum [ wealth ] of turtles) * 100)
end 

to-report top-wealth-population
  report (count turtles with [ color = blue ])
end 

to-report mid-wealth-population
  report (count turtles with [ color = green ])
end 

to-report low-wealth-population
  report (count turtles with [ color = red ])
end 

to-report top-average-wealth
   report (((sum [ wealth ] of turtles with [ color = blue ]) / (count turtles)))
end 

to-report mid-average-wealth
   report ((sum [ wealth ] of turtles with [ color = green ]) / (count turtles))
end 

to-report low-average-wealth
   report ((sum [ wealth ] of turtles with [ color = red ]) / (count turtles))
end 

to-report upper-third-wealth
  report sum [ wealth ] of turtles with [ color = blue]
end 

to-report middle-third-wealth
   report sum [ wealth ] of turtles with [ color = green]
end 

to-report lower-third-wealth
   report sum [ wealth ] of turtles with [ color = red]
end 

There is only one version of this model, created over 6 years ago by Carl Snare.

Attached files

File Type Description Last updated
New Simple Economy 2.0.1.png preview Preview for 'New Simple Economy 2.0.1' over 6 years ago, by Carl Snare Download

This model does not have any ancestors.

This model does not have any descendants.