Causal inference
Did it work? Measuring the effect of a decision without fooling yourself
A campaign, a new deductible, a reminder letter: did it change the outcome? Comparing those who received it with those who did not answers a different question. This article shows how we estimate the effect of a decision on observational data, what each estimate assumes, why the usual estimator can fail when the decision is rolled out in waves, what we do when only a few units received it, and how we keep a study of many segments from finding effects that do not exist.
Comparing is not measuring
Customers who received a loyalty offer renew more often. Did the offer work, or was it sent to customers who were already loyal? Claims handled by a specialist close faster. Is the specialist better, or were the simple claims sent to them? On observational data the people who receive a decision are rarely chosen at random, and the raw comparison mixes the effect of the decision with the reasons it was given.
For each unit, imagine two outcomes: with the decision and without it. Only one is ever observed. The average effect over everyone (ATE) and the average effect on those who received it (ATT) are
where is 1 for the units that received the decision. Every method below fills in the missing outcome in a different way, and each rests on an assumption the data cannot prove. A result is only as good as that assumption, so every result we deliver names it.
Adjusting for what is observed: weighting
The first family assumes that, once the observed characteristics are known (age, history, channel), the decision was as good as random: no unmeasured confounding. The probability of receiving it, , the propensity score, is estimated by a logistic regression. Each unit is then weighted by the inverse of the probability of what it received, so that both groups come to resemble the whole population, and the effect is the difference of the two weighted means:
Three details decide whether the number can be trusted. The score model is fitted on standardised characteristics, so that it does not depend on the units of measurement. The balance of every characteristic is checked after weighting. And the overlap is reported: when some units had almost no chance of receiving the decision, or almost no chance of escaping it, the estimate leans on a handful of comparable units, and the result says so.
Our tool computes both checks for each characteristic and each group , 1 for the treated units and 0 for the others:
where is the mean of characteristic in group weighted by the of (2), its weighted variance, the sums running over the group, with the weights scaled to sum to 1 in the group, the number of units in the group, and the share of them whose estimated propensity lies outside the declared bounds, below 0.05 or above 0.95. The three thresholds are declared settings, not learned. A characteristic still above 0.15 after weighting is named in the result, and in a study such an estimate is not kept; a share above 0.05 in either group puts a warning on the result, it does not refuse it. The doubly robust estimator below is checked the same way, with its own weights: for a treated unit and for the others, where is the share of treated units and the cross-fitted score of (4), which also gives . Since that score differs from , these weights are not, in general, a constant multiple of those of (2) within a group; only the factors and , constant within each group, leave (3) unchanged.
A common shortcut is to trim the largest weights. It changes the population the effect refers to, usually without saying so. In our simulations with an effect of 1 that varies across units, capping the weights at their 1st and 99th percentiles moved the estimate to 1.07 when the groups overlapped well. When they overlapped poorly, it moved it to 1.68, and the 95% interval contained the true effect in only 2% of the samples. Without trimming, the estimate was 1.24 and the interval held the truth 60% of the time: poor overlap is genuinely hard, and our tool flagged it in every one of those samples. We do not trim by default, and when trimming is requested, the result is labelled as no longer the effect on the whole population.
A row whose outcome or a numeric control is infinite is set aside and counted separately: before, it could give an infinite effect reported as valid.
Two models are safer than one: doubly robust estimation
Weighting relies entirely on the score model. The doubly robust estimator combines it with a model of the outcome in each group, and , and remains consistent if either of the two is right. Each unit contributes
The three models are learned on part of the data and applied to the rest, in turn (cross-fitting), so that no unit is scored by a model that has seen it: in (4), is the fold that holds unit , and the superscript , with , marks a model fitted without that fold; the mean runs over the units. When several rows belong to the same customer or policy and that identifier is declared, the customer, not the row, is the independent observation: the folds keep each customer whole and the uncertainty is computed accordingly.
An estimate is worth little without its uncertainty. For the weighting estimator, the uncertainty is computed by resampling the units and re-estimating the score each time, so that the fact that the score itself is estimated is included. We measured how often each estimator declares an effect when there is none, at the 5% level: 5.5% for both with 1,000 units, 7.2% and 6.2% with 300 units. With 300 units the weighting estimator’s intervals were slightly too narrow (the doubly robust one stayed within simulation error), and we say so.
Before and after: difference-in-differences
When a decision starts at a known date for some units and not for others, a second family compares how the outcome changed for the treated units with how it changed for the others. Its assumption is different: without the decision, both groups would have followed parallel trends.
The usual estimator puts unit and period effects in one regression with a single treatment coefficient (two-way fixed effects). It works when everyone is treated at the same date. When the decision is rolled out in waves and its effect changes over time or across waves, it quietly uses units already treated as controls for units treated later, as if the former were untreated, and some of the treatment effects enter the average with negative weights. In our simulation with three waves and an effect that grows with time, the true average effect on the treated was 3.15; the usual estimator gave 1.74, and its 95% interval missed the truth in every one of the 100 simulated panels.
We use instead the imputation estimator of Borusyak, Jaravel and Spiess. The untreated outcome is learned only on observations that have not been treated (never-treated units, and treated units before their date), with a unit effect and a period effect ; it is then imputed for each treated observation, and the effect is the average gap over the set of treated observations:
On the same panels it found 3.15, and its interval, computed by resampling whole units, contained the truth in all of them: here the interval erred on the cautious side. A treated observation is used only when its unit and its period are linked through untreated observations; otherwise its counterfactual is not identified, and it is set aside and counted.
When the data cannot answer, the tool says so instead of returning a number, and names the reason. Three cases are refused: no treated observation is connected to untreated ones, so there is nothing to compare with; a control is not identified where it is needed, for example a characteristic that never changes on the untreated observations but differs on the treated ones, so that its share of the counterfactual cannot be learned; or the least-squares computation did not converge to a solution that passes its own check. A study of many segments records such a refusal as what it is, never as an effect.
Few treated units: an exact test instead of an interval
The interval above is obtained by resampling units, and that needs enough treated units. With few of them it fails badly. On simulated panels of 40 units over 10 periods with no effect at all, the test built on that resampling declared an effect at the 5% level in 77% of panels with a single treated unit, 32% with two and 9% with five (2,000 simulations each). The number of treated units from which its false-alarm rate stays within about one point of the 5% level (6 to 6.6% measured) is therefore learned on such simulations, not assumed: 15 for the imputation estimator.
Below that number the tool switches to a randomization test. The adoption dates are reassigned at random among the units, the effect is estimated again for each reassignment, and the observed effect is compared with the effects obtained. With reassignments, of which give an effect at least as large in absolute value as the observed one,
Only admissible reassignments are drawn: dates are exchanged only between units observed over exactly the same periods, so the number of units adopting at each date is kept and no unit receives a date outside the window in which it is observed. A reassignment for which the effect cannot be estimated counts as extreme, which can only make the test more cautious. The test is refused, with its reason, when the decision is not permanent (a unit stops being treated) or when there are too few admissible reassignments for a p-value below 5% to be possible at all. It assumes that, among comparable units, the adoption dates were as good as randomly assigned, and it is not protected against treated units whose outcomes are much noisier than the others’: we state that limit.
In the same simulations the randomization test declared an effect in 2.4% to 5.4% of panels with one to ten treated units (1,000 simulations each). It gives a p-value and no confidence interval: with so few treated units we have no interval that would deserve the name, and the report says so instead of printing one. The weighting and doubly robust estimators follow the same rule: with 5 treated rows out of 300 they declared an absent effect in 9.4% and 8.4% of simulations, so below a minimum learned in the same way (the size from which the false-alarm rate stays within about one point of the level), 10 and 8 rows in the smaller group, their estimate is reported as not validated and never kept.
Checking parallel trends without moving the effect
The parallel-trends assumption cannot be proved, but it can be contradicted. On the untreated observations, the deviations of the treated units from the common trend in the periods just before their adoption date, up to four, are tested together. This check is a diagnostic: it is computed after the effect and never changes its estimate, its p-value or its interval. A warning is shown next to the result; it does not replace it.
On those observations the check fits
where and are the unit and period effects of (5), the adoption period of unit , the deviation periods before adoption, the number of such periods tested, at most 4, the controls with their coefficients , and the noise; the indicators stay at 0 for a unit never treated and for a treated unit not observed more than 4 periods, the declared maximum, before its adoption. From the learned minimum below, the hypothesis is tested by the usual joint Wald test, its uncertainty computed by unit. Below it, the statistic is : and are the residual sums of squares without and with the deviations, both on the rows untreated under the observed assignment and under every drawn one, and its p-value follows (6), the adoption dates being reassigned as in that test.
With few treated units the usual joint test of these deviations fails as badly as the test of the effect. On the same simulated panels, where the trends were truly parallel, it raised a false alarm in 99% of panels with one treated unit and in 55% with five (2,000 simulations each). Below a learned minimum of 20 treated units (the number from which the false-alarm rate stays within about one point of the level) it is replaced by a randomization test built to be exact: the observed assignment and every drawn one are evaluated on one common set of rows, those that are untreated under all of them, so that all the statistics are exchangeable. Its false alarms stayed between 3.4% and 6.0% from one to fifteen treated units (1,000 simulations each).
Exactness has a price. Fewer rows enter the check, so it detects less. With five treated units and treated outcomes drifting away by half a noise standard deviation per period, it caught the violation in 68% of panels, against 85% for a variant that uses more rows but is not exact (500 simulations each). We chose the exact version, and a check that stays silent with few treated units is reported for what it is: weak evidence that the trends were parallel. When the check cannot run, it is reported as not validated, never as passed.
Do not mix the two designs
When the data follow the same units before and after the decision, a weighting estimator applied to every row mixes the rows from before the decision, where the effect is zero by construction, with those after. In our simulation with an effect of 2 after the decision, weighting on the whole panel gave 1.00, half the truth, while the difference-in-differences gave 1.98. On such data our tool reports the weighting estimators as not applicable and keeps the difference-in-differences.
Many segments, few real effects
A study often estimates the effect segment by segment: by product, by region, by channel. Each test has a 5% chance of a false alarm, and the chances accumulate. We simulated a decision with no effect at all, estimated in 10 segments with two estimators each. Keeping every estimate whose own p-value fell below 5% produced at least one “effect” in 60% of the studies. Our tool adjusts all the estimates of a study together before keeping any (the Benjamini-Hochberg method), and keeps every estimate it tried, with its adjusted p-value, not only those it kept; an estimate refused or not validated stays in the table with its reason and is never kept: at least one false effect then appeared in 10% of the studies. Over 100 simulated studies this figure is known only to within about ±6 points, so it is at the edge of compatibility with the intended 5%; with 300 units per segment, each individual test was also measured slightly above its nominal level (see above).
With the ordered p-values of the estimates of the study that have one, kept or not, the adjusted p-value of the -th is
An estimate is kept only if its adjusted p-value is below 5% and, for the weighting and doubly robust estimators, if it passes the balance check of (3). A refused estimate has no p-value: it does not enter , and stays in the table with its reason.
Saying it right: estimated effect, stated assumption, E-value
Our reports never write “the decision caused”. They write “the estimated effect is … under the assumption of no unmeasured confounding”, or “… of parallel trends”, and they add a number that measures how fragile the first assumption is: the E-value of VanderWeele and Ding, the minimum strength of association, on the risk-ratio scale, that an unmeasured factor would need with both the decision and the outcome to explain the estimate away. For an outcome measured on a continuous scale, with the effect divided by the standard deviation of the outcome,
An effect of 0.3 standard deviation gives an E-value of about 1.96: a hidden factor associated with both the decision and the outcome by a risk ratio of about 2 each could account for it; a weaker one could not. Two estimators that agree, such as weighting and the doubly robust estimator, rest on the same assumption: their agreement is reported as what it is, not as a proof of robustness.
The E-value of the estimate says how strong a hidden factor would have to be to bring the estimate to zero; the E-value of its interval says how strong it would have to be for the interval to reach zero. For the weighting and doubly robust estimators our tool reports both. With the 95% interval running from to and the standard deviation of the outcome in the segment, the one used for ,
that is (9) applied to the end of the interval closest to zero: an interval that already contains zero needs no hidden factor at all.
What these methods do not do
Every comparison in this article is with the usual practice: trimmed weights, the single two-way regression under staggered adoption, intervals and joint tests with few treated units, segments tested one by one. The methods we use are published ones, cross-fitted doubly robust estimation, the imputation estimator, randomization tests and the false discovery rate; we have not measured our implementation against another correct implementation of them, and we expect one to do as well. What we add is that these safeguards and refusals run by default.
They do not detect unmeasured factors: they only say how strong one would have to be. They do not check that the characteristics used were measured before the decision; a characteristic changed by the decision itself biases every estimator, and choosing them is a business question. And prediction is not causation: a series that helps to predict another one in time (the Granger test of our time-series protocol) may only share a common driver with it.
References
P. R. Rosenbaum and D. B. Rubin (1983), “The central role of the propensity score in observational studies for causal effects”, Biometrika; J. M. Robins, A. Rotnitzky and L. P. Zhao (1994), “Estimation of regression coefficients when some regressors are not always observed”, Journal of the American Statistical Association; R. K. Crump, V. J. Hotz, G. W. Imbens and O. A. Mitnik (2009), “Dealing with limited overlap in estimation of average treatment effects”, Biometrika; Y. Benjamini and Y. Hochberg (1995), “Controlling the false discovery rate: a practical and powerful approach to multiple testing”, Journal of the Royal Statistical Society B; A. Goodman-Bacon (2021), “Difference-in-differences with variation in treatment timing”, Journal of Econometrics; C. de Chaisemartin and X. D’Haultfœuille (2020), “Two-way fixed effects estimators with heterogeneous treatment effects”, American Economic Review; K. Borusyak, X. Jaravel and J. Spiess (2024), “Revisiting event-study designs: robust and efficient estimation”, Review of Economic Studies; R. A. Fisher (1935), The Design of Experiments, Oliver and Boyd; T. G. Conley and C. R. Taber (2011), “Inference with “difference in differences” with a small number of policy changes”, Review of Economics and Statistics; J. G. MacKinnon and M. D. Webb (2020), “Randomization inference for difference-in-differences with few treated clusters”, Journal of Econometrics; T. J. VanderWeele and P. Ding (2017), “Sensitivity analysis in observational research: introducing the E-value”, Annals of Internal Medicine.
More publications
PublicationsStop grouping ages in fives: let the risk draw the classes
Most tariffs still group age, seniority or vehicle power into round bands chosen by hand, and categories with many values, breeds or products, by intuition. The bands rarely fall where the risk changes. Measured on simulated portfolios with a known truth, this article shows where the usual encodings go wrong, then how our engine lets the data draw the classes: compact in risk, precise enough to carry a coefficient, and in a number chosen on data the method has not seen.
Read the articleInsurance pricingGLM, GAM or gradient boosting: choosing a pricing model an insurer can defend
Which pricing model an insurer can defend: GLM relativities, smooth GAM effects, boosting as an interaction detector, and how to compare them.
Read the articleActuarial modellingClustering high-cardinality categories before a pricing GLM
74 breeds, too many for a stable tariff: making categories comparable with target-oriented K-means instead of dropping them, validated out of sample and in the GLM.
Read the articleLet’s build better decisions together
Tell us about the decision you need to make.
A few lines are enough: your sector, the data you have and what you want to improve. We reply personally with a first view of the approach.
- A few lines are enough
- NDA on request
- Code and documentation handed over


