Computational Approaches to the Non-Observed EconomyMeasuring

Module 4Estimating the size

Fifty invented countries, thirty with a careful benchmark and twenty without: fill in the twenty and say how sure you are. We write the estimation task down, place each method in its history, fit linear models with the right shape and read their coefficients as what-if answers, then try trees, nearest neighbours, support vectors, boosting and a neural network. Random rows flatter the flexible models; whole held-out countries put the simple, well-shaped model first. Finally ranges: an ensemble's spread and quantile models are overconfident, while a Gaussian process and conformal prediction calibrated on whole countries keep their 90% promise.

By the end you should be able to write the size-estimation task, fit and read linear and flexible estimators, choose a check that matches the use, and report ranges with tested coverage.

Key ideas, one per video

  • Video 7A logistic link removed the negative estimates and cut the error on new countries from 4.9 to 4.2 points. Tax alone goes with almost 15 fewer points per 5 points of tax; with controls the sign flips to about +2, near the true +1.
  • Video 8Trees, neighbours, support vectors and boosting look best on random rows. On the twenty new countries the linear model with a link won (4.2 points), ahead of support vectors (5.5) and boosting (6.0).
  • Video 9A small neural network was unstable with thirty countries. Ranges from an ensemble's spread covered 37% and quantile boosting 52%; a Gaussian process and conformal prediction calibrated on whole countries covered 90%.

Book: Chapter 4 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.

The title slide of Module 4: Estimating the size

30 slides, written to be read on your own, with worked examples, our own small simulations and check-yourself questions (answers at the end). PDF, 6.1 MB.

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 7 · 8:19

The estimation task and linear models

Fill in twenty countries nobody has studied. A straight line predicts a hidden economy below zero for five country-years.

A logistic link removed the negative estimates and cut the error on new countries from 4.9 to 4.2 points. Tax alone goes with almost 15 fewer points per 5 points of tax; with controls the sign flips to about +2, near the true +1.

TranscriptVideo 7
0:00

Fill in twenty countries. Here are fifty invented countries. For thirty of them, the statistics office has done a careful study of its hidden economy. For the other twenty, nobody has. Your job is to fill in the twenty. And because we invented this world, we can check every answer against the truth. We start with the simplest tool there is: a straight line through the data. It does surprisingly well. But for five country-years, it predicts a hidden economy smaller than zero. Change one thing, the shape of the link between the line and the share, and the negative shares disappear. The error drops too, from about 5 points to about 4. That's the spirit of this module. Every estimator carries assumptions. Good estimation is choosing them on purpose.

0:50

Three videos, one world. Welcome to Module 4: estimating the size of the non-observed economy. I'm Teddy. This module has three videos. This one sets up the task and the linear models. The next one covers trees, neighbours, margins and boosting. The last one covers neural networks, honest uncertainty, and a fair comparison. All three use the same invented world, which we call the Archipelago. Fifty countries, twelve years each.

1:16

The estimation task. Let's write the task down carefully. A unit can be a country in a year, a region, a sector or a firm. For each unit, there's a hidden share we never see directly. Multiply that share by an observed scale, like official GDP, and you get the hidden economy in money. Say what the share is a share of. In the Archipelago, it's a share of everything produced, hidden or not. As we saw in Module 1, dividing by official GDP gives a bigger number for the same activity. What we do see comes in three kinds. Causes: things that push activity into hiding, like tax burden, weak enforcement or low trust. Indicators: traces that hidden activity leaves, like extra cash, a gap between spending and declared income, or electricity that recorded output can't explain. And benchmarks: careful estimates for a few units, from audits, special surveys or the statistics office's own completeness checks. A general estimator balances three wishes at once. Explain the indicators. Agree with the benchmarks where they exist. And stay plausible, for example by changing smoothly from year to year, and staying between zero and one. In the Archipelago, the benchmark exists for thirty countries, and it's close to the truth. Our models learn from those thirty, and estimate the other twenty. That's a realistic setting. Careful benchmarks are expensive, so they exist for some countries and not others. The rest need a model that carries the measured level across.

2:36

A short history. This task has a long history, and it helps to know it, because modern models inherit its assumptions. The earliest estimates read money. If hidden trade needs cash, then cash beyond what normal habits explain points to hidden activity. Everything depends on what counts as normal. Later came models with a hidden variable, which link several causes and several indicators to one unobserved size. Others compared what households spend with what they declare, or electricity with recorded output. Direct surveys and audits got better too, with careful wording for sensitive questions. And statistics offices developed their own methods, built into the national accounts. The main lesson of that history: no single method is a reliable benchmark. They measure different parts of the hidden economy, under different assumptions. So the best evidence triangulates.

3:25

