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

Matching for causal inference (MatchIt)

Source MatchIt — Ho, Imai, King & Stuart
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

Treatment W + covariates X

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

What happens here

Binary treatment plus the covariates to match on.

Reads fromNot specified Feeds into#2
Key code
data("lalonde", package = "MatchIt")
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 binary treatment and the covariates to match on (Lalonde job-training data).

Show data format & exampleHide example

Format — one row per unit: treatment W ∈ {0,1} and covariates X.

  W  age educ   race   re74  re75
  1   37   11  black     0     0
  0   30   12  white  4100  3800
03
Read the evidence

Results & interpretation

3 figures Workflow discussion 2
01FigureBalance after nearest-neighbour matching — standardized mean differences per covariate.
02FigurePropensity-score overlap before and after matching.
03FigureeCDF / distributional comparison of a covariate on the matched sample.

Figures reproduced from MatchIt — Ho, Imai, King & Stuart — unofficial community showcase; all credit to the original authors.

The estimate

\hat\tau_{\mathrm{ATT}}=\frac{1}{n_1}\sum_{i:\,Z_i=1}\Big(Y_i-\sum_{j} w_{ij}\,Y_j\Big)

Context & interpretation

The MatchIt vignette (Lalonde). Match, assess balance, and only then estimate. Unofficial summary.

Peer notes

Discuss the workflow (2)

  • 3

    Matching as the design stage — outcome-free — is the discipline people skip. MatchIt makes it the path of least resistance.

    2

    And match.data() → any outcome model. Pairs perfectly with cobalt for the balance plots.

  • 6

    Nearest, optimal, full, genetic — all behind one matchit() call. Great teaching tool.

IN THE MARGINS

Peer discussion