You can't always run an experiment. Sometimes the data already exists, the treatment was already chosen — usually for a reason — and your job is to rebuild a fair comparison out of it. That's what matching does. This playbook walks through the whole job, step by step: spotting imbalance, measuring how different two patients are, finding good matches, checking that it worked, analyzing the outcome, and stress-testing the result — then doing the same thing, faster, with propensity scores.
One running example carries the whole post: diabetes patients who were prescribed either metformin, the standard older drug, or an SGLT2 inhibitor, the newer drug. Nobody flipped a coin. Doctors chose — and that choice is exactly the problem we have to solve.
The motivating factor for matching is that we can't always do a randomized controlled trial [randomized controlled trial, RCT]. Trials can be expensive, and sometimes they're unethical. If you want to understand the effect of smoking on lung cancer, you can't really ask people to smoke.
So instead we work with data that already exists. The treatment was already given, the outcomes already happened, and we're observing what took place. That's an [observational study]. Matching is how we build a treatment group and a control group out of that existing data — essentially, we try to recreate the fair comparison a trial would have given us.
In a trial, random assignment doesn't control any patient's characteristics directly — it makes the distributions of background characteristics [covariates] the same in both groups, on average [in expectation]. A background characteristic that differs between the groups and affects the outcome is a [confounder], and it's what makes a raw comparison misleading.
In our diabetes example, look at baseline HbA1c — a measure of blood sugar over the past few months, taken before treatment. Patients on the newer SGLT2 drug tend to have higher baseline HbA1c than patients on metformin. Why? Because doctors tend to prescribe the newer drug to patients whose diabetes is more severe or less controlled. So if the SGLT2 group ends the study with higher HbA1c, is that the drug failing — or did that group simply start out sicker? With the raw data, you can't tell.
Before matching: the treatment group's baseline HbA1c is shifted to the right — they started out sicker (mean 8.9% vs. 8.1%). Toggle to After matching to see the goal: the two distributions sit almost on top of each other (mean 8.8% vs. 8.75%). Illustrative distributions built from the Table 1 values in Section 7.
The whole point of matching is to fix that: to control for the covariate when all we have is observational data — to get [covariate balance].
We do it by pairing each patient in the treatment group with a similar patient in the control group, and — this part matters — we do the matching before looking at the outcomes. We're blind to the outcomes while we build the groups, just like a trial is set up before anyone's outcome is known.
Sometimes the matching process reveals that a treated patient has no similar patient in the control group. That patient has to be excluded — we can only include treated patients who plausibly could have been in the control group. The range of patients where both groups actually exist is called the [common support], and dropping patients outside it quietly changes who your answer applies to. Keep count of who you drop, and say so when you report results.
Start simple, with a single covariate: baseline HbA1c. The problem that can occur is [covariate imbalance] — the distribution of the covariate we're trying to control for differs between the treatment and control groups.
A binary example makes it easiest to see. Suppose 80% of the treatment group are smokers and only 10% of the control group are. That's a big imbalance — and if smoking affects the outcome, a naive comparison of the groups mostly compares smokers to non-smokers, not drug to drug.
HbA1c is continuous, so to check its balance the same way, we bucket it into groups:
| Baseline HbA1c group | Range | Treatment share (example) |
|---|---|---|
| Mild | 7.0% – 7.9% | 30% |
| Moderate | 8.0% – 8.9% | 40% |
| Severe | 9.0% and above | 30% |
Bucketing a continuous covariate turns “are the distributions similar?” into a simple comparison of shares, group by group.
Now matching, in its simplest form: every patient in the treatment group gets a match from the control group with the same (or very similar) value of the covariate. Control patients who aren't matched are discarded from the analysis. If the treatment group is 30% mild, 40% moderate, 30% severe, the matched control group is built to be 30 / 40 / 30 as well. The covariate is now balanced — by construction.
In reality there won't be one covariate to balance — there will be many. And there probably won't be a perfect control match for every treated patient. The idea is to get close enough that the distributions of the covariates are balanced between the groups, the way they would be in a trial.
Notice what a trial gives you, because it's the target: not identical patients, but groups that look the same as a whole. That's [stochastic balance] — the distributions (means, spreads, shapes) of the covariates are the same across the two groups, in expectation. You aren't matching clones; you're making the groups, in aggregate, statistically alike. In any one realized trial — or any one matched sample — small differences remain just by chance. Balance is a property we're aiming at, not a guarantee.
For example, say we also want to control for age. Now each treated patient needs a control patient who matches on HbA1c severity and is close in age — say, within ±3 years. That “within this much, and no more” rule is a [caliper], and we'll come back to calipers in Section 6.
Look at what we just did: we took the treated group as given, and we built a control group that looks like them. So the combined matched sample has the covariate distribution of the treated group — and the effect we estimate is the effect of treatment on the treated:
That's different from the effect averaged over the entire population, treated and untreated alike — the [average treatment effect, ATE]. It's possible to match in a way that targets the ATE, but it's more involved and out of scope here. Most of the time in matching, we're estimating the ATT.
Matching only balances the covariates you measured. The claim that matching those is enough — that, once we condition on the measured covariates, treatment is as good as randomly assigned — is the [ignorability / no unmeasured confounding assumption]. It's an assumption, not something the data can prove. Section 9 is about stress-testing it.
Sometimes you can't get an exact match for each individual patient — but you can still get the group distributions exactly right. That's [fine balance].
Consider four patients, controlling for HbA1c severity, smoking status, and age. We insist on an exact match on HbA1c severity. Patient 1 (treated) is severe, a smoker, age 40 — but the only severe control patient, Patient 2, is a non-smoker, age 25. Patient 4 is a smoker, age 40, like Patient 1 — but Patient 4's HbA1c is mild, so that pairing breaks our exact-severity rule. Patient 3 (treated) has the mirror-image problem.
| Patient | Pair | Group | HbA1c severity | Smoking | Age |
|---|---|---|---|---|---|
| 1 | Match 1 | Treatment (SGLT2) | Severe (10.5%) | Smoker | 40 |
| 2 | Match 1 | Control (metformin) | Severe (10.5%) | Non-smoker | 25 |
| 3 | Match 2 | Treatment (SGLT2) | Mild (7.2%) | Non-smoker | 25 |
| 4 | Match 2 | Control (metformin) | Mild (7.2%) | Smoker | 40 |
Neither pair matches exactly on smoking or age. Now look at the two groups as a whole.
Match 1 with 2, and 3 with 4. Neither pair is an exact match — but in aggregate, both groups are identical on every covariate:
| Share of group | Treatment (Patients 1 & 3) | Control (Patients 2 & 4) |
|---|---|---|
| Severe / Mild HbA1c | 50% / 50% | 50% / 50% |
| Smoker / Non-smoker | 50% / 50% | 50% / 50% |
| Age 40 / Age 25 | 50% / 50% | 50% / 50% |
This is the statistical heart of the example: perfect balance on the [marginal distributions] — the overall percentage of smokers, of severe cases, of 40-year-olds in each group — while relaxing the [joint distribution]: no single pair is simultaneously Severe and Smoker and 40. Various statistical packages will construct a fine balance for you automatically.
Three common shapes:
Choosing between them is a [bias–variance trade-off]. The easiest way to feel it is picky quality vs. sample size.
Imagine 100 treated patients on the new drug and a big pool of 2,000 control patients on the old one. You're shopping in that pool to build a comparison group. Take one treated patient whose baseline HbA1c is 9.50%:
| Match | Control's baseline HbA1c | Gap from 9.50% |
|---|---|---|
| 1st closest | 9.50% | 0.00 |
| 2nd closest | 9.45% | 0.05 |
| 3rd closest | 9.35% | 0.15 |
| 4th closest | 9.20% | 0.30 |
| 5th closest | 9.05% | 0.45 |
Average of all five controls: 9.31% — a 0.19-point gap from the treated patient's 9.50%. That gap is leftover confounding [residual bias] sneaking back in.
1-to-1 matching: low bias, high variance. You only need the single best twin in the pool of 2,000, so the baseline difference is basically zero — almost no confounding bias. But you keep only 100 controls and discard 1,900. If that one matched control happens to be a fluke — they caught a bad flu, started an extreme diet — that noise lands at full weight on your estimate. Small sample, wider standard errors: high variance.
Many-to-1 matching: higher bias, lower variance. Use 5 controls per treated patient and you keep 500 controls instead of 100. Individual flukes average out and confidence intervals shrink. But matches 3, 4, and 5 are progressively worse — in a pool with more mild patients than severe ones, reaching deeper means grabbing healthier and healthier controls, and the bias that matching was supposed to remove creeps back.
Built directly from the five matches in the table above. The bias bar is the gap between 9.50% and the average HbA1c of the k controls used. The variance bar is relative: standard error shrinks roughly like 1/√k as the control group grows. It is an illustration of the shape of the trade-off, not a calculation for a real dataset.
To match, we first have to quantify how far apart each treated patient is from every control patient. The standard tool is a formula called the [Mahalanobis distance]:
Suppose, just to keep the arithmetic friendly, that HbA1c and age are uncorrelated, with standard deviations of 1.3 points and 10 years. Then Mahalanobis distance is simply the distance between the standardized differences. Patient A is (HbA1c 9.5, age 60).
So B is the closer match for A — even though C matches A exactly on HbA1c — because a 20-year age gap is two standard deviations, and that outweighs B's one-standard-deviation gap on each of two covariates. Raw, unscaled distances would have called the 20-year gap and the 1.3-point gap incomparable — which is exactly the problem the scaling solves.
One variation worth knowing: the [robust Mahalanobis distance] computes the distance from the ranks of the covariates instead of their raw values. The motivation is outliers: one extreme patient shouldn't be able to stretch the scale and distort everyone else's distances. Ranks cap how much any single value can pull.
If some covariates must match exactly — say, HbA1c severity group — there's a neat trick. Compute all the distances as usual, then add a rule: if two patients differ at all on a must-match covariate, set their distance to infinity. Those pairs will now never be chosen, whatever their other covariates look like. Exactness enforced by arithmetic.
Now that we have a distance between every treated patient and every control patient, we need an algorithm to actually pick the pairs. There are two families — greedy and optimal — and, in the real world, the control pool is usually much larger than the treatment group, which is what makes either of them feasible.
For many-to-one matching, the same idea repeats: cycle through the treated list again to find each patient's second match, and so on — though software implementations differ in the details, so check your package's documentation for exactly what it does. In R, MatchIt is the standard package here.
The benefits: it's fast [computationally efficient] and easy to understand. The drawback: the order you process the treated patients in matters. Each individual pick is the best available at that moment, but taken together the pairs may not minimize the total distance across all matches — early patients can grab controls that would have been a much better fit for someone later, and late patients can be left with poor matches. Greedy is not [globally optimal].
A [caliper] is a threshold: a maximum distance beyond which you refuse to match, full stop. During matching, if a treated patient's closest available control is farther away than the caliper, that treated patient is discarded rather than badly matched.
Calipers also help enforce the [positivity assumption]: every patient pattern in the study needs a genuine, non-zero chance of appearing in either group — formally, 0 < P(A = a | X) < 1 for every treatment value a (a = 0 and a = 1). For our binary treatment that's exactly the same statement as 0 < P(A = 1 | X) < 1, because the chance of being a control is whatever is left over: P(A = 0 | X) = 1 − P(A = 1 | X), so if the treatment chance sits strictly between 0 and 1, the control chance automatically does too. A treated patient with no control patient anywhere nearby is a warning sign that patients like them essentially never appear in the control group — that they had close to a zero chance of being there. The caliper turns that warning sign into an exclusion rule.
Optimal matching flips the priority. Any individual treated patient might not get their single best control — but the sum of the distances across all matches, taken together, is as small as it can possibly be [globally minimized].
The cost is computation: in principle, the algorithm has to weigh combinations of pairings, and the size of the problem grows with the number of possible pairings — treated × control:
| Possible pairings | Example | Practical verdict |
|---|---|---|
| 100,000 | 100 treated × 1,000 controls | Likely feasible |
| 1,000,000 | 1,000 treated × 1,000 controls | May take a while — still feasible |
| 1,000,000,000 | 100,000 treated × 10,000 controls | Probably not feasible |
Rules of thumb, not hard limits — real feasibility depends on the algorithm, the sparsity of the problem, and your machine. In R, the packages are optmatch and rcbalance.
A practical compromise: split the dataset into subgroups — by region, by condition, by any variable it's sensible to match within — and run optimal matching inside each subgroup. With 10 roughly equal regions, the number of candidate pairings falls to about a tenth of the original problem (each region holds roughly 1/100 of the pairings, and there are 10 of them), and because the algorithm's runtime grows faster than the number of pairings, the time saving is even bigger than that. Smaller problems, same global-optimality idea inside each block.
Matching is a claim — “the groups are now comparable” — and balance checking is how you show your work. The standard display is Table 1: the table (usually the first in a study, hence the name) that compares the covariate distributions of the two groups before and after matching.
Here is a Table 1 for our diabetes example. Read it across: before matching, the groups differ a lot — especially on baseline HbA1c, the very variable doctors used to choose the drug. After 1-to-1 matching, 212 of the 240 treated patients found a match (28 had no comparable control and were dropped — remember Section 1: say who was dropped), and every difference shrinks to near zero.
| Covariate | Before matching | After matching | ||||
|---|---|---|---|---|---|---|
| Treated (n=240) | Control (n=960) | |SMD| | Treated (n=212) | Control (n=212) | |SMD| | |
| Age, years — mean (SD) | 58.4 (10.2) | 54.9 (11.0) | 0.33 | 57.9 (10.4) | 57.6 (10.6) | 0.03 |
| Baseline HbA1c, % — mean (SD) | 8.9 (1.3) | 8.1 (1.2) | 0.64 | 8.8 (1.25) | 8.75 (1.22) | 0.04 |
| BMI — mean (SD) | 32.4 (5.8) | 30.1 (5.4) | 0.41 | 32.1 (5.6) | 31.9 (5.5) | 0.04 |
| Smoker — % | 34% | 19% | 0.35 | 32% | 31% | 0.02 |
| Male — % | 52% | 47% | 0.10 | 51% | 50% | 0.02 |
| Severe baseline HbA1c (≥ 9%) — % | 46% | 22% | 0.52 | 43% | 42% | 0.02 |
Illustrative Table 1 constructed for this example. Every SMD shown is the value the formula below produces from the means, SDs, and percentages in its row — check one by hand if you like (the prove-it box shows you how).
The comparison number in each row is the [standardized mean difference, SMD]: the difference between the two groups' means, divided by a pooled standard deviation, so the result is in “standard deviation units” and comparable across covariates measured on completely different scales.
Before matching: (8.9 − 8.1) / √[(1.3² + 1.2²)/2] = 0.8 / √[(1.69 + 1.44)/2] = 0.8 / √1.565 = 0.8 / 1.251 ≈ 0.64. ✓ After matching: (8.8 − 8.75) / √[(1.25² + 1.22²)/2] ≈ 0.05 / 1.235 ≈ 0.04. ✓
How to read an SMD — the widely used rule of thumb:
There is nothing magic about 0.1 — it's a convention, not a cliff edge. The point of the scale is that it means the same thing for age in years, HbA1c in percent, and smoking as a percentage.
A [Love plot] (named for biostatistician Thomas Love) puts every covariate's |SMD| on one chart. Before matching, several covariates sit far to the right of the 0.1 line. After matching, every dot hugs zero. If a covariate is still out past the line, that's your to-do list for re-matching — you can see it at a glance, no table required.
You could test each covariate for a “statistically significant difference” — but significance answers the wrong question here, because a p-value mixes together how big a difference is with how much data you have. Put the two formulas side by side and the difference is visible:
The groups are built and balanced — and we still haven't looked at the outcomes. Now we do. Everything in this section respects the pairing: the matched pairs are the unit of the design, and the analysis has to act like it.
Let the outcome be: did the patient's HbA1c fall by 3 percentage points or more? Code it 1 for yes, 0 for no. Six matched pairs might look like this:
| Matched pair | Treated outcome | Control outcome | Pair type |
|---|---|---|---|
| 1 | 0 | 0 | Concordant — same |
| 2 | 1 | 1 | Concordant — same |
| 3 | 0 | 1 | Discordant — different |
| 4 | 1 | 0 | Discordant — different |
| 5 | 0 | 1 | Discordant — different |
| 6 | 1 | 1 | Concordant — same |
Pairs where both patients have the same outcome are [concordant pairs]; pairs where they differ are [discordant pairs]. The treated group's total [test statistic] here is 0+1+0+1+0+1 = 3.
Now the permutation idea [also called a randomization test or exact test]. The null hypothesis is the sharp one: the treatment made no difference for anyone [Fisher's sharp null hypothesis]. If that's true, then within each pair, which patient happened to get the treatment was effectively a coin flip — so swapping the two outcome labels inside a pair changes nothing about what “no effect” looks like.
So: for each discordant pair, flip a coin. Heads, swap the pair's outcomes between treated and control; tails, leave them. (Concordant pairs need no flip — swapping identical values changes nothing.) Recompute the treated total. Do it again. And again — say 1,000 or 10,000 times. You build the distribution of the treated total in a world where treatment does nothing, and then ask: how unusual is the total we actually observed, 3?
A teaching moment hiding in this example: the observed total, 3, sits almost exactly in the middle of the no-effect distribution. For a two-sided test, “as or more extreme than 3 in either direction” covers essentially every possible outcome — the exact two-sided p-value is 1.0. Six pairs with this pattern contain no evidence of a treatment effect at all, and the permutation distribution shows you why at a glance, before any test is run.
The permutation logic above is the theory. Day to day, for paired binary outcomes, you run [McNemar's test]. First collapse the pairs into a 2×2 summary — count pairs by (treated outcome, control outcome):
| Control outcome = 1 | Control outcome = 0 | |
|---|---|---|
| Treated outcome = 1 | 2 | 1 (b) |
| Treated outcome = 0 | 2 (c) | 1 |
Only the discordant cells carry information about a treatment difference: b = 1 pair where only the treated patient had the outcome, c = 2 pairs where only the control patient did. McNemar's statistic, with the usual continuity correction, is (|b − c| − 1)² / (b + c) = (1 − 1)² / 3 = 0 — a p-value of 1.0, matching the permutation result above. In R: mcnemar.test(matrix(c(2, 2, 1, 1), nrow = 2)) — note that R fills matrices down columns, so that ordering reproduces this table.
The same idea works for a continuous outcome — here, the change in HbA1c itself rather than a yes/no version of it:
| Matched pair | Treated: HbA1c change | Control: HbA1c change | Pair difference (Treated − Control) |
|---|---|---|---|
| 1 | −1.8 | −1.1 | −0.7 |
| 2 | −2.6 | −1.4 | −1.2 |
| 3 | −0.9 | −1.2 | +0.3 |
| 4 | −3.1 | −1.0 | −2.1 |
| 5 | −1.5 | −0.8 | −0.7 |
| 6 | −2.2 | −1.6 | −0.6 |
Illustrative values. The effect estimate is the average of the pair differences: (−0.7 −1.2 +0.3 −2.1 −0.7 −0.6) / 6 = −5.0 / 6 ≈ −0.83 percentage points — on average, treated patients' HbA1c fell about 0.83 points more than their matched controls'. Check the arithmetic yourself; that's the prove-it habit.
You can permutation-test this too: flip the sign of each pair difference by coin flip, recompute the average, repeat, and see where −0.83 falls in the no-effect distribution. In practice, the everyday tool is the [paired t-test] on the pair differences — the same average difference, with a standard error computed from how much the pair differences vary.
Other outcome models built for matched or clustered designs include [conditional logistic regression] (binary outcomes), a [stratified Cox model] (time-to-event outcomes), and [generalized estimating equations, GEE]. The common thread: the standard errors must account for the matched design. Analyzing matched data as if the patients were independent throws away the design you worked to build.
Even after carefully matching on every confounder we can see — baseline HbA1c, smoking, age — an observational study still has a problem matching cannot solve: [unmeasured confounding / hidden bias]. There may be factors that influenced which drug a patient got and how they did, which were never captured in the data (or which we chose not to use).
Example: “patient motivation,” as expressed through diet and exercise habits. It's not in our dataset. But suppose providers tend to prescribe the SGLT2 inhibitor to patients they judge to be motivated — good diet, regular exercise. Then part of the SGLT2 group's better outcomes might be their habits, not the drug. Matching on everything we measured can't remove a variable we never measured.
[Sensitivity analysis] is the stress test that follows. At a high level it asks one question: how much hidden bias would there have to be for the result we observed to change? If it takes a lot of hidden bias to overturn the result, the study is robust. If a little would do it, the study is fragile — and we can measure “how much” mathematically.
Take one matched pair: Patient i got the new drug, Patient j got the standard drug, and on paper they're clinical twins — same baseline HbA1c, smoking status, age. Call their true (pre-treatment) probabilities of being prescribed the new drug πi and πj.
Since we can't measure the hidden factor, we instead bound how much it could have tilted things, using a multiplier called [Γ, the Rosenbaum sensitivity parameter]:
What Γ means inside a single pair, in probability terms: with no hidden bias (Γ = 1), each of the two “twins” had a 50% chance of being the treated one. With hidden bias bounded by Γ, that chance for a given patient can range from 1/(1+Γ) up to Γ/(1+Γ). At Γ = 2, the split could secretly have been as lopsided as 33% / 67% instead of 50% / 50%.
We don't re-match anything. We keep the same pairs and repeat the outcome test, assuming the worst case: that the hidden bias is working entirely in the treatment's favor. As Γ rises from 1, the worst-case p-value rises with it — we're steadily allowing “maybe it was the hidden habits, not the drug” to explain more of the result. The value of Γ where the worst-case p-value crosses 0.05 — where the result stops being statistically significant — is the [tipping point].
A rough guide to reading a tipping point:
| Tipping point Γ | How to read it |
|---|---|
| 1.0 – 1.2 | Very fragile — even a tiny unmeasured bias could explain the result away |
| 1.3 – 1.5 | Moderately sensitive |
| 1.6 – 2.0 | Moderately robust — often considered a reassuring range |
| 2.0 – 3.0 | Highly robust |
| Above 3.0 | Very robust |
Treat this as a rough interpretive heuristic, not a universal scale: a Γ only means something relative to the confounding you did measure. The strongest reporting puts the tipping point next to the observed influence of known strong confounders — “an unmeasured factor would have to matter more than baseline HbA1c itself” is a claim a reader can actually judge.
Report it in plain language either way: “an unmeasured confounder would have to increase a patient's odds of receiving the new drug by 2.5-fold before it could invalidate our conclusion” is a sentence any decision-maker can weigh.
Everything so far matched on the covariates themselves. There's a second route: match on one summary number per patient — the [propensity score], the probability that a patient with their particular covariate values receives the treatment:
Why is matching on this one number legitimate? Because of the propensity score's [balancing property]: among patients with the same propensity score, the distribution of covariates is the same in the treatment and control groups — stochastic balance, achieved through the score:
Written out as shares instead of symbols, the same property says:
Put together, the formula says: filter to patients who all share the same propensity score, and the share with any given covariate combination is the same in the treated group as in the control group.
Note carefully what it does not say: it does not say individual patients i and j have identical covariates (xi = xj). It's a statement about group distributions, not about pairs.
Good catch, and yes — this really is different from fine balance, in an instructive way. Fine balance (Section 3) is something we construct in a matched sample: we enforced the marginal distributions exactly — same % smokers, same % severe, same % age 40 in each group — and we got that precisely by giving up on the joint pairing inside each pair. Look back at that table: the treated group's combinations were (severe, smoker, 40) and (mild, non-smoker, 25), while the control group's were (severe, non-smoker, 25) and (mild, smoker, 40). Marginals identical; joint combinations completely different.
The propensity balancing property is a stronger claim, but of a different kind. It isn't something we construct pair by pair — it's a fact about the population, at an exact propensity score: because x in the formula above is a whole combination of values, not one variable at a time, the equality covers the joint distribution too — in expectation. Two honest caveats keep that from being magic: (1) it holds at an exact score value, while real matching groups together patients with similar scores, so in a real matched dataset the balance — marginal and joint — is approximate, with the usual finite-sample wobble; and (2) it still says nothing about individual pairs being identical. Short version: fine balance = exact marginals, by construction, in your sample. Propensity balance = marginals and joints, in expectation, in the population at a fixed score — which your matched sample then approximates.
Filter the data to patients whose propensity score is 0.7, and picture 100 of them. Each of these patients had, by construction of the score, a 70% probability of receiving the treatment — as if, without looking at their outcomes, we walked down the rows flipping a coin weighted 70% heads / 30% tails, heads meaning “treated.” A weighted coin, flipped independently of everything else about the patient, cannot sort smokers into one group and non-smokers into the other — so, in expectation, the covariate mix is the same among the treated and the controls in this slice.
Two careful words in that paragraph matter. First, in expectation: a 0.7 score doesn't guarantee exactly 70 of the 100 patients were treated — the realized count bounces around 70 the way coin flips do. What the balancing property guarantees is the mechanism: treatment behaves like a (weighted) coin flip that doesn't depend on the covariates, so there is no systematic sorting. In a large group, the shares land close to equal; in a small one, expect wobble — the same fine print that applies to stochastic balance in a real randomized trial. Second, this works for joint combinations too, not just one covariate at a time: the coin doesn't know whether a patient is simultaneously “mild HbA1c, smoker, and young,” so that combination is also distributed evenly in expectation.
That's the whole mathematical permission slip: because balance is preserved through the score, matching on the score is matching on the covariates — compressed.
How do we actually do it? First, look. Plot the distribution [histogram] of propensity scores, split by treatment group, and check the [overlap]:
How to read this chart: it's one chart, mirrored. Control patients (metformin) are plotted above the axis and treatment patients (SGLT2) below it, over the same propensity-score scale — so wherever you see bars on both sides at the same score, both groups exist there and matching is possible. Counts are illustrative patients per score bin. Good overlap: across most of the range, both sides have bars. Toggle to Poor overlap to see the problem case.
One pattern to expect in the good-overlap picture: the treated group's scores lean higher than the control group's. That isn't circular — the score is a pre-treatment prediction, built only from baseline covariates. It leans that way because the covariate patterns that make treatment likely (more severe disease, for instance) genuinely are more common among the patients who ended up treated. The score summarizes why the groups differed in the first place.
In the poor-overlap picture, look at the ends. Near a score of 0, there are (almost) only control patients: patients like them essentially never got the treatment. Near 1, only treated patients. Those regions are deterministic, and matching there would mean pretending a comparison exists where it doesn't — a violation of the positivity assumption from Section 6.
The fix is to restrict the study to the region where both groups exist — [trimming] to the common support. The simple version of the rule:
Cleaner, but not free: trimming changes the population your estimate describes, and if you trim a lot of treated patients, your ATT is now the effect on the matchable treated — which is exactly why we report who was dropped. (More refined overlap rules exist; the min/max rule is the transparent starting point.)
Sometimes nearly all the scores pile up near zero — for a rarely prescribed drug, a typical probability of treatment might be 0.01. Distances between scores like 0.008 and 0.02 are tiny on the probability scale even though one patient was two-and-a-half times as likely to be treated as the other. The fix is to match on the [logit transformation] of the score instead:
Same caliper idea as Section 6, now on the logit-of-score scale. The widely used rule of thumb: a caliper of 0.2 times the standard deviation of the logit of the propensity score. Fine-tune it — 0.1 for a tighter, pickier match; wider than 0.2 if you're discarding too many treated patients — and recognize the familiar trade-off underneath: a tighter caliper means fewer matches — the matches you keep are closer (less bias), but with fewer patients your estimate wobbles more (more variance), and more treated patients get discarded entirely. A wider caliper admits more potential matches — more patients, so less variance — but the extra matches are worse ones (more bias).
Once the propensity-score matches are made, everything from Sections 7–9 applies unchanged: check balance (on the original covariates, not just the score), analyze outcomes respecting the pairs, and run the sensitivity analysis.
The whole job, in code (R sketch) — the shape of a real run, to adapt, not to copy blindly:
# 1. Estimate propensity scores + match (logit-scale distance)
library(MatchIt)
m <- matchit(treated ~ baseline_hba1c + smoker + age + bmi + male,
data = diabetes, method = "nearest", distance = "glm",
link = "logit", ratio = 1,
caliper = 0.2) # 0.2 x SD of logit score (std.caliper)
# 2. Check balance BEFORE touching outcomes
summary(m) # SMDs, before vs after
plot(m, type = "love") # the Love plot from Section 7
# 3. Analyze outcomes respecting the pairs
matched_data <- match.data(m) # carries pair ids (subclass)
# binary outcome: mcnemar.test(...) on the pair table (Section 8)
# continuous outcome: paired t-test on pair differences (Section 8)
# 4. Stress-test: sensitivity analysis for hidden bias (Section 9)
# e.g. rbounds / sensitivitymv packages implement Rosenbaum bounds
Package names from the draft and standard practice: MatchIt for matching, optmatch / rcbalance for optimal matching. The order of the steps is the discipline: estimate, match, check balance, and only then look at outcomes.
Matching doesn't turn observational data into a randomized trial. It does something almost as useful: it makes the comparison honest — groups that start alike on everything you can see, an analysis that respects how they were built, and a stated price, in Γ, for everything you can't.