Linear models and shape. Now, the linear model. Predict the hidden share as a weighted sum of the inputs. The computer picks the weights that make the errors on the thirty countries as small as possible. Its strength is that you can read it. Each weight says how the prediction moves when one input moves, and the others stay fixed. How does it pick the weights? It squares each error and adds them up. Squaring punishes big misses more than small ones, and it makes the best weights easy to compute. To report how good a model is, we'll use the average size of the miss, in points of hidden share. Four points means that a typical estimate of, say, twenty percent could really be sixteen or twenty-four. Its first weakness is shape. A share lives between zero and one. A straight line doesn't know that. In the Archipelago, the straight line predicts negative hidden shares for five country-years. The lowest is minus three percent. The fix is a link function. Fit the line to the log-odds of the share, then squeeze the result back between zero and one. Small shares stay small, but never negative. With the link, the lowest prediction is about three percent, and the error on the twenty new countries falls from 4.9 points to 4.2.

4:37

A sign that flips. The second weakness is interpretation. Let's look at the tax burden. Before the numbers, a quick guess. Across countries, do higher taxes go with more hidden activity, or less? Fit the share on tax alone, across countries. Five more points of tax go with almost fifteen fewer points of hidden activity. Add enforcement, trust and the other causes, and the sign flips. Now five more points of tax go with about two points more. We built this world, so we know the truth: about one point more. The controlled model has the right sign, and the right order of size. A coefficient answers the question: what if this input changed and the others didn't? Leave out the others, and you answer a different question. And inputs that move together, like enforcement and trust, make individual weights unstable, even when the predictions are fine. Report predictions with confidence. Read single weights with care.

5:32

Regularisation and two checks. With many inputs and few countries, a model can chase noise. Regularisation pushes weights towards zero, unless the data insist. The lasso goes further: it sets some weights exactly to zero, so it also chooses inputs. In our world, it kept ten of the eleven inputs, and dropped bank access. Its cousin, ridge regression, shrinks all the weights a little instead of zeroing some. It helps most when inputs move together. Here, it didn't help. The lasso's error on new countries was about 5 points, a little worse than the plain model with a link. Regularisation earns its keep when inputs are many and data are scarce, and in this world they aren't scarce enough. One more check. We estimated the linear model's error two ways: holding out random rows, and holding out whole countries. Both said about 5 points. A simple model can't memorise a country's quirks, so the two checks agree. Keep that in mind for the next video, where they won't.

6:27

Look at the data first. Before you trust any of this, look at the data itself. Where does each variable come from? Which countries are missing which years? Is the benchmark a measurement, or someone else's model? Plot each input against the benchmark. Look for breaks in series, for countries that sit far from the rest, and for inputs that are almost copies of each other. Check the benchmark too. Is it the same kind of estimate in every country? A benchmark built from a survey in one country and from tax audits in another isn't one target, it's two. And look at time. A series that jumps in one year, in one country, is more often a change in how it was measured than a change in the economy. In the Archipelago, the currency ratio depends on cash habits as much as on hiding. A model that leans on it will be wrong wherever habits differ. That kind of knowledge doesn't come from the fit. It comes from knowing how the data were made.

7:14

Recap. Let's recap. The estimation task has a hidden share, an observed scale, causes, indicators, and benchmarks for some units. A good estimator explains the indicators, respects the benchmarks, and stays plausible. History says no single method is a reliable benchmark, so triangulate. Linear models are readable. Give them the right shape with a link function, read coefficients as what-if answers with everything else fixed, and expect unstable weights when inputs move together. In the Archipelago, a linear model with a logistic link estimates the twenty new countries within about four points. In the lab, you'll build the Archipelago's linear model, switch the link on and off, and watch a coefficient flip as you add controls. Next: trees, neighbours, margins and boosting. They're more flexible. Are they better?

Interactive lab

Estimate the Archipelago

Fit a linear model with and without a logistic link, grow a decision tree question by question, choose the number of neighbours, and ask for 90% ranges. Every estimate is scored on countries the models never saw, against the truth.

The Archipelago is simulated in your browser (thirty countries with a careful benchmark, twenty to estimate). Four challenges are checked as you go.

Simple math

The Archipelago: thirty countries teach, twenty to estimate

Fifty invented countries × 12 years. The hidden share jumps where enforcement is below 0.35, cash matters more where banks are scarce, and every country has quirks. A careful benchmark exists for thirty countries; the models estimate the other twenty, and we score them against the truth.

Linear
ŝ = w₀ + Σ wⱼxⱼ, or on the log-odds

With the logistic link, every estimate stays between 0 and 1.

Tree
yes/no questions, then an average

Each question splits on the input and cut point that reduce the error most.

90% ranges
ŝ ± 90% quantile of held-out errors

Conformal prediction: what you hold out decides whether the range is honest for new countries.

Training error
–
New countries
–
Negative estimates
–
90% range covers
–

Running…

Estimates for the twenty new countries

Challenges

Each one is checked on your current settings.

  1. See the straight line predict a negative hidden share, then switch on the logistic link and make every estimate positive.
  2. Grow a tree whose first question is about enforcement, near the threshold of 0.35 we built in. (Hint: which inputs does it see?)
  3. Grow a tree with a training error below 1.5 points and an error on new countries above 6 points.
  4. Get 90% ranges that cover at least 85% of the new countries. What did you hold out?