← Research/Geo-Lift With CausalPy: A Verdict That Downgrades Itselflive · interactive
Case StudyCausal InferenceSynthetic ControlCausalPyPyMCGeo Experiments
Research · December 2026

Geo-Lift With CausalPy: A Verdict That Downgrades Itself

You ran a campaign in one city. Did it work? This is the instrument I built to answer that inside TrueLift, how CausalPy fits into it, and what happened when I tested it on data where I already knew the answer. It got close, and it was honest about the gap.

Known answer in the test data
+18%
a lift I planted in one city
What the instrument said
+14.3%
94% interval 11.0 to 17.6
Its verdict on itself
Suggestive
never “causal”, by design

TrueLift is a marketing measurement product I have been building on my own since July 2026. It forecasts a number with a range, records the decision you make on it, and later grades that decision against what happened. One part of it is a causal lab: tools that answer “did it work?” and attach a verdict that weakens itself when the evidence is thin.

This case study covers the geo-lift tool in that lab, and the standalone version I built in December 2026 with CausalPy, the open-source causal inference library from PyMC Labs, doing the Bayesian part. Every chart below is interactive, and every number in them comes from running that app's own code on a synthetic dataset. No client data appears anywhere on this page.

The problem: one city, no control group

A marketing team runs something in one place: a billboard campaign, a local promotion, a regional launch. Traffic in that city goes up. The honest question is how much of the rise the campaign caused, and how much would have happened anyway because of season, a national campaign, or plain noise.

A randomised experiment would settle it, but nobody randomised anything. What you do have is every other city. The idea behind a synthetic control is to blend a handful of untreated cities into a “twin” that tracked the treated city closely before the campaign, then let the twin show what the treated city would have done without it. The lift is the gap between the real city and its twin.

The method is well known. Where most geo tests go wrong is quieter: which cities go into the twin, and who checks whether the twin deserves to be believed. That is the part I built the tool around.

The design, end to end

From raw sessions to a verdict
Input
Daily sessions by city
One treated city, a known start date, a test window
Donor lab
Screen, then select
Drop junk, small and contaminated cities. Add donors only if they improve held-out error.
Engine 1
Constrained least squares
Weights between 0 and 1 that sum to 1
Engine 2
Bayesian twin (CausalPy)
Same donors, with uncertainty on every weight
Refutation
Try to break it
Placebo in space, placebo in time, leave-one-out, range and fit checks
Output
A lift, a range, and a verdict
Capped at "suggestive", downgraded to "descriptive" when a check fails
Refutation runs on every analysis. It is not an option the user can skip.

Two engines estimate the same twin in two ways. The first is a constrained least-squares fit: each donor gets a weight between zero and one, and the weights sum to one, so the twin is always a blend and never an extrapolation. The second is a Bayesian model of the same design, which is where CausalPy comes in. If the two disagree, that is worth knowing before anyone quotes a number.

The donor lab: choosing who goes into the twin

Most tools hand you a twin and a number. This one shows its working in three stages, because a twin built from the wrong cities gives a confident wrong answer.

Screen. A candidate city needs enough traffic to be stable (at least 30 sessions a day) and has to move with the treated city before the test (a correlation of at least 0.5). Catch-all buckets such as “(not set)” are never donors. Cities the analyst knows were exposed to the campaign can be excluded by hand.

Select. The last 28 days before the test are held back. Donors are added one at a time, and a city joins only if it makes the twin better at predicting those held-back days by more than one percent. This stops the twin from fitting noise.

Diagnose. Is the treated city inside the range its donors cover? How large is the error before the test? Does the answer collapse if one donor is removed?

