11 ms·
Economics Simulation
- kfk 13y agoUhm, 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.
- yen223 13y ago"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.
- DiggityDug7 13y agoActually, 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.
- breischl 13y agoThe 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.
- wavefunction 13y ago>>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...
- breischl 13y agoSo 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.
- acd 13y agoIt would be interesting to simulate Free banking vs Central banks and the effect of different interest rates.
- gjm11 13y agoThat would involve a much, much, much more complicated simulation than the one Peter Norvig is writing about.
- nhaehnle 13y agoYes it would, though that kind of modelling is some orders of magnitude outside of the scope of the toy model in the article.
- Fede_V 13y agoThis 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.
- hbags 13y agoSuch a simulation would reveal a lot about the creator's beliefs, and essentially nothing about reality.
- aet 13y agoYou may find this interesting: http://www2.econ.iastate.edu/tesfatsi/WhyEconomistsShunSimulation.Lehtinen2008.pdf http://www2.econ.iastate.edu/tesfatsi/WhyEconomistsShunSimul...
- yummyfajitas 13y agoMaking 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 https://news.ycombinator.com/item?id=7042469
- patrickmay 13y agoIt'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.
- DigitalJack 13y agoI'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.
- flatline 13y ago> 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.
- Symmetry 13y agoWell, 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.
- JackFr 13y agoFor a very rigorous yet still accessible understanding try Debreu's Theory of Value: http://cowles.econ.yale.edu/P/cm/m17/m17-all.pdf http://cowles.econ.yale.edu/P/cm/m17/m17-all.pdf
- 13y ago
- vetleen 13y agoThis 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.
- capisce 13y agoHow does buying a can of pringles or a pack of cigarettes create wealth for the buyer?
- juanre 13y agoEconomists 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.
- capisce 13y ago> 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.
- CompelTechnic 13y agoHow 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?
- mwexler 13y agoAny 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...
- some_pythonista 13y agoAt norvig.com/ipython where the file is hosted it says it's from 18-Apr-2013.
- calhoun137 13y agoOne 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.
- kaonashi 13y agoAnother is that there is no credit.
- jimmytidey 13y agoI 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.
- josephlord 13y agoIf 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/ http://www.debtdeflation.com/blogs/minsky/ [2] http://sourceforge.net/p/minsky/home/Home/ http://sourceforge.net/p/minsky/home/Home/ [3] http://www.debtdeflation.com/blogs/2013/09/10/famous-models-of-chaos-in-minsky/ http://www.debtdeflation.com/blogs/2013/09/10/famous-models-...
- photon137 13y agoTom 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/ http://quant-econ.net/
- JackFr 13y agoThis 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.
- aet 13y agohttp://www2.econ.iastate.edu/tesfatsi/WhyEconomistsShunSimulation.Lehtinen2008.pdf http://www2.econ.iastate.edu/tesfatsi/WhyEconomistsShunSimul...
- Fomite 13y agoAs someone who works with simulation models for a living, this was a fascinating read. Thanks for linking it.
- arethuza 13y agoI'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.
- Fomite 13y agoDisclaimer: 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.
- Eleutheria 13y agoRedistribution kills motivation, ergo diminishes prosperity. How do you simulate motivation?
- wavefunction 13y agoMaybe 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.
- ap22213 13y agoAll 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.
- baddox 13y agoI think that, in this context, "wealth redistribution" refers to forced redistribution.
- Aloisius 13y agoRedistribution 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.
- juanre 13y agoIf 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 https://github.com/juanre/econopy
- ChristianMarks 13y agoAs 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
- metaphorm 13y agothis 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.
- plumeria 13y agoThis shows how nice an Econometrics book made with IPython would be, something in the likes of https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers https://github.com/CamDavidsonPilon/Probabilistic-Programmin...
- GhotiFish 13y agoGlad 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.
- vbs_redlof 13y agoLesson 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.
- jackym 13y agoGenerally 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.
- Mikeb85 13y agoExcept there really is 'growth'. We have computers and cars instead of papyri and horses. Technological advancement, quality of life, etc..., IS growth...
- jackym 13y agoYes, 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?
- WWKong 13y agoThe 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?
- marcosdumay 13y ago> 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.
- Mikeb85 13y ago> 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.
- Tycho 13y agoHow do you model free will?
- JackFr 13y agoIt 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.
- mcguire 13y ago
- porter 13y agoThis 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.
- mempko 13y agoYeah, but that would have been true regardless of markets... look at the slavery, or stalin's five year plans...
- 11001 13y agoIs it possible to get a full list of all such notebooks by Norvig?
- DArcMattr 13y agoThere'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 http://en.wikipedia.org/wiki/Solow_model [2]: http://www.amazon.com/Recursive-Methods-Economic-Dynamics-Stokey/dp/book-citations/0674750969 http://www.amazon.com/Recursive-Methods-Economic-Dynamics-St...
- fiatjaf 13y ago"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.
- nopassrecover 13y agoSurely that depends on your definition of voluntary, the value functions of the individuals involved, and the impact of any externalities.
- coldcode 13y agoNothing is more fun that listening to economists argue about economics. Programmers have nothing on them.
- Patrick_Devine 13y agoI 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.
- saraid216 13y agoHave 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."
- mempko 13y agoThe market would crash, you mean like how it happens in the real world all the time?
- MereInterest 13y agoCould 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.
- qiemem 13y agoFirst, 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.
- nhaehnle 13y agoI 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.
- codex 13y agoI'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.
- girvo 13y agoI 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.