I would like to use the MatchIt package in R to perform nearest neighbor matching using the Mahalanobis distance withing some caliper. Which of the following two parameters of the matchit function that are related to the Mahalanobis distance should I use:
- the
distance="mahalanobis"param, or - the
mahvarsparam (e.g.,mahvars = c("X1", "X2")?
What's the difference between the two?
The documentation is terse about this (see pages 16 and 19): https://imai.fas.harvard.edu/research/files/matchit.pdf.
You should use the latter. You need the
distanceargument to identify the propensity score that will be used to form the caliper. Settingmahvarswill perform Mahalanobis distance matching on themahvarsvariables, and the propensity score will be estimated based on the variables in the main formula. Thecaliperargument can then be specified, which defines the width of the caliper in units of the standard deviation of the propensity score.