Simulated Economy Tutorial(jasonfantl.com) |
Simulated Economy Tutorial(jasonfantl.com) |
We should be able to have whole economy simulations give reasonable predictions in response to natural events and lever-pulling such as :
- higher progressive tax rates - central bank interest rate moves - local tariffs and sanctions - shipping blackades / blockages - regional war - extreme weather events - earthquake - regional epidemic - giving poor people cash grants - free higher education - science research grants - skilled immigration / emigration
But .. of course this would require something like a rich country providing grants to applied cross disciplinary research over many years.
It might even lead to insights that prevent semi-regular economic boom and bust cycles we experienced the past 100 years.
Many years ago when 'social graphs' were still a hot area to do research in I started building a simulation of the equivalent of a small medieval village.
What became quickly apparent is that you didn't just need interactions between any two individuals like classical social graphs talked about, but between any number of arbitrary groups of individuals. Otherwise something as simple as an extended family couldn't be modeled.
That meant that instead of being able to use a matrix as the fundamental data structure you'd need a tensor of rank N, where N is the number of people in the economy. Just to see how intractable this is if the village had 20 people in it with the traditional matrix approach you'd need 400 weights to model interactions. With the tensor approach you need ~1e+26.
In short: it's impossible to have fined grained simulations of complex societies. The best we can do is drastic over simplifications that give us _some_ predictive power.
A similar problem, n-body simulation*, has n² gravitational interactions. You will similarly hit a wall if you try to do it with a dense n² matrix. However, there's a hierarchical solution that takes advantage of the sparsity and exponential decay, and can solve it in (n log n) with an imperceptibly low loss of precision.
Social interactions are sparse, and group interactions can be optimized with clustering. Fine-grained simulation of the entire society is such a massive chaotic problem with so many variables, that some loss of precision from clustering is completely insignificant compared to the inevitable simplifications you'll have to make in the design of the model itself.
* I mean the naive one with a fixed timestemp, not trying to solve chaos.
Generally agent based models have numerous parameters which can take many values (endowments, preferences) and the models don’t themselves give any guidance about how to set the parameters. Theory can give limited guidance (eg., that function is concave, this parameter is negative). Sometimes we have experimental data though its generalizability beyond the lab is uncertain.
What you want to do to create a scientific macroeconomics is to work backwards from the data you see in the economy (aggregate consumption, investment, etc.) and how you know the aggregates were generated (via the behavior of a lot of individual agents), and an equilibrium assumption to recover the parameters.
If you know the parameters of the model you assume, you can then simulate interesting counterfactuals. (And yes you assume the model - a “full” model including “all” of the individual endowments and parameters you can think of is completely intractable. You have to simplify.)
You’ll never get that out of the author’s computer game.
If you want references to the macro literature it’s enormous and I can provide them.
That parts makes no sense though, there isn't an equilibrium and can never be, economies are a chaotic system. One of the key problems of economic modeling is that they used mathematical tool that aren't suited for that.
You can't consider an economy as a steam engine. Walras was a trained engineer in the 19th century so I can excuse him for making this approximation, but I can't excuse anyone still following his course more than a century later.
None of them are perfect.
And they never will be.
Could the be better? Yes.
The problem is, you won't really know they're better until post-ex. And even then, you'll never be sure how much better. They're always bound to fail catastrophically at some point. Etc.
We used to, that's what “macro” economics was about. The models where crude but they did the job for a while, we used them for more than 30 years between the 40s and the late 70s, with great success (no economic crisis for the longest time since the industrial revolution).
But they conflicted with the idea that economist made of their job, as these models didn't include any if the classical economics credo that economists had been worshipping for almost two centuries (markets, competition, scarcity, supply and demand, etc.). So people started building “micro-founded” macro models, that tried to reconcile the empirical models that worked with the ideological principles of classical economics. But you can't have good models if you design them to match an ideological paradigm.
And then as you said, it failed catastrophically: the oil shock came, and suddenly the forecasts of the models became useless for a while. At that very moment, everyone who opposed to using models to justify state intervention where thrilled, and the era of short-terms economic engineering based on models was dead.
Some problems are too sensible to initial variables and solutions are not prescriptive like regular physics - meaning that variability at the 20th decimal in your initial variables will induce massive output differences. Lorentz discovery of this is interesting as he was working on weather modelling, it's a clear example of the issues with chaotic systems. He was running simulations of weather systems with multiple fixed initial variables (temperature, wind speed, etc) and seeing how the system progressed over a few hours. He realised that after a typo on a very far away decimal on a single parameter, the system was modelling the complete opposite of what we had seen in the previous test (think it was forecasting a typhoon when it used to say sunny day), even while using values that would be "equal" with relation to the precision of the measuring equipement. And that's nothing to talk about getting clean, precise enough data for such models, which is practically impossible (see the observer effect, between other causes). Garbage in, garbage out.
All this to say that problems in this sphere are characterized by quickly becoming untractable and impossible to model precisely how they evolve over time.
I can recommend James Gleick's Chaos: Making a new science for a overview for the layperson.
Thanks to the pioneering work done by physicists, we realized we could simulate dimension reduced versions of reality instead. We call them statistics and differential equations :)
Stack enough of them together, you get something called "deep learning". Large scale national lab supercomputer type numerical simulations are for your grandparents (these days you can probably take shortcuts and simulate that sort of born secret computations in a neural net that is much more compute efficient than the typical supercomputer).
Weather models are good because if we know about it the weather doesn't care and doesn't change what it is going to do.
Anyone who has an accurate financial model is keeping it to themselves.
Anyone who has an accurate financial model and make it public... invalidates their model as everyone takes that information and plans to take advantage of it accordingly.
Its mindless garbage like this that fuels the waste, and other great delusions held by the public today.
Value is Subjective. That means it changes for each person, in each circumstance.
Ordinals != Math. They are inequalities at best. You can never prove X = Y with just X < Y.
Computation, absent a few niche areas require problems to be formulated deterministically. That means a unique set of inputs, and a unique set of outputs. If you get an input that has two hidden underlying states, this fails.
The environment of this problem domain is a stochastic environment, that means chaotic; mathematically.
It cannot be measured in any detail except in retrospect as a lagging indicator, and it neglects psychological aspects, and the resulting dynamics that prey on people when money printing is used (i.e. fiat currency).
> Of course this would require something like a rich country providing grants ....
There is no amount of grant money in the world that can do what you claim, it matters not that it is 1 year, 10, or even given over 1000 years. The underlying laws don't change.
The economic boom bust cycle causes are well known and documented in banking. People just don't want to listen to experts, and evil bankers have a vested interest in discrediting those that would speak out.
Being complacent, mistaking your average dunning kruger for an expert in an echo chamber, that's the level of thinking today for the vast majority of people, and I don't see this post as being any different. Three books is all you'd need to read to know about all of this.
The bust part of the cycle is the objective shortfall between productive labor and unproductive labor as losses get marked down. In other words if you loan out money to people whose intention and ability are not production, but instead fraud or other snake oil, then you have these happen. What goes up, must come down.
Inflating the currency with an exponential amount of money printed calling it liquidity, will stave off the issue for another 8-10 years or so, with diminishing returns each time and there is a hard limit based in the fundamental requirements for an economy to operate, going back to 1776 Wealth of Nations.
Producers must make a profit to continue operating. Labor providers must be paid sufficiently to support their needs, and the needs of a Wife, and 3 children; sufficient for 1 to live to have children themselves.
The latter is dependent on the former. The money spent by each party travels in a circle unless something breaks that balance. If that happens it stalls, money loses its fundamental properties (when its fiat), and with population above a certain scale you may get socio-economic collapse, which is a slow circling the drain chaotically.
Prior to the 1970s the gold and precious metals safeguarded society from going off the rails in giving money to people who instead of producing something just enriched themselves. Every time fiat was tried, by either fractional reserve with poor regulation, or no fractional reserve at all (as we have a/o 2020), it has failed. Coolidge walking back banking, and not bailing the banks out is what led to the Great Depression.
Productive activity fell because farmers couldn't plant their crops because loans weren't available; the rural banks overextended themselves and went bottom up. It contagioned all the way culiminating the the Wall Street crash, and the socialism that followed only made it worse.
Today the GSIBs are in the same situation, with no one to bail them out.
I'd highly suggest you actually do something about correcting the shortfall in education, much of this you should know by middle school if you received a proper education.
https://en.m.wikipedia.org/wiki/Phillips_Machine
Short clip: https://youtu.be/beuseJ0Wm3M
Detailed demo: https://youtu.be/gkNaZJmii28
https://www.amazon.com/Making-Sense-Chaos-author/dp/02412019...
For even a simple economy, I think you'd need to simulate money directly, and include the notions of rent and work.
Having futzed with bartering in diablo (and non-fiat trading denominated in items of stable value), I quickly came to appreciate fiat currency. Being able to combine two “half trades” into an equivalent barter exchange is vastly easier.
At one point I was able to trade some of the forum gold I accumulated from diablo 2 for a “perfect IV foreign Ditto” for shiny pokemon breeding.
Looks like bot runners where the one the most in need of a currency to make trades more efficient.
It's only fun to make money on say world of warcraft because most people aren't also doing that. (but instead buy your goods and use them for something essentially unproductive in economy-terms) Even then it can feel pretty stupid given the amount of arbitrage bots people have set up, you have to focus on very niche opportunities or oversights by those arbitrage bots. Kinda like the real economy
This paper from one of the field's pioneers is a nice introductory overview of the space from an academic perspective: https://faculty.sites.iastate.edu/tesfatsi/archive/tesfatsi/...
Want to hear some of the behind-the-scenes stories. What was the initial scope and how did you break down the whole project? As it's very hard to wrap around the whole thing at once.
I like the idea conceptually, but it doesn't seem to be good enough to halt economic disasters (or correction as we like to call them nowadays).
Agent based models have been around since the 1980’s at least. No one uses them in central banks, no one uses them in industry, and you can be very confident that they’ve tried.
This is quite common across the sciences. Some technique doesn't seem to work because of missing crucial insights or technology. Then somebody fills the gaps, and the technique works.
These types of models in economics might or might not become viable at some point.
What if you don't care about tuning against a real macro-economy? What if the economy being fictional was the entire point?
Let's suppose you wanted to make a game that simulates a realistic economy as a gameplay element no different from say a physics engine. Why wouldn't you do it using agent based modeling? What you're saying sounds purely dogmatic now. It's more about thought termination than actually accomplishing something. After all, central banks and businesses don't give a damn that agent X did action Y at time Z for all agents, actions and times. Meanwhile in a game? It's actually essential, because the model is the reality inside that fictional world. The model is "perfect".
https://www.centralbanking.com/central-banks/economics/macro...
https://www.bankofengland.co.uk/working-paper/2025/agent-bas...
Micro-founded macro economics models (say DSGE) are much easier to tune based on available historical data so they are much preferred, and nobody seams to care that they have the same predicting power as astrology.
This has proven out in the acceleration of actual weather prediction using AI which means it can be feasibly run on a single desktop machine.
I think its not a stretch to imagine that a) there is a way to simulate the whole economy at the same level of quality as a weather or climate simulation b) AI can accelerate the computations to the point they can run on accessible hardware.
We need this whole economy simulation ... to answer practical questions such as - if we dole out UBI to everyone to cover basic living costs, will that simply result in the cost of rent going up to absorb the whole amount ?
Even statistics is fully thrown out with the islands of regularity.
The stochastic nature, lack of measure-ability, and multiple hidden underlying states (value is subjective) require any model to solve chaos somehow.
https://science.ku.dk/english/press/news/2024/islands-of-reg...
The use of a dense matrix is the traditional way of solving the problem. The issue is that it solves the wrong problem. You need a dense tensor which requires more storage than the world currently has for an economy of 20 people.
Social interactions are sparse until they aren't. If you think otherwise try to estimate what every Europeans interaction with Gavrilo Princip was on 27 June 1914 vs 28 June 1914.
As for gravitation: I'm very happy for the planets and asteroids out there. Unfortunately the economy isn't a solar system.
"How will humans (in aggregate) behave under novel conditions?"
Models tend to behave poorly when asked about things outside their training distribution.
For that to be true, rent-seeking would have to literally capture all surplus. In which case UBI wouldn’t be an option in the first place.
The marginal increase in the purchasing power of someone who went from having $0 to $n would always be greater than the increase in purchasing power for someone who went from $1 billion to $1 billion + n - even with inflation.
Also: from your comment I’m pretty sure you don’t have the background (correct me if that’s wrong) and so don’t know what it really means in practice to make an equilibrium assumption in a macro model: Markets clear, on average people have reasonable beliefs about the evolution of aggregate variables, firms maximize expected profits. That’s all pretty harmless.
I definitely don’t agree that we are “using mathematical tools which aren’t suited for that.” We aren’t treating the economy “like a steam engine.” The entire revolution in macro from the 1970’s on involves optimizing agents. There is no useful analogy to a steam engine.
I suspect you have been reading criticism by people who are misinformed about what macro actually is and how it is practiced.
So is a weather forecast that says “the weather will be sunny tomorrow” in Miami. True most of the time yet utterly meaningless.
> Also: from your comment I’m pretty sure you don’t have the background (correct me if that’s wrong)
I have to admit my DSGE class was more than 10 years ago at this point, but I still vividly remember the hypothesis being hilarious (spherical cow in vacuum−level) even though now I would need to spend a bit of time digging into it to be able to write down why exactly.
Ljungqvist and Sargent is a standard grad level text.
Acemoglu has one with a growth focus.
Miao is another one.
Stachurski and Sargent is one focused on computational issues.
Stokey Lucas and Prescott is the math but I would skip that.
Dejong and Dave covers macroeconometrics.
We can write a very accurate quantum mechanical model for the oxygen atom. But you can't actually simulate it without a galaxy sized classical computer. But it is very realistic=accurate model.
Or you can write and easily simulate a non-realistic semiclassical model. This one is a realistic=efficiently simulatable model.
Obviously a fully agent made model is more realistic in the "accurate" sense, because it correctly models the underlying reality. But if you make realistic agents, you have something inefficient (non realistic in the "simulatable" sense).
That’s a totally different class of model to this agent based approach. People in the (small) agent based modeling community have been pushing their stuff for decades to no effect.
Sure it’s possible that there’s some amazing advance I can’t see coming in the future but as of now I would not recommend anyone pursue ABM.
Current macro-economics models are arguably not much better than a broken clock in terms of predicting power.
The issue is that while you can remove pretty much all possible interactions for a specific case you have no idea where an interaction could pop up unexpectedly with a huge impact ahead of time.
For the medieval theme the leader of the village may be a cousin of the king which is a very distant but very strong interaction.