
Economics Simulation - nabla9
http://nbviewer.jupyter.org/url/norvig.com/ipython/Economics.ipynb
======
bendykstra
In the strange economy that this simulation proposes, every economic
interaction is a zero-sum game. Some or all of the participants' money is
placed in a pot and then randomly redistributed. This economy looks a lot like
a poker tournament! As the game assumes that each economic interaction
produces a winner and a loser, it is no surprise that simulation sorts the
population into winners and losers.

~~~
Zuider
The assumption that the economy was a zero-sum game was characteristic of the
classical economists who came after Adam Smith. While Smith set himself the
task of investigating the creation of wealth, his successors such as Ricardo,
and notably, Malthus focused on the distribution of wealth.

~~~
force_reboot
During my PhD in economics, the first few quarters of microeconomic theory
focused on what we call classical economics, which is also called partial and
general equilibrium theory. These theories are definitely not zero sum games.
Even though partial and general equilibrium theory don't describe economics in
terms of interactions between individuals (in the classical theory,
individuals interact with the market), if they did, the nature of these
interactions would be that they are always strictly positive sum for all
actors. E.g. consider the supply and demand curves, and imagine that for each
vertical line (or horizontal, depending on how you draw the axes), you "match"
the buyers and sellers along that line. Then the difference in the prices that
each individual is willing to buy/sell for is the total gain for that
transaction, with how the gain is distributed being determined by the
equilibrium price.

Your summary seems to focus too much on early thinkers, and doesn't address
the full development of classical theory which took until the 1950's.

------
jamespitts
Nice to see this; it is often difficult to convey a complex point if you leave
your audience to just imagine the outcomes.

A few months ago, I started looking into simulating economics while
researching the housing situ in the Bay Area. I found that the NetLogo package
is commonly used to simulate economics by sociologists.

