I am new to matching test/control. I saw that in R, we could use either Matching or MatchIt to select matches. What are differences between the two ways to create matches? Could you provide examples for each of them?
Thanks!
There are a number of differences between MatchIt
and Matching
for performing matching to reduce confounding in observational studies. The most important is the philosophy underlying each package: MatchIt
considers matching to be a form of nonparametric preprocessing as described in Ho et al. (2007), while Matching
consider matching to be a specific estimator of a difference in means, as described in Abadie and Imbens (2006). This distinction manifests in that Matching
provides effect estimates after matching, whereas MatchIt
only provides a matched dataset that can be supplied to a model to estimate the treatment effect.
There are many other differences between the two packages. MatchIt
provides an interface to a large variety of matching methods, including nearest neighbor matching, optimal pair matching, optimal full matching, (coarsened) exact matching, genetic matching, propensity score subclassification, and cardinality matching, some of which rely on other packages (including Matching
!). Matching
only performs nearest neighbor matching and genetic matching.
The implementation of genetic matching in both packages is about the same because MatchIt
calls functions in Matching
to perform the genetic matching. By default, MatchIt
performs genetic matching on the covariates and propensity score, whereas, in Matching
, the propensity score must be manually estimated and added along with the covariates. There are some other slight differences that are generally not too relevant.
The implementation of nearest neighbor matching is where the two packages differ the most, though in most cases it is possible to replicate the results of one with the other. The key differences are in the defaults; most capabilities are the same between the two packages. One difference is that Matching
can perform nearest neighbor matching with ties, whereas MatchIt
does not allow ties. With numerous continuous covariates, ties rarely occur anyway. Below are some of the differences between the packages:
MatchIt
is nearest neighbor matching without replacement on the propensity score; the default in Matching
is nearest neighbor matching with replacement and ties on the scaled Euclidean distanceMatching
, the matches occur in the order of the data; in MatchIt
, the user can select the matching order (the default is in descending order of the propensity score)Matching
, the ATE can be chosen as the estimand when matching with replacement; in MatchIt
, only the ATT and ATC are availableMatching
uses very fast C code to perform the matching; MatchIt
uses less optimized Rcpp
codeMatching
allows you to customize the matrix used to weight the importance of each covariate in the matching; MatchIt
allows you to supply a custom distance matrix itselfThere are a few other minor differences in options, but the other biggest differences come in the interface. I find MatchIt
significantly easier to use, especially for beginners, because the interface is similar to that of other R functions like lm()
, whereas Matching
requires a bit more manual programming and knowledge of R to use all options effectively. The documentation of MatchIt
is also significantly more detailed and extensive (note that I wrote it), which can make it easier for beginners. MatchIt
also provides more tools for visualizing balance.
Which should you use? I say MatchIt
if you are a beginner or want many options, and Matching
if you are an econometrician who wants to use the specific estimator Matching
implements. The interface of MatchIt
and the ability to use a whole suite of matching methods, along with its extensive documentation aimed at beginners, make MatchIt
a better choice for those just getting started in my opinion.