# Propensity score match with exact matching on one variable

I would like to compare survival outcomes of two groups (control vs. treatment). Because of imbalances of baseline covariates, I used propensity score matching using nearest neighbor matching. After matching, covariate balance is very good except for one variable. I have heard before that in such a case, one can use exact matching only on the one variable. How is this done? Do I first do the nearest neighbor matching, and perform exact matching on this matched population? Or is there another way? Also, if someone knows an R tutorial for this, I would be delighted if someone would share it with me.

• You also need to adjust for outcome heterogeneity within treatment group, and to allow overlapping matched sets, to get proper performance. So what made you choose propensity score adjustment over the better functioning standard covariate adjustment? The matching algorithms used by most analysts results in discarding valid observations, which is really statistically suboptimal. Commented Jan 30, 2022 at 13:44
• I would be very interested in this scenario as well. Unfortunately the vignettes do not provide a very extensive tutorial on this combination of i.e. nearest-neighbour and exact matching. Should the covariates that one wants to perform exact matching on become apparent in the other matching method as well? In the above case x2 and x3 are apparent in both matching methods, even though the "other" matching method is unspecified in that r code.
– user389026
Commented Jun 10, 2023 at 13:55

All R packages that implement matching implement an exact matching restriction. In MatchIt, you use the exact argument.
m <- matchit(A ~ X1 + X2 + X3, data = data, exact = ~X2 + X3)

This performs 1:1 nearest neighbor matching on a propensity score estimated with X1, X2, and X3 as covariates and an exact matching constraint on X2 and X3. Read the MatchIt vignettes for a full tutorial.