Examples · 12 fields
The same library, 12 different fields
A trial, a wheat field, a reactor, a nature reserve and a checkout page are the same mathematics wearing different words. That is the whole reason axiom's core has no domain in it — the nouns are treatment, dose, unit, outcome and covariate, and marketing is one adapter rather than the subject. These 12 walkthroughs are the argument for why that was worth doing.
Each one is a worked argument rather than a listing: 66 steps in total, every one saying why it is the necessary step and what was rejected to get there, with 43 charts and the exact code and output each step produced. Every one runs against a synthetic world whose truth is known, so the numbers can be checked rather than admired. Together they are 3907 lines and take 49 seconds.
Run them
Core install, no sampler, one command
Nothing here needs an extra. All of it works on the four core dependencies, and each script narrates itself at the terminal exactly as it does on these pages — the walkthrough is the program, not a write-up of it.
pip install axiom python examples/run_all.py # all 12, about 49 seconds python examples/run_all.py 07 12 # just those two python examples/07_clinical_rwe_calibration.py
Worth skipping to
Where the answer is not what the setup implied
Several of these end somewhere other than where they appear to be heading. Those are the ones worth reading rather than trusting a summary of.
06 · PUBLIC HEALTH
Grouping beats counting
The same 1,600 children give 55% power or 99% power depending only on how they are grouped into villages. The design effect punishes cluster size, not cluster count.
See it
12 · PRODUCT ANALYTICS
The worst-powered design wins
A design with 0.65 power nets the most; the one with power 1.00 is net-negative once you count the upside withheld from the holdout arm.
See it
09 · PROCESS ENGINEERING
The optimum is out of bounds
The unconstrained peak sits outside what the plant can physically run, so the answer is a corner of the operating window and a costed question for engineering.
See it
07 · CLINICAL RESEARCH
Nearly right, still overconfident
Calibration removes most of the confounding bias and the resulting model is still too sure of itself — which is exactly what a recovery test against a known truth exists to catch.
See it
10 · MARKETING
Which side of the bend?
A Hill curve is S-shaped, not merely concave, so the next unit of spend can return more than the average. A single headline ROAS cannot tell you whether you are under- or over-invested.
See it
04 · EPIDEMIOLOGY
Recovering the unrecoverable
No covariate adjustment could work — the confounder was never measured. A structural claim about a mediator makes the effect identifiable anyway, and the example then breaks that claim to show the route vanish.
See it
All 12
Every example, step by step
Each opens on its own page: the framing, then one section per step with the reasoning, the alternative that was rejected, the code that ran, the charts it produced and the output it printed — ending with what the run actually showed, which is not always what the setup pointed at.
01 · AGRONOMY
Where the yield actually peaks
Where does yield peak in nitrogen and irrigation, and how should a rationed budget be split?
7 steps, 6 figures
Surface
02 · LABOUR ECONOMICS
An effect you can only see sideways
Does a training programme raise earnings, when enrolment is self-selected?
5 steps, 3 figures
Identify
03 · EDUCATION
How strong would the thing you cannot see have to be?
How strong would an unmeasured confounder have to be to erase the tutoring effect?
4 steps, 3 figures
Identify · Diagnose
04 · EPIDEMIOLOGY
Recovering an effect nothing in the data can deconfound
An exposure you cannot deconfound, recovered through a measured mediator.
5 steps, 2 figures
Identify
05 · CONSERVATION ECOLOGY
Borrowing an answer from a reserve you did not study
Does a result from one reserve apply to another, and what must you measure there first?
5 steps, 3 figures
Identify
06 · PUBLIC HEALTH
The same children, worth five times as much
Sizing a cluster-randomized trial, where the intra-cluster correlation eats the sample.
6 steps, 4 figures
Design
07 · CLINICAL RESEARCH
Nearly right, and still too sure of itself
Using a small clean trial to correct a large confounded registry.
6 steps, 4 figures
Calibrate
08 · ENERGY
Calibrate the method before you trust the method
Which quasi-experimental method actually holds its size on this panel?
5 steps, 3 figures
Design
09 · PROCESS ENGINEERING
The optimum is outside the operating window
Climbing to a yield optimum, Box-Wilson style.
5 steps, 3 figures
Surface
10 · MARKETING
Which side of the bend are you standing on?
Contribution and marginal return, and proof the vocabulary is a thin adapter.
7 steps, 3 figures
Adapters · Surface
11 · BEHAVIOURAL SCIENCE
What study twenty-one will actually find
Pooling a literature that disagrees with itself.
6 steps, 5 figures
Pool
12 · PRODUCT ANALYTICS
The worst-powered design is the one worth running
Is this A/B test worth running at all?
5 steps, 4 figures
Design
How these pages are built
Nothing here is transcribed. Each script narrates itself
through examples/_walkthrough.py, and the site build runs it with
a capture flag set, so the steps, the tables, the readouts and every chart
series on these pages are the record of a real run. The code shown against a
step is sliced out of the source file by line number — the code that ran
between that step's heading and the next, with only each figure's caption
text elided, since the page shows it with the figure instead. Every page
carries the unedited file at the bottom. A broken example fails the build
rather than shipping stale prose.
Writing another one
Keep the shape: a docstring that states the field's question
in that field's own terms, a synthetic world with a known truth, then
w.step(title, why=…, instead=…) for each move — the
instead is the part readers get nowhere else, so it has to be the
alternative a reasonable person would really have reached for. Close with
w.finding(…) saying what the numbers showed. Then add it to the
table in examples/README.md.