Interactive
The donor lab on the test data
Switch the donor pool to see how one contaminated city changes who gets picked
live
Stage 1 · screening: every candidate city, by size and by how closely it tracks Austin
0.50.60.70.8correlation floor050010001500sessions a day before the testcorrelationPhoenixDallasMontrealVancouver
Hover a city. Green circles were selected; size shows weight in the twin.
✕ (not set) — aggregate bucket, not a real geo
✕ Boise — volume too low (24/day < 30)
✕ San Antonio — excluded — declared contaminated (spillover)
Stage 2 · forward selection on held-out error (lower is better)
1Montreal50.3
2Phoenix32.2
3Vancouver30.5
4Dallas29.3
5Denver31.1
A city joins only if it improves the error on 28 days the weight fit never saw. The struck-through city did not.
The twin: weights, with CausalPy's 94% interval
Phoenix28%
Vancouver28%
Montreal22%
Dallas22%

With the contaminated city left in, the selection picks it first: it tracks the treated city beautifully, because it caught some of the same campaign. A good fit before the test is not evidence that a donor is clean.

Where CausalPy comes in, and the wall I hit first

CausalPy already has the model I wanted: a SyntheticControl experiment with a WeightedSumFitter, which puts a Dirichlet prior on the donor weights so they stay on the same zero-to-one, sum-to-one scale as the first engine. Using a maintained library for the Bayesian half means less of my own code to be wrong.

The first attempt failed for a dull reason. The TrueLift engine runs PyMC 6 and ArviZ 1.2. CausalPy pinned older versions of both, so the two could not be installed together. Inside the engine I wrote the same weighted-sum design by hand in PyMC 6. The standalone app has its own environment, so there it uses CausalPy itself.

One design, two environments
TrueLift engine
Standalone geo-lift app
Bayesian twin
Hand-written in PyMC 6
CausalPy SyntheticControl
Why
CausalPy could not be installed alongside
Its own environment, older PyMC
Interface
API, web page and an AI agent tool
Streamlit, every stage on one page
Data
The data you upload
Three bundled datasets, or your own CSV
The donor lab, both placebos, the verdict rules and the power simulation are the same code in both.

Two details mattered once CausalPy was running.

The default noise prior was far too tight. CausalPy's default assumes outcome noise on the order of one unit, which suits standardised data. A city doing several hundred sessions a day is not that. I set the noise prior in session units, sized to the treated city's own day-to-day variability.

The band had to include the noise. CausalPy's default counterfactual is the model's mean prediction, which gives a narrow band that real days fall outside of all the time. For a band that an observed day can fairly be compared against, the app draws from the full posterior predictive.

geolift_core.py
Python
1import causalpy as cp
2from pymc_extras.prior import Prior
4# ──The Bayesian twin: same donors, weights on the simplex ──
5model = cp.pymc_models.WeightedSumFitter(
6 sample_kwargs={"draws": 800, "tune": 800, "chains": 2, "target_accept": 0.95},
7 priors={
8 # Flat simplex: every donor equally plausible to begin with
9 "beta": Prior("Dirichlet", a=np.ones(len(pool)),
10 dims=["treated_units", "coeffs"]),
11 # Outcome noise in session units, not the default HalfNormal(1)
12 "y_hat": Prior("Normal",
13 sigma=Prior("HalfNormal", sigma=y_sd, dims=["treated_units"]),
14 dims=["obs_ind", "treated_units"]),
15 },
16)
18experiment = cp.SyntheticControl(
19 panel, treatment_time,
20 control_units=pool, treated_units=[treated],
21 model=model,
22)

The test: data where I know the answer

The only way to know whether a causal tool works is to try it where the truth is known. I generated fourteen cities that share one market trend, then planted a lift: Austin gets 18% more sessions for 28 days. I also planted a trap. San Antonio, the city next door, catches a 6% spillover. A careless analysis would use San Antonio as a donor.

Interactive
Austin against its synthetic twin
The shaded band is CausalPy's 94% interval for what Austin would have done without the lift. Move over the chart to read any day.
live
Donor pool:
Estimated lift
+14.3%
94% interval 11.0 to 17.6
Known answer
+18%
built into the data
Extra sessions
2,029
1,614 to 2,426
Verdict
suggestive
300400500600700test windowDec 22Jan 26Mar 2Mar 29
Austin, observedsynthetic twin94% band (CausalPy)Mar 29: 528 observed · 448 twin · +80

