1
$\begingroup$

I am trying to use the MatchIt package to conduct exact matching on several categorical variables (sex, zipcode and an eligibility group code). After matching I want to have the same number of treated units as control units, and I want it to randomly pick the control unit for each treated unit if there are several potential ones. For some reason that doesn’t seem to be possible in the MatchIt package as far as I can tell.

I have tried many arguments with the method = "exact" but none seem to work. When I use ratio = 1:1 argument but get the error: 'ratio' is not used with method = "exact" and will be ignored. I've tried replace = FALSE, and/or reuse.max = 1 and/or k2k = TRUE but still get more matched treated than controls. Listing my code below with all arguments used (though I've used them all individually with no luck either)

m.out1_exact <- matchit(treat ~ sex_cd + cvrg_grp_cd + zipcode,
                        data = df_match_zip,
                        method = "exact", replace = FALSE,
                        ratio= 1:1, replace = FALSE, reuse.max = 1, k2k = TRUE)

I end up matching 1 treated unit to many controls, when I want a 1:1 match, see photo.

Also, if someone could clarify the difference between Matched (ESS) and Matched (Unweighted) that would be useful. I am still unclear from the MatchIt Vignettes on how these are different in the exact matching case (not coarsened exact matching)

enter image description here

$\endgroup$

1 Answer 1

4
$\begingroup$

It sounds like you actually want 1:1 nearest neighbor matching with an exact matching constraint. That is, set method = "nearest" and include the variables you want to exact match on in the exact argument. The default is 1:1 matching without replacement so that is what you will get. If you want coarsened exact matching, you can coarsen the variables manually and use the method above or use method = "cem" with k2k = TRUE, which coarsens them automatically and returns a matched sample with an equal number of treated and control units.

I have explained what the effective sample size (ESS) is here and in the MatchIt documentation. I encourage you to read the documentation; it explains what each matching method does and what arguments are allowed with it.

$\endgroup$
1
  • $\begingroup$ Thanks Noah! I got it to work, and also really enjoy using MatchIt and Cobalt. big fan! $\endgroup$
    – hfactorial
    Commented Nov 29, 2022 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.