A linear model on the five causes theory names.
Computational Approaches to the Non-Observed EconomyFoundations
Module 2Theory-based and data-driven modelling
In most empirical work the outcome can be counted. Here the target is hidden: latent, rebuilt by someone else's model, or seen only for a few people. Studying it needs a production story and an observation story. We look at the mechanisms theory offers, five modelling objectives that are often confused, a strong association that is a weak lever, a cross-country slope with the wrong sign, and then the data side: labels and their status, provenance, coverage, timing and leakage, and a division of labour between theory and data. Forty invented countries keep every claim checkable.
Key ideas, one per video
- Video 3The flexible model's good score came from recognising countries it had seen. Ten more points of digital payments go with 5.2 fewer points of hidden activity across countries; pushing them up by ten points, all else fixed, cuts it by 0.3.
- Video 4A model trained on an estimate learns the estimate (8.3 points from the truth on new countries, against 6.5 for the estimate itself). The split must match the use, and last year's value (2.4 points) beat a random forest (3.4).
Book: Chapter 2 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
2 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 3 · 9:57
When the target itself is hidden
Two models of a published estimate score 4.5 and 8 points. Against the truth, both are off by about 8.
The flexible model's good score came from recognising countries it had seen. Ten more points of digital payments go with 5.2 fewer points of hidden activity across countries; pushing them up by ten points, all else fixed, cuts it by 0.3.
TranscriptVideo 3
Two models, three scores. Here are forty countries, sixteen years each. For every country and year, someone has published an estimate of its hidden economy. We train two models to predict that published estimate. One is flexible: a random forest that sees everything we have. The other is simple, and only uses variables that theory says matter. Test them on a random quarter of the rows. The flexible model is off by about 4.5 points. The simple one, by 8. Now test them on ten countries they have never seen. The flexible model's error jumps to almost 7 points. The simple one barely moves. And here's the twist. These countries are invented, so we know the true hidden share. Against the truth, both models are off by about 8 points. So which number would you report? That question is what this module is about.
Two stories. Welcome to Module 2: theory-based and data-driven modelling. In most empirical work, the thing you're explaining can be measured. People argue about why unemployment changes, but they can count the unemployed. Here, the target itself is hidden. It's latent, or reconstructed by somebody's model, or observed only for a few people. So every study of the hidden economy needs two stories. A production story: how hidden activity arises. And an observation story: how evidence about it reaches us. Theory is good at the first. Data are good at testing both. In this video, we look at what theory brings, and what each kind of model is for. The plan: first the mechanisms theory gives us, then the five things a model can be for, then a trap about prediction and policy, then what makes a model theory-based, and finally back to our two models.
Mechanisms. Start with concealment. Economists have long modelled crime and tax evasion as a choice: people compare what they gain from hiding with what they expect to lose if caught. That gives hiding an economic logic. But real people don't know the audit probability. They act on the risk they believe in, shaped by experience, advisers and rumours. Information is part of the mechanism too. When an employer reports your wage, there's little to hide. With value added tax, one firm's sale is another firm's purchase, so their reports can be checked against each other. Digital invoices and payments add more traces. But data only deter if the tax office can link them and use them. Then there's social life. People learn from their neighbours what is normal and what is risky. And trust matters: people pay more willingly when they see taxes as fair and services as worth it. Informal firms need a different story: the costs and benefits of registering, and the jobs that are actually available. Illegal markets need another: prohibition, secrecy and trusted networks. And statistical omissions need a story about the observer: registers, samples and classifications. A theory of the hidden economy must include the observation process, not only the production process. Notice that no single mechanism covers all of this. Hiding sales, running an unregistered shop, selling something illegal and being missed by a register are different processes. A model has to be built for the process you're studying.
Five objectives. Before choosing a model, choose the objective. There are five, and they're often confused. Measurement asks how big the hidden economy is, now or in the past. It's judged by how credible the reconstruction is, and how honest its uncertainty. Explanation asks why it exists, or why it changed. It needs mechanisms, and it's judged by whether those mechanisms account for the patterns we see. Prediction asks what will happen next, using only what's known today. It's judged on data the model has never seen, in time order. Simulation asks how individual choices add up. It's judged by whether it reproduces patterns at both the small and the large scale. And policy asks what would happen if we changed something. That needs a counterfactual, which is much more than a good prediction. In our forty countries, the five look like this. Measurement: how big was the hidden share in country twelve last year? Explanation: why is it falling there? Prediction: what will it be next year? Simulation: how do millions of individual choices add up to that number? And policy: what happens if country twelve doubles its audits? A model can be excellent at one of these and useless at another. A random forest can predict well and explain nothing.
Prediction is not policy. Here is why prediction is not policy. In our forty countries, places with more digital payments have less hidden activity. Across countries, ten more points of digital payments go with about 5 fewer points of hidden activity. So, should a government push digital payments up by ten points? Pause for a moment, and guess how much hidden activity would fall. We can actually run that experiment, because we built this world. Force digital payments up by ten points, and keep everything else the same. Hidden activity falls by about a third of a point. Not five. A third of one. Why? Because in this world, strong institutions drive both. They bring digital payments, and they bring enforcement and trust. Digital payments mostly ride along. Draw it as arrows. Institutions point to digital payments. Institutions also point to enforcement and trust, and those point to hidden activity. Digital payments have only a thin arrow of their own. Any variable with a strong common cause can look like a lever. Theory is what tells you which arrows exist. A model that predicts well will happily use digital payments as a clue. That's fine for prediction. It's wrong for policy.
Theory-based models. So what makes a model theory-based? Not equations. The structure comes from an economic argument, made before the model sees the data. A linear regression isn't automatically theory. And a machine-learning model can carry a lot of theory: which variables enter, which signs are allowed, which actions are possible. The classic evasion model is a good template. One person chooses how much income to report. Then you can add beliefs, norms, trust, third-party reports, or repeated audits, and solve it with a computer. Firms work the same way. Register or not, declare how much, pay workers formally or not, accept cards or cash. Theory says why each choice matters. Data say how much. The strength of theory is interpretation. Its weakness is identification. Here's a warning from our own world. In this world, raising taxes makes people hide more. We built it that way. Five extra points of tax adds about a point of hidden activity. Yet across countries, higher-tax countries hide less. Five more points of tax go with almost 9 fewer points of hidden activity. Same world, opposite signs. Strong institutions raise both taxes and compliance. The correlation tells you about institutions, not about taxes.
Proxies. Some of the oldest size estimates were theory-based too. Currency demand methods assume that hidden trade needs extra cash, beyond what normal habits explain. Electricity methods assume that production needs power, recorded or not. And latent-variable models combine several causes and several indicators at once. Each made a hidden quantity approachable. Each also leans on a proxy with other causes. Cash depends on banking, interest rates and habits. Power depends on technology and climate. Latent-variable models tried to fix that by listening to many causes and many indicators at once: tax burden, regulation and unemployment on one side; cash, power and working hours on the other. That spreads the risk across several proxies. But it raises new questions: is the hidden quantity really identified, and in what units is it measured? The published estimate in our forty countries is built that way. It leans on cash use. It follows the truth closely, with a correlation of zero point nine two. But it's off by about 6 points on average. It's too high where cash is common, and too low where it's rare.
Name tags. Back to our two models. Why did the flexible one look so good on random rows? Because a country's years look almost alike. From one year to the next, the hidden share has a correlation of zero point nine four. A random split puts a country's neighbours in training and its other years in the test. The forest learns each country's quirks. Population, for example, is fixed for each country, so it works like a name tag. On new countries, the name tags are useless, and the error grows by half. The simple model has no name tags, so its score barely moves. That's honest. But it isn't more accurate against the truth. So report both scores, and say which one matches your use. If you'll apply the model to countries it has never seen, the random-split score is the wrong one to quote. And there's a deeper problem. Both models learned the published estimate, not the hidden economy. We'll take that apart in the next video.
Recap. Let's recap. The hidden economy needs two stories: how activity arises, and how evidence about it is produced. Theory brings mechanisms: incentives and information, norms and trust, the costs of formality, prohibition, and the observer itself. Measurement, explanation, prediction, simulation and policy are different objectives, judged in different ways. A strong association can be a weak lever. And a correlation across countries can have the opposite sign to the mechanism. In the lab, you'll build the forty countries yourself, train both models, and switch between random and country splits. Next: ground truth, leakage, and how to make theory and data work together.
A reform the estimate misreads. Half of our forty countries introduce electronic invoicing in year ten. Every sale gets a digital record. The published estimate reacts strongly. In those countries, it says the hidden economy fell by 8 points. Because this world is invented, we can rerun it without the reform. The reform's true effect was about 3.5 points. The estimate more than doubled it. Nobody lied, and nothing was miscalculated. Pause and think: what went wrong? The estimate reads cash use. The reform pushed people from cash to cards, so the estimate's input fell, even where hiding didn't. The reform changed the observation process, not only behaviour. This video is about seeing that kind of trap before it bites.
Data are made by institutions. Start with a mindset. A dataset is not a neutral picture of the economy. It's a product of institutions and behaviour. Tax records exist because rules require reports. Registers exist because firms register. Payment data exist because people pay through a particular system. And the same institutions that create the hidden economy decide what data exist to measure it. So a data infrastructure has to connect five things: the target, the observation process, where each variable came from, who is covered, and when each value became known. We'll go through them one at a time, then look at what flexible models add, and finish with a division of labour between theory and data.
An estimate is not ground truth. First, the target. It might be a national estimate, an audit finding, a count of informal jobs, or a risk flag on a transaction. These are different objects. And many of them are estimates, not observations. A published shadow-economy series may itself come from a currency model or a survey. Train a model on such a series, and the model learns the series. In our world, a forest trained on the published estimate ends up about 8 points from the truth on new countries. The published estimate itself is about 6.5 points from the truth. The student is no better than its teacher. If we could train on the truth, the same forest would be about 7 points off. That's the gap we lost to the label, before any modelling choice. Audit data have a different problem, which we met in Module 1. Audits target risky cases, so a model trained on them partly learns how auditors choose. So label every target with its status. Directly observed, rebuilt from records, reported in a survey, produced by a model, or imputed. And carry that uncertainty forward. A useful trick is to combine a little direct evidence, like a survey in a few places, with broad indirect indicators that cover everywhere. The direct evidence anchors the level. The broad indicators spread it across places and years. Neither alone can do both jobs.
Provenance. Second, where each variable came from. Every source sees only a projection of the economy. Tax returns see what was declared. Card data see card payments, and nothing paid in cash. Keep a record of each variable's history: who collected it, how its definition changed, what was done to it, and when it became available. Here's why. Suppose a statistics office changes how it classifies self-employment in a given year. The series jumps. A model that doesn't know about the change will learn the jump as if it were behaviour. Without that history, the reform at the start of this video is uninterpretable. Recorded sales rise. Is that less hiding, more production, better records, or all three? Linked records are especially valuable: an employer's report against a worker's, a buyer's invoice against a seller's. They add information about the same event, not just more columns. But check that your confirmations are independent. Three variables computed from the same tax return are one source, not three.
Coverage, timing and leakage. Third, coverage. The process that hides activity can also keep it out of the dataset. Registered firms are easier to see than unregistered ones. Card payments are easier to see than cash. A billion card payments can describe the card network perfectly, and still say little about the trade that moved to cash. We saw it in Lantern Bay. The card company had detailed records of more than half the town's output, and almost nothing on the undeclared sales, which were paid in cash. Fourth, timing. Values arrive late and get revised. If a model trains on revised numbers, or on audits that finished later, it's using the future. That's leakage. It can also sneak in through preprocessing, filling in missing values, building features, and splitting at random. Here's a common version. You fill in missing values using the average of the whole dataset, test rows included. Now every training row carries a little information from the test set. Or you build a feature from a country's average over all years, then test on its later years. The future has quietly entered the past. In our forty countries, the flexible model scored 4.5 on random rows, and almost 7 on new countries. Same model, same data, a different question. So the split must match the use. Forecasting means testing on later years. Transfer means testing on whole new countries. Risk scoring means testing on new firms. Maps mean testing on new regions. And remember how much data you really have. Our panel has 640 rows. But with years this alike, it behaves more like forty stories than six hundred and forty.
What flexible models bring. Now, what do flexible models bring? They can learn shapes and interactions that nobody wrote down. Cash may mean something different where banks are scarce. Their discipline is out-of-sample testing. Fit on some data, judge on other data. And match their flexibility to the real amount of information, with regularisation and simple baselines. And always run a simple baseline. Here's one for forecasting: just use last year's published value. On the last four years of our panel, that's off by about 2.4 points. The random forest, trained on the earlier years, is off by about 3.4. The one-line baseline wins. Complexity has to earn its place. Know what each feature is. It may be a cause, a consequence, a trace of the observation system, or just a control. A feature can predict well because it names a country, or a reporting system. Even the fact that a value is missing can be a name tag. That's fine if you'll only ever predict for the same countries under the same systems. It breaks the moment you move to a new country, or the reporting system changes. Explanation tools, like SHAP values, describe what a model uses. They don't tell you what would happen if you changed that feature. Important to the model is not the same as a policy lever. And relationships drift. A model trained before electronic invoicing learned a world that no longer exists after it. Treat a data-driven model as something you monitor, not something you finish. A practical habit: keep watching the gap between your model and any fresh direct evidence, like a new survey or a round of random audits. When the gap grows, the world has moved.
Theory and data together. So how do theory and data work together? Give each the job it's good at. Theory should fix the target, the actors, and what each of them knows. It should say how a policy reaches behaviour. And it should impose accounting identities, legal limits and feasibility. Data should learn the sizes, the shapes, the thresholds and the interactions that theory can't pin down. And data should decide whether extra complexity earns its place. Here's an example. Theory says that third-party reporting makes hiding harder. It doesn't say whether the effect is a straight line, whether there's a threshold, or whether it depends on firm size. That's what data are for. Or the effect of digital payments may depend on whether the tax office can actually link payment records to tax returns. Theory names the interaction. Data measure it. Then validate against the objective. And when a model fails, read the failure. Failing after a reform says the observation process changed. Failing in low-trust countries says trust is missing from the model. For our reform, the fix is to model the observation process explicitly. Let the estimate know that cash use changed for reasons other than hiding. And use a counterfactual. Compare with similar countries that didn't reform, or with a simulation of the same world without the reform, the way we did here. That's the loop: theory proposes, data test, failures teach, and theory is revised. Neither side gets the last word.
Recap. Let's recap. A dataset is made by institutions. Record each target's status, and each variable's history. A model trained on an estimate learns the estimate. It can't be more right than its label. Coverage depends on how data are generated, not on how much there is. And the test split must match the intended use. Theory fixes the target, the actors, the information and the constraints. Data learn the shapes. Failures teach you which part was wrong. And a one-line baseline is the first test any complex model has to pass. In the lab, you'll switch on the reform, and watch the published estimate, the truth, and your models disagree. Next module: games between auditors and the people they audit, written down as mathematics.
9:57Video 3 · 2.1When the target itself is hiddenThe flexible model's good score came from recognising countries it had seen. Ten more points of digital payments go with 5.2 fewer points of hidden activity across countries; pushing them up by ten points, all else fixed, cuts it by 0.3.
9:20Video 4 · 2.2Ground truth, leakage, and making theory and data meetA model trained on an estimate learns the estimate (8.3 points from the truth on new countries, against 6.5 for the estimate itself). The split must match the use, and last year's value (2.4 points) beat a random forest (3.4).
Interactive lab
Forty countries
Build forty invented countries, train a simple theory-guided model and a flexible one on a published estimate, and switch between random and country splits and between scoring against the estimate and against the truth. Then switch on a payments reform.
The countries are simulated in your browser (a hidden share driven by institutions, taxes and payments, and a published estimate that leans on cash). Four challenges are checked as you go.
Forty invented countries, sixteen years each
The true hidden share depends on taxes, enforcement, trust, self-employment and digital payments, plus each country's quirks. A published estimate leans on cash use, so it runs high where cash is common and low where it is rare. Both models learn the published estimate.
Nearest neighbours on the causes, plus population if you allow it: a number fixed for each country, which works like a name tag.
Half the countries move payments to cards. Hiding falls a little; cash falls a lot.
Running…
Errors on the held-out rows
Points of hidden share.
The reform, in the reform countries
Change after year 10 compared with year 9, in points.
Challenges
Each one is checked on the settings you have tried.
- Scoring against the published estimate, with the name tag on, find a k where the flexible model beats the simple one on random rows but loses on whole countries.
- Score against the truth, and find settings where both models are further from the truth than the published estimate they learned from.
- Switch on the reform and see the published estimate's drop come out more than one and a half times the reform's true effect.
- On random rows, take the name tag away and watch the flexible model's error rise by more than half a point.
