In MatchIt, exact matching forms strata from every observed combination of the covariates in the formula, then keeps only strata containing both treated and control units. Use method = "exact" when those covariates must match exactly; expect units without comparable counterparts to be dropped.
What exact matching does in MatchIt
Exact matching crosses the formula covariates to define subclasses. Within every retained subclass, treated and control observations have identical values on all included covariates. A subclass containing only treated units or only controls is discarded.
This provides exact balance on the covariates you specify, without relying on a treatment or outcome model’s functional form to achieve that balance. It does not remove confounding from variables you did not include.
Run exact matching
For example, the following matches the Lalonde data exactly on age, race, marital status, and education, with the ATT as the requested estimand:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
m.out <- matchit(
treat ~ age + race + married + educ,
data = lalonde,
method = "exact",
estimand = "ATT"
)
The covariates on the right side of the formula define the exact strata. The documented estimands are ATT, ATC, and ATE; the chosen estimand determines how matching weights are calculated. Sampling weights passed with s.weights are used in balance statistics, but do not change the matching process. See the MatchIt exact-matching reference and the MatchIt function reference.
Exact matching on only some covariates
If only selected variables must match exactly, use another matching method and pass those variables through its exact argument. For instance, nearest-neighbor matching can require exact agreement on sex and race while using a distance measure for other covariates. This avoids requiring identical values across every variable in the formula. The MatchIt CRAN manual documents combining exact constraints with other methods.
Rank #2
- This guide is a perfect overview for the topics covered in introductory statistics courses.
Why exact matching can discard many observations
Every additional covariate contributes to the joint profile that must be shared by treated and control units. Many levels, sparse combinations, or raw continuous measurements can leave few strata with both groups. Units in unsupported strata are excluded, reducing the usable sample and potentially the precision of an estimate.
Discarding can also change the practical target population: an ATT calculated on retained support may not describe all treated units in the original data. Inspect which observations remain before interpreting the estimate. MatchIt describes these support and precision trade-offs in its matching methods overview.
Rank #3
Arguments and output to check
For method = "exact", formula variables define the strata. Arguments for distance estimation, the separate exact option, Mahalanobis variables, discarding, replacement, matching order, calipers, and ratio are ignored with a warning. Do not assume these settings alter exact matching when supplied.
The result includes subclass membership, matching weights, and balance information. It does not include a match.matrix: exact matching is represented as strata, not as treated-unit-indexed pair records.
Rank #4
Diagnose the matched design before estimating an effect
- Count retained treated and control units and identify how many were excluded for lack of a counterpart.
- Review subclass membership and sizes to see whether support is concentrated in a small number of profiles.
- Inspect matching weights and effective sample size; a nominally retained sample does not by itself show how much information contributes to the estimate.
- Check balance summaries and make sure the retained sample answers the substantive question you intend to study.
- Report that conclusions concern the matched support, and describe any meaningful exclusions.
Retention and balance are dataset-specific; there is no general percentage of observations that exact matching will keep. Calculate them from your own MatchIt result rather than relying on a rule of thumb.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.When to choose exact matching
Choose it when exact equality on a small, substantively essential set of covariates is more important than retaining every observation, and the data contain enough overlap for useful strata. If raw continuous values or numerous categorical variables make strata too sparse, consider requiring exact agreement only on the essential variables and using a distance-based method for the rest. Coarsening continuous values is another possible design choice, but it changes what “exact” means: units match on the chosen categories or bins, not on their original measurements.
Best Value
Compared with nearest-neighbor or optimal matching, exact matching guarantees equality on its specified covariates rather than selecting close or optimized matches. Subclassification and coarsened exact matching use different ways of grouping or balancing observations; the right choice depends on the balance requirement and support available in your data. MatchIt supports these as distinct methods, as outlined in its project repository.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