With San Antonio excluded, the twin is built from Vancouver, Phoenix, Dallas and Montreal. Both engines land on the same figure: +14.3%. CausalPy puts the 94% interval at 11.0 to 17.6.

The planted answer is 18%. So the estimate has the right sign and roughly the right size, and the interval just misses the truth. I have left it that way. I did not tune the method until it hit 18, because a tool tuned to pass one test tells you nothing about the next one.

Interactive
How sure is it? The full range of answers
Every bar is a plausible total lift according to the Bayesian twin
live
Donor pool:
estimate 2,029truth 2,4771,2001,4001,6001,8002,0002,2002,4002,6002,800extra sessions over the 28 days
94% interval 1,614 to 2,426 (shaded). The answer built into the data is 2,477, which sits just outside it. Sampler: 2 chains × 800 draws, r̂ 1.00, 0 divergences.

An interval describes the uncertainty the model knows about. It does not cover the choices made before the model ran, such as which cities were allowed in. That is the reason the verdict language is capped.

Trying to break the result

A lift number on its own is cheap. Before the tool reports one, it runs checks designed to embarrass it.

Placebo in space. Every untreated city takes a turn pretending to be the treated one. If several of them show “effects” as large as Austin's, then Austin's is nothing special. The comparison uses the ratio of error after the start to error before it, so a city that was badly fitted all along does not look like a discovery.

Interactive
Is Austin unusual, or does every city look like this?
Grey lines are cities where nothing happened
live
Running lift, percent, when each city takes a turn as the “treated” one
-40%-20%0%+20%+40%Austinday 1day 28
Error after the start ÷ error before it
Austin2.57
Houston1.32
Dallas1.30
Seattle1.25
Denver1.21
Toronto1.16
Vancouver1.09
Phoenix1.06
New York1.01
Chicago1.00
Montreal0.95
Los Angeles0.91
Rank 1 of 12, so p = 0.083. Hover a city to find its line.

Austin ranks first of twelve, which gives p = 0.083. Note what that number can and cannot be: with twelve cities, the smallest possible p is one in twelve. A small panel cannot produce a tiny p-value, and the tool does not pretend otherwise.

Placebo in time. The same twin is asked to predict a quiet 28-day stretch before the campaign, where the true effect is zero. It found −326 sessions against a tolerance of ±406, so it passes.

Leave one out. Each donor is removed in turn and the lift re-estimated. Three of the four barely move the answer. Removing Vancouver drops it from 14.3% to 3.7%. That is a real dependence on one city, and the page shows it, which is more useful than a single number that hides it.

Donor removedLift without it
None (all four)+14.3%
Phoenix+16.3%
Dallas+14.2%
Montreal+9.8%
Vancouver+3.7%

A verdict that downgrades itself

The output is a word as well as a number. There are three levels: causal, suggestive and descriptive. Geo-lift starts at suggestive and can never go higher, because the cities were not assigned at random and the city labels in web analytics are guessed from IP addresses. Each failed check pushes it down to descriptive, with the reason written out.

Now leave San Antonio in the donor pool. The selection picks it, the lift estimate drops to 12.1% because the twin has absorbed part of the campaign, and Austin falls outside the range of its two donors on 27% of days. The range check fails and the verdict drops by itself. Nobody has to notice the contamination for the tool to stop vouching for the number.

Interactive
The checks, and what they do to the verdict
Switch the donor pool, or click any check to flip it
live
Donor pool:
Click a gate to flip it and watch the verdict.
Verdictsuggestive
Every blocking gate passes. The cities were not assigned at random and the city labels come from IP addresses, so the verdict is capped at “suggestive” whatever the gates say. It never reads “causal”.

