Skip to content
StatsOtter A workspace for causal thinking
Method library WORKFLOW / 066
Research workflow/4 steps

Bias-corrected nearest-neighbor matching (Matching)

01
The method workspace

Follow the analysis.

Select a node to explore the method

Method mapInput → 4 steps → output
START WITHInput data
ARRIVE ATResults
Read step 01
Inside the methodReasoning, equations & implementation
Step 1 of 4
01
Data prep

Fit the propensity score model

Data preparation — shapes the raw inputs into what the estimator expects.

What happens here

Estimate the propensity score with a logit of treatment on the LaLonde covariates (Dehejia-Wahba specification).

Formula
e(X_i) = \Pr(T_i = 1 \mid X_i)
Reads fromNot specified Feeds into#2
Key code
# Install:  install.packages("Matching")
library(Matching)
data(lalonde)
glm1 <- glm(treat ~ age + I(age^2) + educ + I(educ^2) + black +
              hisp + married + nodegr + re74 + I(re74^2) +
              re75 + I(re75^2) + u74 + u75,
            family = binomial, data = lalonde)

Reference / docs ↗

Discussion on this step (0)
StatsOtterDiscussion starter · Editorial note

Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.

Questions to explore
  1. Which assumption matters most here, and what evidence could challenge it?
  2. What would you check before passing this output to the next step?

Peer discussion

  • Bring your experience, a question, or a different perspective.
02
Data contract

Inputs & data

A treatment indicator Tr, an outcome Y, and a matrix of covariates X (or estimated propensity scores).

Show data format & exampleHide example
Y Tr age educ
12.0 1 34 12
9.5 0 31 11
14.2 1 45 16
8.8 0 29 10
03
Read the evidence

Results & interpretation

1 figure Workflow discussion 0
01FigureBias-adjusted ATT with the Abadie–Imbens standard error (95% confidence interval).

Result figure rendered by StatsOtter from the package's documented example — unofficial community showcase; all credit to the original authors.

The estimate

\hat\tau_{\mathrm{ATT}}=\frac1{n_1}\sum_{Z_i=1}\big(Y_i-\hat Y_i(0)\big),\quad \hat Y_i(0)=\frac1M!\sum_{j\in\mathcal J_M(i)}! Y_j

Context & interpretation

⚠️ Unofficial community showcase of Matching (docs). Not affiliated with the authors — all credit to Guido Imbens & coauthors; this summarizes public documentation.

What it does. Estimates treatment effects (ATE/ATT) in observational data by pairing each treated unit with similar control units on covariates or a propensity score. How it works. It performs multivariate nearest-neighbor matching (with replacement), optionally applies a regression-based bias correction for inexact matches, and—uniquely—computes the Abadie-Imbens variance estimator instead of naive standard errors. Sekhon's package also supports genetic matching to optimize covariate balance. Assumptions. Unconfoundedness (selection on observables) and overlap/common support between treated and control covariate distributions. Imbens's contribution. Abadie & Imbens (2006, Econometrica) derived the large-sample properties of matching estimators and showed that the bootstrap is invalid for matching, motivating their analytic variance estimator and bias correction—exactly what Matching implements via BiasAdjust and its standard errors.

What you get — Estimated ATT/ATE with Abadie-Imbens standard errors and covariate balance diagnostics.

Example output

Estimate...  1824.2
AI SE......  802.3
T-stat....   2.2738
p.val.....   0.022972

Original number of observations..............  445
Original number of treated obs...............  185
Matched number of observations...............  185
Matched number of observations  (unweighted).  314

***** (V1) age *****
                       Before Matching    After Matching
mean treatment........    25.816            25.816
mean control..........    25.054            25.692
std mean diff.........    10.655             1.7370
T-test p-value........   0.26594            0.81080

Links: package · paper

Peer notes

Discuss the workflow (0)

  • No comments yet — start the conversation.
IN THE MARGINS

Peer discussion