I am using the MatchIt package to implement nearest neighbor matching with the Mahalonobis distance. After the matching stage, how do I get it to report which control observation was matched with each treatment observation?
The following code does not work and throws the warning "No subclassification with pure Mahalanobis distance."
library("MatchIt")
data("lalonde")
lalonde_matchit_nn <-
matchit(
treat ~ age + educ + black + hispan + nodegree + married + re74 + re75,
baseline.group = 1,
data = lalonde,
method = "nearest",
distance = "mahalanobis",
subclass = T
)
Again, what I look for is for the output to have an ID for each pair of treatment and control, just like the subclass reported with other matching methods (e.g., "exact" or "cem").
method = "mahalanobis"
andsubclass = T
, but you are not allowed to have those together. You can choose either subclassification (on the propensity score) or Mahalanobis distance matching. – Noah