NetLogo
[https://ccl.northwestern.edu/netlogo/](https://ccl.northwestern.edu/netlogo/)

An example implementation:

NetLogo: Economic Disparity
[http://ccl.northwestern.edu/netlogo/models/UrbanSuite-
Econom...](http://ccl.northwestern.edu/netlogo/models/UrbanSuite-
EconomicDisparity)

~~~
Zuider
It is interesting that the simulation in the linked article above treats the
economic actors as aggregates, while the NetLogo simulation using many
discrete actors is based on methodological individualism. It is easier in the
second case to avoid the simple assumption that economic activity must
necessarily be of a zero-sum nature.

------
chrispeel
I grew up in a very conservative environment and even now consider myself
libertarian. Even so, a progressive tax plus a universal basic income just
seem like the right way to put a floor on income on which people can stand and
better themselves. The sim seemed a little abstracted from normal
interactions, is there some equivalent simulation which shows what happens as
we vary the progressivity of the tax code, and also vary the amount of a basic
income?

Other questions: would it make sense to use the level of a basic income to
stimulate the economy, rather than the fiscal stimulus to banks? Does a basic
income or a progressive tax put a max on the wealthys' income in some non-
obvious way, or just reduce it? Is there an economist who has applied control
theory (i.e. the Kalman filter) to economics?

------
ppereira
I did a similar simulation of income/wealth distributions using US income tax
rates over the past century. It was a gloriously hackish combination of a Lisp
tax-rate parser, auto-generated C actor model, and R.

I sure hope more economists study these methods because the standard models in
Public Economics/Taxation are hopelessly inadequate, if not negligent.

A Nobel Memorial Prize winning economist by the name of James Mirrlees came up
with a theory for optimum income taxation in the 1970s that is still used by
governments today. It suggested that a relatively flat tax would be optimal
rather than the progressive rates then in vogue. Unfortunately, his model is
hopelessly incorrect as it essentially assumes that the general shape of the
(pre-tax) income distribution is constant. Its starting point is that if you
tax people too much, they will just work less than their untaxed income
earning potential, hindering your ability to raise taxes.

In reality, progressive tax rates alter the ability of the wealthy to
accumulate capital, which alters the Pareto coefficient (power-law constant)
of the high-income tail, drastically changing the number of very-wealth
individuals and benefiting the bottom 90%. If you tax too regressively, wealth
can concentrate and even "condense" in the wealthy -- essentially shifting all
earning capacity to a few. This happens because there exist power-law
coefficients for high incomes that are not integrable. Beyond a tipping point,
wealth will just continue to "condense" in the wealthiest actors.

You can find detailed tax schedules and inequality data for the US for the
last century. The details of the actor-interactions are not that important,
much like molecular interactions do not make a qualitative difference in
statistical mechanics. In fact, analytical stochastic models may be easier to
calculate, although they are less flexible.

Income tax progression can explain a large part of the variation, but not all.
There are other important factors such as union participation, war-time
expropriation, and lending terms. Nevertheless, the income tax schedule is
important and easy to change.

~~~
chipsy
I'd love to see some more details about this work, in a form like the OP's
blog. Simulation results hold a big appeal to the HN crowd and I think you'd
find a good audience for them.

------
malloryerik
Super interesting, and a not just a bit worrisome. I was reminded of how some
ancient societies had periodic forgiveness of debts, perhaps one limited form
of redistribution, though as we all know most societies historically have been
made of a small wealthy minority lording over a mass of the poor...

The "transactions" might not have to be purely monetary for things to work out
this way. We could include interactions where the winner gets privileges and
status, later to be translated into economic wealth.

Btw Jupyter Notebook is so cool for things like this.

~~~
meric
We still have debt forgiveness. It's called chapter 11 and bankruptcy. We
still a wave of these every few years or so. The Asian financial crisis, dot
com bust, GFC, and the latest wave of commodity producers going bust, are all
prime examples of mass forgiveness of debts.

------
maker1138
I'm curious as to why anyone would think economics could only be zero sum. How
would they explain going from mud huts to skyscrapers and animals to aircraft?
Such a "simulation" would not account for this obvious reality.

~~~
clavalle
Transactions cannot be zero sum. What would the point be?

In the common case: Two people come together and trade because each feels they
get more value after the transaction than before the transaction. Positive
sum.

In a less common case: Two people get come together and trade because without
the trade one of them would lose more than the value they spend on the
transaction and the other one gains value. For example, if you have a gold
watch but you are hungry and have no cash and I have food you might trade that
watch for a sandwich. Also not a zero sum game. In this example a negative sum
but I could imagine a positive sum where the one party gains more value than
the other stands to lose after the transaction is complete. Say, you need to
pay some workers on your construction crew and you have a generator that is
normally worth about $50K and you sell it to me for cash at $40K. I, in turn,
use that generator to do my job worth $100K that I wouldn't be able to
complete without it..etc. It can get complicated.

A zero sum transaction would have one person losing the exact value the other
person gains. A very odd and rare case I would guess.

~~~
dredmorbius
Transactions can be negative sum.

Theft or armed robbery are transactions. They typically reduce overall wealth.

~~~
meric
Also gambling between two people - though one party loses the exact amount the
other person gains, the time spent to place the bet and to watch the result
costs time. One could argue they both gained utility in terms of enjoyment,
but in terms of wealth and GDP the transaction is negative-sum.

~~~
monort
By this logic any entertainment-related transactions are zero-sum. People gain
utility by being entertained, sometimes you can even objectively measure it,
e.g. higher productivity after holidays.

~~~
dredmorbius
Note that you've made the leap from "may be" to "must be".

There are numerous highly persistent behaviors, including play, entertainment,
sleep, drugs consumption, recreational physical activity _in excess of all
training response stimulus requirements_ , etc., which nonetheless continue.

While I'm not certain that _all_ are beneficial, and I have a difficult time
myself accepting certain of these, I suspect they play a useful and possibly
even vital psychological role for those undertaking them.

Even explaining these as coping mechanisms for underlying pathologies isn't
particularly satisfying.

------
oli5679
This is really well presented and there are some surprising results. It would
be good to add in gains from trade/interaction to the model.

Economic theory suggests that agents would not willingly consent to
transactions with negative expected returns and there are plenty of examples
of mutually beneficial transactions in the real world (most goods I buy I
would have been happy to pay more and the shop makes a profit).

In this context, it would be interesting to see the tradeoff between
efficiency and equality with different allocation rules (and resulting
transaction frequencies). This could in some way relate to the optimal
taxation literature....

------
computator
Having known several economists, I've always wondered why these guys aren't
rich, or at least better off than they are.

Economists understand the theories behind money and wealth creation much
better than us but--as far as I've seen--they aren't richer than average
university-educated people.

~~~
alister
> Economists understand the theories behind money and wealth creation

Isaac Asimov was trained as a chemist before becoming a science fiction
writer. He relates the story where someone asked him what kind of glue to use
for gluing together certain materials. Asimov said he had no idea, and the
person walked away shaking his head and presumably thinking "some chemist this
guy is".

Understanding glues and adhesion is at least one level of abstraction higher
than knowing fundamentals of chemistry.

Richard Feynman also had a great essay about how understanding quantum physics
doesn't allow you to figure out everyday physics questions (eg., At what
temperature does gold melt?). In theory it should be possible to derive the
melting point of gold from quantum physics, but it's impossibly difficult to
do so.

Likewise, creating wealth (doing business, trading stocks, etc.) is probably
several levels of abstraction higher than knowing the theories behind wealth
creation.

~~~
notthemessiah
Unlike physics or chemistry, which has a heavy empirical backing and a degree
of rigor in the application of logic, economics is founded on many axioms and
assumptions which usually don't hold up to scrutiny and undermine the field's
ability to make accurate predictions. The entire finance market was an ediface
built on theories with the the assumption that prices arrive to some
analytical equilibrium and describes nothing of how prices change over time.
And in order to price derivatives, the Black-Scholes model ignores any
statistical moments other than mean and variance. These abstractions get
shakier the higher you go up.

Building abstractions when your foundation is questionable is building a house
a house on sand. Don't be surprised when it collapses, as it did in 2008, and
the spectre of wealth you perceive reveals itself as an illusion.

------
phunge
Can someone explain why the random_split (i.e. first) rule tends towards
inequality? It seems that any time a rich&poor person meet, the expected
outcome is that the poor person receives money -- E(Uniform(0, X+Y)) = (X+Y)/2
> min(X,Y). So how does that lead to a rich-get-richer effect?

~~~
bendykstra
If the pot is split at an random point between 0 and 1, then on average, 75%
will go to one player and 25% to the other player. (It doesn't matter which
player is which or how many points the players began the round with.) The
equilibrium is a state in which the average pairing between two players is
unequal in this 75/25 ratio.

------
vezzy-fnord
Author says they were influenced by a class from Bard College. I will note
that Bard is home of the far-left Levy Institute think tank.

It's hypocritical too, because institutions like Bard and UMKC are home to a
lot of heterodox economists who rant and rave against the neoclassical
orthodoxy for making unrealistic assumptions, and then they pull off rigged
pseudo-Paretian chicanery like this. An economy of zero transaction cost spot-
exchanging automatons without so much as a capital stock.

This is nothing but a political provocation.

~~~
nabla9
This is Director of Research at Google playing with Python.

Don't read too much politics into it.

~~~
ehudla
Or do...

------
skanderbm
Probably my misunderstanding, but this simulation does not reflect a continued
concentration of wealth in the hands of a few, in my opinion.

Please let me know your thoughts:

I agree that the concentration of wealth reflected in the charts shows that,
at any point of time, the person at the 1st percentile owns an increasing
fraction of the total wealth. However, this same person is very likely to be
almost immediately spoliated by the subsequent transaction, and give all its
wealth to someone (maybe the poorest person).

In summary, there is a lot of social mobility, as can be revealed by
commenting out the following line in the code (essentially, we now track the
financial path of specific individuals, rather than the wealth of various
percentiles):

def record_percentiles(population, percentiles): #population =
sorted(population, reverse=True) N = len(population) return
[population[int(p*N/100.)] for p in percentiles]

So, it seems to me that, on average, everyone is equal over time, but each
instant offers every participant dramatic ups and downs.

Not sure if I am missing something.

------
kriro
Am I reading the code correctly...two actors meet, pool their "wealth" or some
portion of it and then that pot is redistributed in some way?

I guess it's interesting to simulate this to get a feel for how such a market
system would work. It would be interesting to play around with a rudimentary
system of taxation. Maybe something as simple as "take 10% from each pot and
evenly distribute it among the poorest actors currently around" as a starting
point.

Maybe it's because I randomly got interested in the French Liberals and am
reading through "Economic Harmonies" but I'd be very interested in a model of
"island economics". With a number of actors that have a list of preferences of
items and only exchange if both are better of according to their list. In my
mind it escalates quickly because I want to add the need to eat, production
etc.

------
purpled_haze
All of these are simulations. We cannot simulate current economics in a way
that would approximate reality.

------
jsprogrammer
Be sure to check out a similar simulation, "No need for conspiracy: Self-
organizined cartel formation in a modified trust game" (0).

(0) [http://arxiv.org/pdf/1201.3798v3](http://arxiv.org/pdf/1201.3798v3)

------
larsiusprime
Always great to see these sorts of articles.

Here's another paper on the subject, if anyone's interested:

Doran & Parberry - Emergent Economies for Role Playing Games

[https://larc.unt.edu/techreports/LARC-2010-03.pdf](https://larc.unt.edu/techreports/LARC-2010-03.pdf)

I wrote an open source implementation of it once, was pretty fun.

~~~
SonOfLilit
Thanks for this.

I once tried to run a tabletop RPG at a convention based on an agent-based
economic simulation.

I ended up coding all night on the night before the game, not managing to get
my simulation not to diverge, and running a great game anyway :)

------
MaysonL
This is not a good simulation of an economy: there is no wealth creation.

------
lumberjack
Isn't this essentially the Austrian school of economics in python?

~~~
nabla9
No. Austrians reject econometrics on principle.

~~~
lumberjack
Econometrics relies on economic data which is lacking here. That is precisely
my point.

This is not econometrics.

~~~
nabla9
While Mises played some lip service to Game theory, Austrians have generally
have huge resistance to formal methods.

