Hacker News new | past | comments | ask | show | jobs | submit login
Economics Simulation (ipython.org)
209 points by ntoshev on Jan 21, 2014 | hide | past | favorite | 121 comments



If you are interested in economic modelling have a look at Minsky.[1][2] It isn't that pretty and it is in (C++ and Tcl/Tk) rather than Python but Steve Keen's Minsky project looks like an interesting take on macroeconomic modelling (rather than microeconomic simulation). It was Kickstarter funded (at least partially).

Steve Keen was predicting a big debt triggered crash before 2008 and believes in economic models that at least have the possibility of crisis and disequilibrium being the normal state (which is regarded as unorthodox in economics).

Minsky can model chaotic system (even outside of economics)[3].

[1] http://www.debtdeflation.com/blogs/minsky/

[2] http://sourceforge.net/p/minsky/home/Home/

[3] http://www.debtdeflation.com/blogs/2013/09/10/famous-models-...


Tom Sargent, the econ Nobel Laureate, has a great website with examples in numpy/scipy solving some well-known micro/macro problems.

http://quant-econ.net/


This is not economic model in any usual sense of the word 'economic'. At best it's a discrete diffusion simulation -- purposely obfuscated with loaded words like wealth and transactions.

Its a nice exposition of using python for a simulation, but it has little bearing on economics.



As someone who works with simulation models for a living, this was a fascinating read. Thanks for linking it.


I'd be interested in what you think of that paper - I was fascinated by it as it seemed rather odd coming from an engineering perspective.


Disclaimer: I'm an Epidemiologist, not an Economist, so it was a reading from someone outside the field.

The idea that fields have certain "ways of knowing" something was interesting to me - that for economics, its about the analytic solution of an equilibrium.

My own field has something similar - generally speaking, the "hierarchy of evidence" starts with single case reports at the bottom, and then way up at the top are meta-analyses of large randomized clinical trials. As a modeler, I was once asked by a clinician where models (be they analytical or simulation) fit in that framework, and the only answer I could give was "along side it". Analytic results are Capital-T True in a way that even RCTs aren't, but are only true in the universe laid out by the model itself, for example.

It was also just an interesting read as models in my field have been migrating from analytic (or numerical) solutions to equilibrium problems toward more simulation and agent based models, and that same "Yes, but how do you know it's right" type questions are coming up.


This is slightly off-topic but I've recently read the book "Growing Artificial Societies: Social Science From the Bottom Up" and in my spare time I've been slowly implementing something very similar to the sort of "Maximally-Minimalist" simulation they describe.

This simulation includes the concept propagation of disease, again in a sort of "Maximally-Minimalist" way. While it's suitable in the sense that it fits with the rest of simulation, I've identified it as something that I am going to have to learn about before I extend that part of the simulation beyond what's already been described.

So I was wondering if you might know of a resource which presents various minimalist models of disease propagation that you could recommend. I'm not epidemiologist, I'm actually retired and studying economics as they pertain to environmental systems, so I'm not actually looking for anything that extremely complex or compute intensive... I'm just looking for something slightly more detailed that what I've got now and perhaps describes a step-by-step method towards modeling that's actually realistic.


This may be a good place to start: http://press.princeton.edu/titles/9639.html

It's a textbook on agent-based models written by an ecologist (where an awful lot of disease modeling is done). I believe there's a cheaper paperback version on Amazon, and they use NetLogo, which is pretty gentle computationally.


Thanks!


I guess one thing that epidemiologists and economists have in common is that you can't do controlled experiments?


Indeed.


I think that paper doesn't capture the main reason economists shun simulation.

It is true that economists have an unjustified preference for analytic solutions over numeric solutions.

However, the main reason to avoid simulations, is that the assumption of rational agents is not very amenable to the typical approach of simulation. Any simulation that imposed the assumption of rationality would look very different to the simulations that are usually done.

For example, rational agents make decisions based on future prices. I might decide to build a factory, because I expect positive profits given the future prices of inputs and outputs. But I can only know this if I have myself modeled the entire economy. Economists do this using backward induction. They solve for equilibrium in the future, and work backwards.

Another more basic example is that rational agents naturally form markets. Buying/selling of goods is much more accurately described by a perfect market, than by some random matching with random prices.


Have you ever read the book 'The Origin of Wealth'. It goes to great lengths to discredit such 'rational agent', and to a non-economist like me makes a pretty convincing case. Avoiding simulations because they are not very amenable to the assumption of rational agents says more about economists than the utility of simulations in my opinion.


Why do you presume to talk down to me when you haven't even bothered to address the points in my post (in particular the concrete examples I gave of rational agents vs simulations). I have a PhD in economics, but I don't insist that people take my word for gospel. You on the other hand, seem to think that reading a single book makes you an expert.