On real web data this has already earned its keep. A city's summer surge that looked like a clear win was ruled descriptive, because every plausible donor had been touched by the same campaign. The lab made that visible. A p-value would have hidden it.

Could this design even see it?

The last question is one most analyses never ask: if there were a lift, would this set-up have found it? The power panel injects fake lifts of 0, 5, 10, 15 and 25% into eight past windows and runs the full set of checks on each.

Interactive
Forty simulated tests
A lift of each size, injected into eight different 28-day windows
live
injected liftSep 26Oct 21Nov 15Dec 10Jan 4Jan 29Feb 23Mar 21detected
none (0%)0%
+5%25%
+10%50%
+15%50%
+25%50%
stopped: outside the donor rangestopped: not unusual among placebosdetectedstopped: quiet-period placebo failed
Each square is one simulated test: a lift of that size injected into a past 28-day window. Hover a square.

The result is uncomfortable, and I am publishing it anyway. With no lift injected, the design raised no false alarms. But it detected a real lift in only half the windows, even at +25%. In the other windows the design stopped itself, most often because Austin had drifted outside the range of its donors. Two of the eight windows overlap the weeks where the real lift was planted, so those two are not clean simulations. In the six clean windows it caught four of six at +10% and above, which is still short of the 80% the tool asks for before it calls a lift detectable.

The conclusion is that this city, with these donors, is a weak place to run a test, and that a bigger campaign would not fix it. The tool says so in plain words: change the design (a larger city, a wider cut of traffic, a calmer period). It is far better to learn that before spending the budget than after.

The sibling tool: “Did it work?” with no other cities at all

Sometimes there is no second city to compare with: one website, one known date, a change went live. TrueLift's other causal tool handles that case with an interrupted time series, built on the same principle of running two engines and trying to refute the answer.

One series, one date, two engines
Windows
Before and after
112 days before the date, 14 days after
Engine 1
Segmented regression
Level jump and slope change, with weekday effects
Engine 2
Bayesian counterfactual
Fitted on the "before" only, then projected forward
Refutation
Adjacent placebo
The same test, shifted back to a period where nothing happened
Output
Verdict
Causal, suggestive or descriptive, with reasons
This is the only design in the lab allowed to say “causal”, and only when nothing else changed in the window.

The verdict falls to descriptive if the placebo fails or if any other known change (a spend step, a campaign launch, a note on the calendar) lands inside the window. It stays at suggestive if the placebo could not run or the sampler did not converge. The tool finds those other changes by itself, by scanning ad spend for sudden steps and for campaigns that started or stopped.

What I took from building it

Choose the comparison before the model

The donor pool decided more of the answer than the statistics did. Leaving one contaminated city in moved the estimate and broke the design.

Test on a known answer, then publish the miss

The tool recovered 14.3% of a planted 18%. Knowing how far off it can be is worth more than a demo that happens to land.

Make the tool say no

A measurement tool that always returns a number will be trusted on the days it should not be. The verdict and the power panel exist to refuse.

Use the library, check its defaults

CausalPy saved me from maintaining my own Bayesian model. Its default priors still had to be rescaled to the data before the output meant anything.

What it is built with

PythonCausalPyPyMCArviZstatsmodelsSciPypandasStreamlitPlotlyFastAPIDuckDBNext.js

TrueLift is live at truelift.io. The ideas underneath this tool are covered in plainer terms in what incrementality means and which numbers tell you an ad worked.

Running a regional campaign and want to know if it worked?

The most useful time to talk is before the campaign starts, when the test can still be designed so that it is able to give an answer.

Start a conversation
Notes on the data and method

All figures on this page come from a synthetic panel of fourteen cities generated with a fixed seed, with a planted 18% lift and a planted 6% spillover. Synthetic control follows Abadie, Diamond and Hainmueller; the placebo ranking uses Abadie's post-to-pre error ratio. Intervals are 94% posterior intervals from two chains of 800 draws. CausalPy is an open-source library from PyMC Labs.