Declared share d; believed audit chance p̂; moral cost m.
Computational Approaches to the Non-Observed EconomySpace and systems
Module 7Simulating the hidden economy
An agent-based model is an executable theory: agents with states, information, actions and rules, meeting each other under institutions, with totals computed afterwards. We design one from a question, compare decision rules (beliefs, noisy choice, thresholds, communication, learning), and build Saltmarsh, an invented town of 400 firms where hiding emerges unasked and feedback through revenue, services and trust makes a recession leave a mark and history matter. Then we connect levels, calibrate honestly when many settings fit one history, and use learning and language-model agents with validators and logs.
Key ideas, one per video
- Video 14Beliefs, not true audit rates, drive choices (30% hidden when firms know the rate, 36% or 20% when they believe otherwise). Complex contagion reached everyone on a clustered network and 1% on a random one; learning firms hid 28%, not the textbook 69%.
- Video 15A recession left hiding about a point higher two years after demand returned. At a 6% audit rate, a town that started with hiding common ended at 38% against 29%. Two calibrations with the same average disagreed completely about targeted audits.
- Video 16Adding the honest share as a second target left one setting. Risk-score audits recovered most per audit (0.28) but left more hiding (35% against 30% at random). The peer version fit the past better and forecast worse; repeating last year's benchmark was off by 0.4.
Book: Chapter 7 of Computational Approaches to the Non-Observed Economy: From Theory to Practice (coming soon). The videos and slides follow the chapter’s topics in our own words, figures and simulations; the towns and countries are invented, and nothing is copied from the book.
Watch
3 videos for this module, each about 8 to 11 minutes. Pick one from the list, and open the transcript to read along: each timestamp plays the video from there. The narration is generated with a voice clone of Teddy, used with his permission.
Video 14 · 8:12
An executable theory
A thousand invented traders, the same average threshold: a narrow spread keeps hidden trade at 2%, a slightly wider one takes it to everyone.
Beliefs, not true audit rates, drive choices (30% hidden when firms know the rate, 36% or 20% when they believe otherwise). Complex contagion reached everyone on a clustered network and 1% on a random one; learning firms hid 28%, not the textbook 69%.
TranscriptVideo 14
Same people, opposite outcomes. A thousand invented traders. Nobody is told to hide anything. Each one simply watches the others, and joins in once enough of them do. Give them thresholds that vary a little, and hidden trade never takes off. It stays with the two percent who started it. Make the thresholds vary a bit more, with the same average, and everyone ends up joining. Same people on average, opposite outcomes. To see effects like this, you have to let agents act and interact. That's agent-based simulation.
Three steps. Welcome to Module 7: simulating the hidden economy. I'm Teddy. In this video we'll build the idea of an agent-based model, design one from a question, and look at the rules agents use to decide: alone, in groups, and by learning.
What an agent-based model is. An agent-based simulation is an executable theory. Every agent has a state, information, a set of possible actions, and a rule for choosing among them. Agents can be people, households, firms, banks, platforms, or a tax office. They don't have to be identical. Differences are represented directly, not averaged away. Institutions decide which deals are allowed, taxed, reported, or visible. Totals like output or the hidden share are computed only after the agents have acted. The cycle repeats: agents observe, decide, interact, and the world updates. Whether everyone acts at once, or one after another, is part of the model, not a coding detail. Annual tax declarations fit agents acting together, once a year. Word of mouth and inspections fit agents acting one after another, each seeing what came before. How is this different from other tools? A microsimulation applies estimated transitions to individual records, usually without interaction. A system-dynamics model tracks aggregate stocks and flows. A game focuses on payoffs and equilibrium. An agent-based model can borrow from all three. Its defining feature is that heterogeneous agents and their interactions are actually executed. For the hidden economy, the key unit is often the transaction: its true value, its declared value, how it was paid, and whether the authority can see it. That separates breaking a rule from being unseen. A legal sale can be missing from statistics. A caught evasion is no longer hidden.
Start from a question. Start from a question, not from software. Does a higher audit rate reduce under-reporting? That needs a small population and a simple reporting rule. Does platform reporting change informal work, firm entry and revenue? That needs workers, firms, a platform, transactions, and feedback over time. Then make the design decisions in order: outputs, agents, states, information, actions, rules, interactions, institutions and observation, the evidence for calibration, and the experiments. Keep only the differences that matter for the mechanism. If income and tax morale drive reporting, let them vary. Don't simulate eye colour because a generator can. Begin with the smallest model that can answer the question, test it, and add a mechanism only when you can show it's missing. And describe it so others can rebuild it: who the agents are, what they know, what they can do, why they choose, who they meet, and how outcomes are measured.
Deciding alone. Now the decision rules. The classic starting point is expected utility: weigh the tax saved against the expected penalty, the moral cost, and the social cost. In our setup, the tax is 25 percent and the penalty adds 50 percent of the hidden amount. With no moral cost, hiding pays unless the audit chance is above one in three. But agents act on what they believe, not on the true rate. We gave 2,000 firms different moral costs and a true audit chance of 4 percent. If they know the true rate, they hide 30 percent of their income. If they believe it's 1 percent, they hide 36. After a visible campaign, believing it's 10 percent, they hide 20. People also have limited time and attention. They satisfice, use rules of thumb, or choose noisily, picking better options more often but not always. A noisy choice rule has a consistency parameter. In our firms, a perfectly consistent rule leads 36 percent to hide. As choices get noisier, that share drifts toward half. Noise can stand for real experimentation. It shouldn't hide a missing mechanism. Vary it, and check that conclusions don't depend on implausibly frequent mistakes. Choices under risk can also lean on a reference point. A penalty can feel like losing money already in hand, and a small audit chance can feel bigger or smaller than it is.
Thresholds and contagion. Decisions are made in groups. Peers carry information about audits, set norms, and make some actions easier. Invoice-free trade is easier when your suppliers already accept it. A threshold rule captures this. Each agent joins once the share of others doing it passes their personal threshold. Our thousand traders have thresholds averaging 30 percent, and two percent start. With a narrow spread, hidden trade stays at two percent. With a slightly wider spread, it reaches everyone. Here's the starkest version. A hundred agents with thresholds zero, one percent, two percent, and so on. Each one's joining triggers the next, and everyone joins. Change one agent's threshold from one percent to two, and the chain stops at the first person. Some behaviour needs reinforcement from several contacts. If a trader joins only after two neighbours have, it spread to everyone on a clustered network, and to about one percent on a random one. Simple contagion, needing just one contact, spread everywhere on both. So the network's shape matters, and so does the rule.
The communication rule. Beliefs spread too. Suppose 200 agents each hold a view on how acceptable undeclared work is, and they talk. Same starting views, three communication rules. With open averaging among neighbours, everyone converges to one shared view. If agents only listen to people who already think alike, the population splits into four separate camps. If one agent in ten never changes their mind, agreement never arrives. Views stay spread out for good. Agents learn from peers is not a model. The communication rule is the model.
Learning. Finally, learning. A simple learner keeps a value for each action and nudges it after every outcome. Hide and escape, and hiding looks better. Get caught, and it looks worse. With a 5 percent audit chance, the textbook answer says about 69 percent of our firms should hide. After thirty years of quarterly learning, 28 percent do. Learning is slow, and it depends on luck. Among firms with similar moral costs, every one that was never caught ended up hiding. Of those caught early, only about four in ten did. Evolutionary rules work one level up. Strategies that do well get copied, weak ones disappear, and mutation keeps adding new ones. A learned policy isn't free of assumptions. The reward, the actions, the exploration and the training world all encode a theory.
Recap. Let's recap. An agent-based model is an executable theory: agents, information, actions, rules, interactions and institutions. Start from a question, keep only the differences that matter, and describe the model so it can be rebuilt. Beliefs differ from the truth, choices are noisy, thresholds create cascades, communication rules shape consensus, and learning depends on rewards and luck. In the lab, you'll set thresholds, networks and communication rules, and watch hidden trade spread or stall. Next video: from many small decisions to a whole economy, and the feedback that ties them together.
Saltmarsh. This is Saltmarsh, an invented town of 400 firms and 2,000 households. We told nobody to hide. Each firm decides how much of its cash sales to declare. Card sales are always recorded. Hiding emerges anyway: about 31 percent of output goes unrecorded. And it's not spread evenly. Almost a quarter of the firms hide nothing at all, while one tenth of the firms account for over a third of the hidden sales. This video goes from small decisions to a whole economy, and follows the feedback that ties them together.
Three steps. Welcome back to Module 7. This is video two: from micro to macro. We'll look at the actors of a micro model, build Saltmarsh, and then watch what happens in a recession, under different audit rates, and after a reform.
The actors of a micro model. Start with households. A worker's choice depends on opportunity, not only taste. If everyone could take a good formal job and some refuse, the model confuses informality with preference. So job offers, skills, registration costs and family needs should limit what an agent can choose. Informal work can be survival, a side income, an entrepreneur's choice, or the employer's condition. Customers matter too. Some value a receipt or a warranty. Others prefer a discount. Model only the seller, and you miss the bargain that keeps hidden sales alive. Firms need a balance sheet: cash in from sales, cash out for wages, costs, taxes and penalties. Without it, a strategy can look attractive only because a cost was forgotten. A sale can be settled in two steps: first the economic terms, then the reporting terms. Is there an invoice, how much is declared, and through which channel? Who meets whom is a choice too. Random matching suits anonymous markets. Search lets buyers compare prices. Networks capture repeat relationships and trust. A platform can rank sellers, charge fees, and report sales. Tax-compliance simulations have a long history. They show that audits, memories of past audits, public goods and imitation can create lasting groups with very different reporting habits.
How the town works. Here's how Saltmarsh works. Every quarter, households buy from firms. A firm that sells without receipts can offer a discount, which attracts some customers. Each firm chooses how much cash revenue to declare. It weighs the tax, its perceived audit risk and the penalty, a moral cost, and what its peers are doing. Perceived risk rises after the firm's own audit, or after audits it sees in its group, and then fades. The moral cost grows with trust. Trust follows public services, and services are paid for by the revenue the town actually collects. The tax office sees what's declared, plus whatever its audits catch. We see everything, because the town is invented.
A pattern nobody typed in. Run it, and a pattern emerges that we never typed in. About 23 percent of firms declare everything. Most of the others hide more than a quarter of their sales. And 37 percent of all hidden sales come from firms that declare most of what they sell. A model that splits the town into a formal sector and an informal one would call those firms formal, and miss more than a third of the hiding. The line between seen and unseen runs through the same firm, sometimes through the same day's sales. There are three common ways to represent the sectors: fixed groups, groups that agents can switch between, or individual transactions. Only the last can show one firm reporting some sales and hiding others.
A recession and the feedback loop. Now the micro-macro loop. Hidden sales lower revenue. Lower revenue means weaker services. Weaker services lower trust, and lower trust makes hiding cheaper. Let's hit Saltmarsh with a recession. Demand drops by 15 percent for two years, and some workers lose their jobs and sell side services off the books. By the end of the recession, the hidden share is about three points above the path without one. Trust has fallen, and it recovers slowly. Two years after demand comes back, hiding is still about a point higher. The shock was temporary. Part of its effect wasn't. One more lesson from the same run. Revenue fell by 17 percent, while activity fell by 13. A drop in revenue isn't a measure of evasion. Keep true, declared and detected activity separate. Bigger macro models add banks, credit, prices, investment and a full government budget. The discipline stays the same: totals come from agents, and every flow has to balance.
When history matters. Feedback can also create tipping points. We ran Saltmarsh at many audit rates, starting once from a town where hiding is common, and once from a town where it's rare. At low audit rates, both towns end up in the same place. But in the middle, history matters. At a 6 percent audit rate, the town that started high hides 38 percent. The one that started low hides 29. At 10 percent, it's 17 against 10. Once hiding is normal, it takes more enforcement to undo it than it took to prevent it. That's why transition paths matter, not just end points. A reform can look weak for years, and then tip. Shocks and policies also differ in one way agents care about. They can prepare for an announced reform. They can't prepare for a surprise.
A reform, and two towns with one average. Now a reform. From quarter twenty, the largest quarter of firms must issue e-invoices, so every sale they make is recorded. A good experiment states the baseline, when the intervention starts, what it's compared with, the horizon, and how many random runs were averaged. We averaged several random towns for every scenario. The hidden share falls from 31 percent to 12. And the small firms, which were not reformed, hide less too: 23 percent of their sales instead of 37. Why? Their peers stopped hiding, and higher revenue raised trust. Turn those channels off, leaving only customers chasing discounts, and the small firms barely change. About one percent of the removed hidden sales moved to them. So the answer to reduce or displace depends on which mechanisms the model contains. That's a reason to test each mechanism against evidence. Here's a sharper warning. We calibrated two versions of Saltmarsh to the same average, both about 30 percent hidden. In one, moral costs are similar across firms. In the other, they vary a lot. Then we pointed every audit at the riskiest firms. In the first town, hiding collapsed to about two percent. In the second, it didn't fall at all. Validate at several levels. Check individual decisions, the spread of hidden shares, the networks and the totals. Then check how the model reacts to past shocks. Last, test it on policies that weren't used for calibration. Matching an average is not validation. Each mechanism needs evidence at the level where it works.
Recap. Let's recap. Micro models need constrained choices, both sides of every sale, and balance sheets. Totals are computed from agents. Feedback through revenue, services and trust can make a temporary shock leave a lasting mark, and can make history matter. Policy answers depend on the mechanisms included, and two models with the same average can disagree completely. Two habits carry over to any model. First, keep true, declared and detected activity apart. A fall in revenue isn't a measure of evasion. Second, watch the path, not only the end point. Once hiding is normal, undoing it takes more enforcement than preventing it did, and a reform can look weak for years before it tips. In the lab, you'll run your own town, hit it with a recession, and try to tip it back. Next video: models across levels, agents that learn or talk, and calibrating a model to data.
Many settings, one history. We tried 256 different settings of Saltmarsh, our invented town. Five of them reproduce its hidden share to within two points. Same history, five models. Now double the audit rate. One model says hiding falls by 20 points. Another says by 26. Fitting the past doesn't pick one model. This video is about building models across levels, giving agents more flexible minds, and calibrating them honestly.
Three parts. Welcome back to Module 7. This is the last video of the module: multi-resolution models, learning and language-model agents, and a calibrated example.
Multi-resolution models. Economies are nested. Individuals sit in households and firms, which sit in sectors and regions, which sit inside national institutions. A multi-resolution model connects these levels without forcing one formalism on all of them. Individuals can be agents, supply chains a graph, sector demand an equation, and the government an optimiser. The feedback crosses levels. Individual hiding changes revenue. Revenue changes services and enforcement. Institutions change trust, and trust changes individual hiding. A hybrid is right when one mechanism needs individuals and another is fine as a total. Firms can be agents choosing how to report, while inflation arrives from an outside series and public services follow a budget equation. The interfaces must be explicit. If an unemployment rate affects workers, say when it's computed and who sees it. If a learned model predicts defaults, keep its output inside the firm's balance sheet. A tidy design has four layers: agents, interactions, institutions with observation, and analytics for calibration and prediction. Test each layer alone before joining them, and never count the same outcome twice.
Calibration across levels. Calibration can work bottom-up, from household, firm, audit or survey data. Top-down, from totals like output, revenue and a benchmark of the hidden share. Or both. Joint calibration needs weights for each target, and those weights are a choice. Put everything on the national total, and you can get a model that fits it with absurd agents. Back to our 256 settings. We varied two things: how strong moral costs are, and how much firms copy their peers. The five that fit the hidden share disagree about the town underneath. In one, 24 percent of firms are fully honest. In another, 38. One town has strong morals and heavy copying. Another has weak morals and little copying. Both produce the same total, so the total can't tell them apart. Add a second target, the share of fully honest firms, and only one setting is left. Distributions are evidence too. When data can't decide, report the whole set of acceptable models. Here, all five agree that more audits cut hiding sharply. They disagree on how much. That's the honest finding.
A learning auditor. Next, agents that learn. Instead of a fixed rule, a policy is updated from experience. What it learns depends on what it's rewarded for. Think of a learning tax office in Saltmarsh, choosing how to pick firms for audit. We compared three ways: at random, by a risk score from each firm's cash share, or by revisiting firms caught before. Per audit, the risk score recovers the most: about 0.28 units. Random audits recover 0.24. A learner rewarded for recovered tax per audit would choose the risk score. But in the long run, the town hides 35 percent under risk-based audits, against 30 under random ones. Random audits reach everyone's expectations, and total revenue ends up higher. Revisiting known evaders did worst on both counts: 0.17 per audit, and 39 percent hidden. And when everyone learns at once, firms adapting to the office and the office to the firms, the world keeps moving. Test learned policies outside the conditions they were trained in, and against simple rules. The lesson isn't that learning is bad. The reward has to measure what you actually want, over the horizon you care about.
Language-model agents. Large language models open another option: agents that read situations in words, remember stories, talk to each other, and choose with context. A language-model agent has a persona, a memory, a structured observation, a prompt, a list of permitted actions, and a validator. They can play different roles: deciding for varied personas, explaining choices in words, or handling only the few decisions that are hard to write as a rule. The model proposes. The simulation decides. The proposal is parsed into a fixed format. A validator rejects anything that breaks a budget, a balance or the rules. Only a permitted action is executed, and the prompt, the model version and the settings are logged. Researchers have used such agents to let concealment emerge without ever telling agents that evasion is the topic. That changes the question from how often to when. The risks are real. Answers can shift with wording, model version, temperature or memory. Populations of language agents can drift into their own conventions, or echo stereotypes from training data. Plausible isn't the same as valid. So use a fixed action schema, an accounting validator, version control, a memory policy, ablation tests, comparisons with human data, and cost control. And when the decision is a simple tax calculation, an equation is still better.
A calibrated example. Finally, a calibrated example from start to finish. We invented ten countries with a 25-year benchmark of the hidden share. A hidden process we know made the benchmark, with its own measurement error. Each country gets 100 agents in five villages, with self-employment, income, a tolerance for cheating, and sensitivity to audit risk. Each agent moves gradually toward the hidden share its situation favours. Two versions: private reasons only, or private reasons plus the village's average behaviour. We calibrated both on the first twenty years, and kept the last five for checking. The peer version fit the past better, with an average error of 1.5 points against 1.8. On the five held-out years, it did worse: 3.3 against 2.9. Both beat regressions on the same inputs, which were off by about five points. And simply repeating last year's benchmark was off by only 0.4. Why did the agents miss? The benchmark kept falling in the last years. Whatever drove that decline wasn't in the agents' world, so they had no reason to follow it. An agent model is for mechanisms and what-ifs. It doesn't have to win at next year's number, but you have to say so.
What-ifs and their assumptions. Now the what-ifs, from year 21, using the peer version. A stronger audit signal, by half: no effect at all. That's not a finding about audits. The audit signal barely changed in our data, so the calibration couldn't learn its effect and set it to zero. The scenario just repeats that assumption. Better services and trust, lowering tolerance for cheating: the hidden share fell by about 2 points. And even then, about two thirds of agents still hid more than 30 percent. Last, the peer weight, which country totals can barely identify. At the calibrated weight, the final hidden share is 38 percent. Without peers, 32. At three times the weight, 53. So any claim about social contagion here needs network, survey or experimental evidence, not just a good fit to totals. Every scenario inherits the calibration's blind spots. Before reporting a what-if, check whether the data could have taught the model that effect at all.
Recap. Let's recap. Multi-resolution models connect levels through explicit interfaces, layer by layer. Many settings can fit one history. Use distributions as targets, and report the set of acceptable models. Learning agents learn what they're rewarded for. Language-model agents propose, and the simulation validates. Calibrate on the past, check on held-out years, compare with simple baselines, and state what each scenario really assumes. In the lab, you'll calibrate a small town and try its what-ifs. Next module: designing policy against the hidden economy, when every choice has a cost and the truth is uncertain.
8:12Video 14 · 7.1An executable theoryBeliefs, not true audit rates, drive choices (30% hidden when firms know the rate, 36% or 20% when they believe otherwise). Complex contagion reached everyone on a clustered network and 1% on a random one; learning firms hid 28%, not the textbook 69%.
8:07Video 15 · 7.2From micro to macroA recession left hiding about a point higher two years after demand returned. At a 6% audit rate, a town that started with hiding common ended at 38% against 29%. Two calibrations with the same average disagreed completely about targeted audits.
8:31Video 16 · 7.3Multi-resolution, LLM agents, and a calibrated townAdding the honest share as a second target left one setting. Risk-score audits recovered most per audit (0.28) but left more hiding (35% against 30% at random). The peer version fit the past better and forecast worse; repeating last year's benchmark was off by 0.4.
Interactive lab
Town in silico
Run a small agent-based town of 300 invented firms. Change the audit rate, how much firms copy their peers and how much their moral costs vary, add a recession or e-invoicing, and look for lasting marks and tipping points.
A small version of the videos' Saltmarsh, simulated in your browser. Four challenges are checked as you go.
Town in silico: 300 firms, nobody told to hide
A small version of the videos’ Saltmarsh. Every quarter each invented firm chooses how much of its cash sales to declare, weighing the tax, the audit risk it believes, a moral cost that grows with trust, and what its peer group does. Card sales are always recorded. Trust follows the revenue the town collects.
Peers make hiding cheaper; trust makes it dearer.
Services are paid by the revenue actually collected.
Running…
Hidden share, quarter by quarter
Challenges
Each one is checked on your current settings.
- Find an audit rate where a town that starts with hiding common ends at least 5 points above one that starts honest.
- Switch on the recession and see hiding still at least a point higher two years after demand returns.
- Switch on e-invoicing and see the small firms, which were not reformed, hide at least 8 points less.
- Get the hidden share below 15% with an audit rate of at most 8%.