What you are saying is "discrete diffusion simulation[s]" do not adequately model/explain real economic dynamics.

So this is a valid contribution to economics in the form of an inadequate dynamic model.


> So this is a valid contribution to economics in the form of an inadequate dynamic model.

With that line of reasoning, don't you feel that anything is a "valid contribution to economics" ?


No, for example if we were discussing a model of weather, that would not directly be a contribution to economics.


Weather has a rather strong influence on economics, for example as a predictor of future crop prices. The better the weather model, the more accurately prices can be forecast.

Hedge funds very definitely watch the weather projections.


Yes, so that would be at best an _indirect_ contribution to economics.


It's economics. Nothing in the field is adequate.


So are you saying that discrete diffusion simulation does not model economics in any meaningful sense?


The paper linked to by aet is quite interesting - it suggests that economists are mainly interested in the internal logical structure of their models and that these must be amenable to analytical solutions.

So perhaps the discrete diffusion simulation being discussed just doesn't look like what an economist regards as a "good" model.

[NB I've spent a lot of time writing simulations in the industrial domain - where the simulated result is generally primary and the logical structure is a means to that end].


I would say its as good an economic model as it would be an epidemiological model, if we changed 'wealth' to 'infection'.


That's the beauty that is used to advantage in physics, systems often behave in similar ways. Such a characteristic is not a weakness of a model, often it is a strength.


Seems to be missing demand or utility (for derived demand) functions. But it does have some overlap with computational/agent-based models. I'd give it a B- as a midterm project, maybe a B for using a language better than Matlab.

(I'm an economist).


Somewhat true. In "winner takes all" naturally the asymptotic end point is that all the wealth is on one agent at a time, and it is passed around in transactions randomly.

It would be more interesting to look at where the agents end up from their starting positions. Besides looking at wealth inequality, one could look at "consistency" or whatever you call it.



It's an interesting simulation, but fatally flawed by the assumption that transactions between actors are a zero sum game. It would be more realistic if it modeled the fact that wealth can be created and that actors transact only when the net outcome is more valuable to each of them.


Seems to model things like transactions in fixed resources like land pretty well.

In third-world countries we (the US) have repeatedly bought up land in exchange for short-term goods. The people in the country increasingly become dependent on providing services to the foreign land-holders, or factory work for the outside market.

Once they get fed up with this near-slavery they often try land reform, and that's when we send in the troops/CIA-paid thugs in the name of anti-communism (see Guatamala or Haiti as good examples).

It's like the Asimov story where aliens offer to extend humans' life by ten years for a price in natural resources, which they repeatedly double every ten years. Every resource on earth is eventually strip-mined, life can no longer be supported, and the aliens just move on to the next "voluntary" target.

The WTO plays a big role in these kind of attacks on societies as well. Of all the third-world countries that have developed, they have almost uniformly made heavy use of protectionism, foreign-ownership limitations, etc. The Seattle WTO protests in the 90's were actually seeded with some really interesting arguments and analysis.

Still focusing on land, but bringing things back towards Norvig's simulation (lots of individual actors), Thomas Paine's short essay, "Agrarian Justice," has some good descriptions of what goes on and offers some pretty good solutions.

http://www.ssa.gov/history/paine4.html


in fixed resources like land...

What is this resource you talk about?

Land values are f(productivity, past productivity).

That is they are derivatives of income and wealth.

Notwithstanding the critique of the author, the GP has a point that the science of economics is about the relationship between (production, distribution).

Eliminate that feedback loop, and ... yes, you are just looking at the diffusion of "fake games" people play.

Which are only insightful in the assumptions, but broadly speaking, not so much

All of that in mind, this type of essay/article is just a demonstration of ~technique in a very broad sense.

Its useful to mention/caveat any extrapolations are problematic, but no need to dwell or be overyly crtitical here. IMHO.


I don't think the parent meant that land has fixed value, but that we can't willy-nilly create more of it through the sweat of our brow, in the way that we could make more widgets.


To clarify dllthomas' comment,

Land acreage is a fixed resource.

This is one of the reasons that a lot of economic models depend on land: there is a very real scarcity there to drive the equations with, and it forms a foundation for virtually every other form of scarcity besides labor.


More subtle is the point, particularly in early economic thought, that land is a proxy for the master economic input: energy.

With sufficient energy, you can provide other inputs (raw materials, labor, capital). Without it, you're sunk.

In a preindustrial society, energy == land (and sea), in the form of food and fuel production (agriculture, grazing, fuelwood, wild herds, fish, all by way of direct or indirect sunlight conversion), as well as in the form of wind and water power resources which can be tapped through mechanisms. Ricardo's "law of rent" was in part a lament that all the good ones -- that is, most productive acres -- are taken. He was complaining about asset allocation in his day (he also saw economic surpluses accruing to landowners and labor rather than hard working capitalists and bankers, which is a tad curious).

With an industrialized society, energy's become something we extract from the land (coal, oil, gas, uranium), rather than which is produced or converted by it. But the fundamental truth remains.

In a future sustainable world, we'll again either be at the point where what we take from the land matches the rate at which it's created, or we'll have found some entropy gradient so abundant (fusion? thorium?) that it can be used extractively for tens to hundreds of thousands of years or more without exhaustion, despite the very formidable technical challenges to its utilization.

My leaning is more toward the former than the latter.


Economics would be a lot more interesting if they discussed things in terms of joules rather than in terms of dollars.


I've been exposed to the idea of an energy-backed currency since reading Arthur Clarke's Imperial Earth as a kid (it's actually got a lot to do with energy economics in general, among other themes).

More recently I've been looking at some of the principles of dissipative systems and wondering if one of the fundamental inequality equations of that field isn't applicable as a general concept of capital accumulation. Let's see if I can't find that ... OK: the storage function here:

https://en.wikipedia.org/wiki/Dissipative_system#In_control_...

I've also been kicking around the ideas of, variously, an organism (say, a human), or a herd, or an ecosystem, as an economic analog, and trying to figure out what the equivalent systems within them are. For the body analog, there's the long-standing metaphor within economic literature of the banking system and money as the heart and blood. My read is that these are mistaken -- those correspond to physical constructs within the economy (transportation systems and energy), not the control and signaling systems of the economy. There I think you'd want to map something more on the lines of Ca+ ion exchange or endocrine signaling, though honestly my understanding of biology and systems is pretty loose. I've been meaning to look at how biological and ecological systems signal for resource utilization.


I was thinking just take the ledger of all transactions and exclude everything but land transfers.. that doesn't work though because none of his transaction functions would properly model the way the real land transactions would happen due to feedback with the hidden transactions etc.

I guess the Norvig approach would be to feed in all data from the real economy and tally random sequences of transactions of various lengths, like linguistic n-grams, then for the model just generate transactions using Markov chains derived from that data. If it works for translating languages and modeling human thought, no reason it shouldn't work here.


I think I'd disagree on the point about land.

Suppose actor A has no land and $1000 in cash, and actor B has $500 worth of land and $500 in cash. B is willing to sell A his land for $500. A agrees and they engage in the transaction. After the transaction, A lost $500, but gained $500 worth of land so A still has $1000 of property. B lost $500 worth of land, but gained $500 in cash.

So before the transaction, each has $1000 of property (cash + land), and after the transaction, each still has $1000 worth of property (cash + land). It's just been shuffled a bit based on what each actor desired and what they were willing to pay for what they wanted.

In general, LOTS of transactions in the real world work this way, i.e., actors engage in the transaction to result in a net increase (perceived) of value to themselves. So the simulation is unrealistic in that respect: it assumes transactions in which one party loses are just as likely (if not more likely) than those in which the transaction only occurs if both parties win. In the real world, most transactions occur only if both parties feel the trade is a fair exchange of value (no net loss to either side).


Land has productive value.

Cash, of and by itself doesn't, though there are investment opportunities. It's a transfer and exchange medium.

The reasons someone would care to exchange land for cash could vary, but generally would indicate a need for liquidity. That could be because of a perceived profitable investment elsewhere, but could just as easily be the result of financial pressures (bad loans, business losses, poor financial management, a need to move, being forced from the land (refugee or other forms of political repression), etc.

Just because both parties benefit from a transaction doesn't mean that one doesn't end up with, net net, a better position afterward.


> Of all the third-world countries that have developed, they have almost uniformly made heavy use of protectionism, foreign-ownership limitations, etc.

Do you have a citation for that? I suspect it might just be trivially true because all countries, especially developing countries, make heavy use of protectionism for some definitions of "heavy". It would be useful to show a relationship between level of protectionism and economic growth. My impression is that most economists think that protectionism harms economic growth.

I pre-commit to changing my mind if there's a correlation between greater protectionism and greater economic growth.

As mentioned in the latest Gates letter, huge progress has been made on reducing global poverty recently, and it continues to be made. He says it's likely that there will be almost no poor countries by 2035.


"Bad Samaratins" has lots of citations, but just look at our exports:

One of America's biggest exports is civilian aircraft. I think for a while it was the US's #1 export in terms of profit.

It was also one of the most state-subsidized industries.

Giant aircraft presses can run into the "natural monopoly" problem, there are defense concerns with having military production happen in America, etc., so there are lots of justifications we can make for it. But a subsidy is functionally a tariff.

http://en.wikipedia.org/wiki/Heavy_Press_Program http://en.wikipedia.org/wiki/Natural_monopoly


Ha-Joon Chang is a leading economist critical of much of the orthodoxy. Korean born, currently at University of Cambridge in London. He's studied under a prominent Marxist scholar though I'm not sure he's classified as same himself.

https://en.wikipedia.org/wiki/Ha-Joon_Chang

His books include Bad Samatarians (which cma mentioned) and 23 Things They Don't Tell You About Capitalism.

He has a few online articles and videos on YouTube.


That summary of the Asimov story is very interesting. Do you have the name of the story if I want to read it ?


He's using the word 'wealth' in a imprecise, non-jargon sense that is something like money, or the open market value of all of a person's possessions, or the economist definition. Without teasing those apart it's hard to make any sort of economics simulation that will give results that are interesting in a practical sense.

But hey, Python has lots of cool packages that are useful here, which is the real point.


It's also flawed in that most transactions increase the wealth of both parties. Even though wealth in this context includes non-monetary factors, (e.g. I exchange my time for money), it still means that the interactions in the article (two people meet and one ends up with some proportion of the total money) are very unrealistic.

It might be a realistic simulation of professional poker players.


> actors transact only when the net outcome is more valuable to each of them

At least, the perceived value, but often times in real economies this does not match up with actual value at all. People hoping to better their fortunes end up making poor decisions to that end, particularly -- but certainly not limited to -- poor people without much financial savvy. This part of the simulation seems perfectly accurate to me.


Well, there are three things to think about. There's the current open market price of something, there's the actual subjective value of something, and there's the subjective value that the buyer hopes something will end up having before the transaction is made.

Poor people are certainly sometimes bitten by lack of savy, but more often bitten by the exigencies of their lives pushing them towards shorter planning horizons.


For a very rigorous yet still accessible understanding try Debreu's Theory of Value: http://cowles.econ.yale.edu/P/cm/m17/m17-all.pdf


I'm assuming by wealth, you mean actually producing a good or providing a service?

I know we have to draw the line somewhere, but it would be interesting to throw in some renewable and non renewable resources for transforming goods.


Well, it's just a crude barter system, it has none of the complexities of a real capitalist system.


This is a fun experiment, but in real life transactions create wealth. If a buyer doesn’t feel that the widget she's been offered at a certain price is worth more than the price then she won't buy it. Similarily, if the seller feels the widget is worth more than the price, he won't sell. Therefore, a transaction means wealth wads created since both parties' wealth has increased after the transaction.

I’m pointing this out because it is quite a common misunderstanding that a certain amount of wealth exists in the world, and that it is a zero sum game, where someone has to loose every time someone wins.


How does buying a can of pringles or a pack of cigarettes create wealth for the buyer?


Economists call it "increasing utility". When, in a free market with perfect information, you part with your money in exchange of a good it is assumed to be because the good has higher utility for you than the money it costs. A transaction increases utility for the two parts concerned, otherwise it will not happen.


> A transaction increases utility for the two parts concerned, otherwise it will not happen.

But it happens all the time, through manifactured desire and the exploitation of people's addictions. People are not "rational actors" even though economic theory attempts to dictate it. In fact, most of consumerism seems to be built on getting people to buy things that in turn does not help them to create even more value.


You start off fine by saying that in the context of addictions and other mental aberrations, people are not likely to act in their long term best interests. But then you say this:

> In fact, most of consumerism seems to be built on getting people to buy things that in turn does not help them to create even more value.

In this context, "creating wealth" is not about accumulating resources to create 'even more value' a la Capital. It seems like you're confounding wealth and capital, and they're very different things here. Here we're talking about wealth as meaning economic welfare. Society has more economic welfare--Wealth--when economic exchange happens because resources are allocated in a way that increases utility for everyone.

Life wouldn't be worth living if we worked for the sole purpose of creating lasting capital, in order to build more capital. Consumerism is necessary, so

>In fact, most of consumerism seems to be built on getting people to buy things that in turn does not help them to create even more value.

isn't really a bad thing.

So your first idea and your second idea are only marginally related, and combining them probably hurts your argument overall.


> But it happens all the time, through manifactured desire and the exploitation of people's addictions.

That's not a free market with perfect information, which is the economics equivalent of assuming away friction in Freshman physics exercises.

> People are not "rational actors" even though economic theory attempts to dictate it.

Economic theory doesn't "attempt to dictate" that people are rational actor, it uses the rational actor as a useful simplification that is broadly useful in describing large scale effects, and also one for which it is easy to identify specific difference between the model and reality and their effects, as well.

Admittedly, lots of people -- either through ignorance or because it suits what they are trying to sell -- treat the rational actor model or its implications for an idealized market as descriptions of real (or proposed) conditions when this is inappropriate given readily verifiable differences between the conditions that apply in the market and the explicit assumptions of the rational actor model, but that's more political salesmanship than economic theory.


There's something very cognitively tempting about "People are not entirely rational actors, therefore people are entirely irrational actors", but it's not true. The rational actor model is incorrect; this is beyond dispute. However, it is still largely correct, and it remains more correct than many of the naive models that people rush to substitute in. The economists of the past did not use that model because they were stupid; they used it because it is the most accurate tractable approximation that was available to them.

Also, economics is quite radically value-neutral; if you come to enjoy using deodorant, even if you've never heard of it before it was advertised at you, you are still obtaining utility and value from purchasing deodorant. There's no morality in the "value" that is used in economics, no decision about whether a person "really" gets value out of an item or not. It is also a very cognitively tempting idea, that one can declare oneself the arbiter of what is "true value", but if you actually try to use it in the math the model completely fails to match reality. You may feel free to create your own such definition; I unashamedly have one myself, we all do, really. But it's not what economics use, because it doesn't produce useful results.


How do you distinguish between a "manufactured desire" and a real (/non-manufactured, whichever terminology you want to use) one?

If I saw a commercial for a pet rock, and decided that I wanted to buy one, what's to say that this desire is not real?


How do you distinguish "manufactured desire and the exploitation of people's addictions" and "genuine" or "natural" desires? Similarly, how do you distinguish "fake happiness where the person just thinks they're happy but isn't really happy" and "genuine" or "natural" happiness?


You expect to be better off after the exchange (which is precisely it happens). You can however regret your decision so ex ante and ex post have to be differentiated.


You can try to improve that model, but I would bet that you will get rising inequality as well, it will just be masked by the growth ad infinitum. And unlike in the Norvig's model, in your model the inequality will not be bounded.

Of course, in the real world, people need upkeep (which could be modeled as a fixed amount subtracting from their wealth over time). So not all transactions are net positive, because at some point you have no choice as to whether or not to buy food. Which would even exacerbate the effects of inequality for low income people.


There's a wide variety of economists. Speaking as someone with Master's degrees in Math & Economics, this sort of simulation is inadequate in many ways.

I was educated via the Neoclassical approach, where the macroeconomy is modeled through a microeconomic (individual) foundation. What's needed at least is a budget, a utility function (preference relations), and a transition function. The agent then is modeled through optimizing their utility against their budget constraint at each timestep, then the transition function gets applied. Lather, rinse, repeat.

This form the basis of a recursion model, the simplest one being the Solow model [1]. More details are available in Recursive Methods in Economic Dynamics by Stokey & Lucas [2]. Computer simulations are definitely used in cases where the models are mathematically intractable.

[1]: http://en.wikipedia.org/wiki/Solow_model [2]: http://www.amazon.com/Recursive-Methods-Economic-Dynamics-St...


The redistribution rules strike me as being closer to a simulation of games of chance, perhaps blackjack when played with good strategy. If you have a big bankroll to start with, you can afford to ride out the bumps in the road so you'll probably win eventually. If you have a small bankroll, you'll probably get wiped out by random chance pretty quickly.

But it doesn't seem to have much bearing on actual economics.


>>big bankroll...you can afford to ride out the bumps >>small bankroll...you'll probably get wiped out by random chance pretty quickly

>>doesn't seem to have much bearing on actual economics

Don't be too quick to assume that, I think your post actually contains everything you're looking for...


So if you randomly bump into someone on the street who has more money than you, you give them half of whatever you've got?

It's only a simulation insofar as people are governed by mindless rules and random chance, with no thought or planning involved. So it's a decent simulation of some people, but certainly not everyone.


As a model of economic institutions, it has what Joseph Heath of the University of Toronto has termed catallactic bias: gain from trade is explicitly modeled, but the four other mechanisms of cooperative benefit, economies of scale, risk pools, self binding and information transmission, are not recognized.

"...much of contemporary social contract theory has been marked by what might be referred to as a catallactic bias, which results from a tacit conceptual privileging of gains from trade as the primary mechanism of cooperative benefit. [1]"

[1] Joseph Heath. The Benefits of Cooperation. Philosophy & Public Affairs. Volume 34, Issue 4, pages 313–351, Fall 2006


One flaw with this model is that the value of money is not absolute, it is relative to the price of goods and services. Furthermore, the rate of circulation of money is directly related to the amount of economic activity taking place in the society (since each transaction represents an economic event), and economic activity creates wealth as PG says.

I once tried to develop a similar theory to the link, by applying the principles of statistical mechanics, and treating the rate of circulation of money as the temperature, and each actor's amount of economic activity as their kinetic energy. It seemed like a neat approach but it has it's flaws obviously.


Another is that there is no credit.


Lesson learnt from the comments: beware of modelling economics if you have a background in a hard science. As a profession, we are incredibly envious and defensive of our position as the quantitative social science.


Generally speaking, the problem with Economic models is that they are mathematical models of a particular economic theorem or 'identity', as economists sometimes prefer to call them. When you dig into the scientific basis for those theorems however, it's often lacking. So saying that this isn't an economic model is quite correct - but that's actually a good thing, not a bad one. Economic models by and large have no scientific validity.

Although this isn't that useful by itself, it's a very nice way to get some basic intuition about how money behaves as a unit of exchange, in a system with a constant money supply. The reason why some commentators think that this isn't a realistic simulation of our actual monetary system is that in the current system, the quantity of money is more or less continuously expanding. But that doesn't imply that more 'wealth' is being created, it just means that more tokens are being created.

The problem is though that as a result the unit of measurement (money) is also expanding, and so you have a monetary system that appears superficially to obey rules of 'growth' as measured in other fields, but in fact is based on something that is quite different, as these experiments show. And you have economists merrily chasing their tails for the last 3 centuries over trying to determine what causes 'growth', when actually it's an illusion of measurement created by the day to day operations of the fractional reserve banking system.


Except there really is 'growth'. We have computers and cars instead of papyri and horses.

Technological advancement, quality of life, etc..., IS growth...


Yes, exactly. But modern economics isn't actually measuring that, and I think is in a certain amount of denial about it occurring at all. Economic growth is growth in GDP. GDP is calculated as function of price, and although it's adjusted for inflation, the vagaries of the monetary system mean that inflation is a very poor proxy for the actual growth in the money supply. [Which btw. is well known within Economics - better known there as the mystery of the 'monetary policy transmission mechanism'].

Go back 150 years, and production was measured as production (tons of coal, etc. You can see this in historical records like the German Statistical Yearbook's from the 1870's.) Today's economists make measurements using money, and ignore the very real problems of money as a unit of measurement.

For example, take the quantity theory of money (and note the word theory there), MV = PQ. V - velocity of circulation of money cancels - this was pointed out in the 1930's, but for some reason has never made it into the textbooks. We're left with P(prices) ~ M (quantity of money)/Q (quantity of transactions.

Now if this equation is valid (and it is mainstream economic theory, although the presence of a cancelling issue probably isn't a good sign there), then we have an inverse relationship between the quantity of money in the system, and the quantity of transactions (i.e. production), indicating that actual economic growth in the sense you're using it would cause decreasing prices, if M is held constant.

OTH, if that equation is wrong, then how can we measure anything with money, since we don't know what the relationship is between production and prices?


If you want to understand the classic economic models you might find useful the python implementation I wrote a while ago of some of them. Inspired in Caltech's Principles of Economics for Scientists, they still lack supporting documentation, but I think they are good enough to play with and explore. https://github.com/juanre/econopy


Uhm, I see the problem here:

m = random.uniform(0, pot)

Once somebody wins a few games, he will fish "wealth" from a bigger and bigger pot, even if he plays against the poor. According to this, you just have to be rich to be even richer. However, your wealth per se doesn't affect your future wealth, this is clear, right?

Maybe this could be a poker game simulation. Certainly not an economics simulation.


"However, your wealth per se doesn't affect your future wealth, this is clear, right?"

No. Your current wealth is a very strong indicator of your future wealth, and indeed, your future income.


Actually, if a rich and a poor actor both compete for a pot, then the poor could take 80% and suddenly become the rich. This simulation doesn't track individuals, it only tracks the 1, 10, 25, 33, 50, 66, 75, 90, 99th percentiles after a number of simulations. The rich and poor are likely switching back and forth rapidly.


I tried creating economic models like this for a video game I was trying to make, but inevitably the market would end up oscillating too much or the whole thing would crash. The idea was to allow people to exploit arbitrage, but then as they did that, the market would become more efficient and the player would have to find some other commodity to arbitrage. I spent more hours than I care to mention and trying to take as many factors in as possible, but doing quasi-realistic simulations is just hard.

I think part of that is for reasons others have stated here, which is that there aren't a lot of people doing market simulation. Even the best simulations are going to be wrong, so what's the point.


Have you tried looking at how EVE Online does it? The idea you describe roughly matches my experience in it, though I was never a dedicated trader exploiting arbitrages. As a manufacturer, though, I'd often be able to ascribe price fluctuations to externalities like, "Alliance X just won a war in region Y and now they're consolidating their gains, resulting in purchases of lots of starbase construction materials, which I'm making." Or even simpler ones like "Corporation Z seems to have come back from hiatus."


The market would crash, you mean like how it happens in the real world all the time?


Could someone perhaps explain to me how the "random_split" results in wealth accumulation? From the description, I would expect it to have the opposite effect.

If two actors with initial values X and Y interact, their expected outcome would be (X+Y)/2, with expected change being (Y-X)/2 and (X-Y)/2 for the two actors. If X<Y, then (Y-X)/2>0, and so the person with less wealth expects to gain, and the person with more wealth expects to lose, for an overall smoothing effect.


First, accumulation would be the wrong way to think about it. Once the two agents are engaged in transaction, it doesn't matter which is which.

Let D be the difference in wealth post-transaction divided by the total. The expected value of D is 1/2. That means that we should expect that one agent will walk away with 75% of the pot and the other with 25%. Thus, although the expected outcome for an agent is 50% of the pot, we're still pretty much guaranteed to get very uneven splits.

Next, note that a person's wealth affects the payout of the next transaction. In other words, the person who takes 25% is almost guaranteed to be able to make less on the next transaction than the person who walked away with 75%. Suppose all our agents start out with 100, and that the 75%/25% splits are guaranteed. If each agent engages in exactly one transaction, then half our agents will have 50 and half will have 150. A 50's next transaction will either be (50, 50) or (50, 150). A 150's next interaction will either be (150, 50) or (150, 150). The expected outcome for (50, 50) is (25, 75). The expected outcome for (50, 150) is (50, 150). The expected outcome for (150, 150) is (225, 75). None of the expected outcomes even things up. It just gets more and more spread out.


I find that fascinating as well. A thorough probabilistic analysis could be fun, but I'm too tired for that right now.

One thing to keep in mind is that even supposedly uniform distributions can have outliers. For example, if you just throw N balls into N bins, there's going to be a bin with log N balls in it with high probability. Something similar is most likely going on here as well.

In a way, the really interesting question is whether the outcomes of that experiment are exponentially distributed. Then again, the simulation has basically nothing to do with real world wealth distribution anyway.


In physics, if you randomly divide a fixed amount of energy among n particles, you will obtain a boltzmann (exponential) distribution of particle energies, such that a small number of particles have very high energy and while many have only a little.

Similarly, if you randomly divide a fixed amount of wealth among n individuals, you end up with a boltzmann distribution of wealth, such that a small number if individuals have a lot of the wealth, while many have only a little.

The boltzmann distribution is the maximum entropy distribution, for fixed total energy or fixed total wealth.


I think it's worth pointing out the most politically salient missing feature.

All the people who are on the blue line have enough money to start changing the rules of the market. For example persuading government to grant them a special licence, or bail out their company or letting them bank offshore.

As this is HN I should point out that I don't think this is an argument for no government, just against political funding.


It would be interesting to simulate Free banking vs Central banks and the effect of different interest rates.


That would involve a much, much, much more complicated simulation than the one Peter Norvig is writing about.


Yes it would, though that kind of modelling is some orders of magnitude outside of the scope of the toy model in the article.


This is way to simple a model for that - it's a very nice toy model, which is useful to get a quick intuition, but you cannot just add pieces to it and hope to get meaningful results.


A colleague of mine is working on simulating the banking system according to the real Basel regulatory framework rules.

http://www.iiim.is/2012/10/threadneedle/


Such a simulation would reveal a lot about the creator's beliefs, and essentially nothing about reality.


Making the creator's beliefs (including hidden assumptions) completely clear is valuable all by itself. But in addition to revealing the creator's beliefs it also reveals arithmetic errors, which are quite common in poorly specified verbal models.

For an example of the latter, observe this HN thread: https://news.ycombinator.com/item?id=7042469


I'm surprised you didn't include a link to this thread, where I still owe you some work...

https://news.ycombinator.com/item?id=6725096


Yeah, but that's a discussion I didn't want to get into again. A simple, completely indisputable arithmetic error made the point better.



That's all any model used to construct a predictive simulation can do.


Nothing is more fun that listening to economists argue about economics. Programmers have nothing on them.


"For now we will only consider transactions that conserve wealth, so our transaction rules will decide how to split up the pot of X+Y total wealth."

Economics is not about redistribution of wealth, it is about human actions that generate -- or destroy -- wealth.

Wealth, in economics, is not a quantity of money, it is some set of valuable goods usable in producing other goods or to be consumed.

In fact, every voluntary transaction by definition creates wealth, because it brings the goods (being transacted) from an individual who values them less to an individual who values them more -- and vice-verse.


Surely that depends on your definition of voluntary, the value functions of the individuals involved, and the impact of any externalities.


I remember calculating an economic model with my Mum when she was doing her Masters. It was done by modelling the "world" in a large, fairly sparse matrix and performing particular transformations as per a defined algorithm. It basically collapsed the matrix into particular values to find what you were looking for.

The guys who came up with it (I think they were Australians) won a Nobel(?) prize for it, but I can't remember what the technique is called. Anyone know? I might be remembering it incorrectly however.


The other day I was wondering why we, as a population, keep arguing about what economic model would work the best? Don't we have computers that can run simulations and provide answers? Inputs could be population size, current wealth distribution, socialist/capitalist/hybrid, tax rate, cultural influence etc. We don't have to be accurate, just directionally correct. Why do we keep playing this game in the real world? Is it because we don't yet have information to model the engine?


It is not just that we don't have the information -- it is likely that it is _impossible to have the information_. The economy is not a machine, it is organic and self-modifying.

While there are reasonable arguments for free markets which are pure philosophy, from a pragmatic perspective free markets are good, because the the price is probably the most accurate and efficient information channel available to producers and consumers.


Simulations are a great way of telling yourself what you already believe to be true. Since you build your assumptions into the inputs and into the simulation, you really need significant external validation.


> Don't we have computers that can run simulations and provide answers? Inputs could be population size, current wealth distribution, socialist/capitalist/hybrid, tax rate, cultural influence etc. We don't have to be accurate, just directionally correct. Why do we keep playing this game in the real world? Is it because we don't yet have information to model the engine?

If you can figure out a good simulation model there will be someone willing to let you run it on a TOP500 supercomputer.

People already run these kinds of simulations, but the complexity is beyond the capability of today's computers. Not to mention all the random variables - wars, droughts, earthquakes, political change, technological improvements, etc..., which all affect economies.

And of course the information to model it is another problem, because much of it will have to be inferred - what's the probability of a war? What probable effect will technological advances have? Hows the weather going to be this summer? Will there be ice storms this winter?

People wonder why so many assumptions are made in economics - it's because some of the variables are simply too unpredictable.


> Don't we have computers that can run simulations and provide answers?

It's the old "garbage in / garbage out" problem. If you don't have a good model, you can only simulate a bad one. Also:

> We don't have to be accurate, just directionally correct.

If the model is not accurate, you can't ever falsify it, thus you can't improve it. That's one of the biggest flaws of current economics, their models are not accurate.


> That's one of the biggest flaws of current economics, their models are not accurate.

Some are more accurate than others. This isn't a flaw BTW, rather an indicator of how complex the problem really is.


> The other day I was wondering why we, as a population, keep arguing about what economic model would work the best? Don't we have computers that can run simulations and provide answers?

(1) Because "works the best" is a question of subjective value, not one of objective fact, so it cannot be answered factually, and (2) Because while computers can run simulations, that doesn't even help answer factual questions until you have both a reliable model to use in the simulation that covers the specific area of interest and a complete description of the model-relevant facts from the economic context in which the proposals is to be evaluated. Good luck with that when it comes to any significant question of economic policy.


How do you model free will?


Any way to see when this was created? Do these ipython notebooks log create/change events? Just curious to see if this was a recent creation or just a recent discovery...


At norvig.com/ipython where the file is hosted it says it's from 18-Apr-2013.


this is highly abstracted and missing the usual attempt to link psychology with economic behavior. that doesn't mean it isn't useful and interesting. at minimum this does a good job of showing what sort of results we might expect from policies w.r.t redistributive policy vs. deregulatory policy.


This shows how nice an Econometrics book made with IPython would be, something in the likes of https://github.com/CamDavidsonPilon/Probabilistic-Programmin...


Glad to see there's some interest in economic simulation on HN. I'd personally like to see some simulations done where economics is actually applicable, ie. scarce resources.


Is it possible to get a full list of all such notebooks by Norvig?


I'd like to see individuals split out. The variance in wealth for a particular individual over time is likely very high in these simulation--much higher than in reality.


This does not seem to take into account the fact that the bottom quartile start with horses and outhouses and end up with motorized vehicles and indoor plumbing.


Yeah, but that would have been true regardless of markets... look at the slavery, or stalin's five year plans...


Redistribution kills motivation, ergo diminishes prosperity.

How do you simulate motivation?


All wealth is redistributed at some point. Many people just want to redistribute it to their kids.

I'd be happy with a flat tax for all, as long as there's a significant death tax. Maybe cap inheritances to (average household income x average life expectancy) for each child. The rest would be distributed to everyone else, equally.


I think that, in this context, "wealth redistribution" refers to forced redistribution.


Redistribution kills motivation

I know that I stopped working as hard to gain more wealth the second my taxes went up.*

* Stated by no one ever.


Maybe an economic system that doesn't require redistribution of economic gains due to political pressure. And I'm not talking about political pressure from the poor. We all know who's been fighting the "class war" and only one side has all the tanks, jets and bombs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: