First of all: This question might be a duplicate/already solved of/in this stackoverflow post.
I want to use the MatchIt
package to perform fully-blocked matching in my dataset using the Mahalanobis distance. I have two observed covariates (age and sex) that I want to use for matching.
I know that I can perform mahalanobis-based matching using the following arguments:
formula <- as.formula("group ~ sex_boolean + age")
m.out <- matchit(formula=formula,
data=data_df,
distance='mahalanobis')
site_df_matched <- get_matches(m.out,data=data_df)
But this only performs mahalanobis-based matching using the nearest neighbor. What if I want to go even more strict? Is it possible to introduce a caliper to mahalanobis-matching? The idea would be the following: For each unit in the minority group find a unit in the majority group to which the mahalanobis distance is smallest and lies within a defined caliper. If there is no unit from the majority group, the respective unit from the minority group should be discarded.
The outcome should be treatment and control groups of equal sizes containing pairs of units that are close in the respective covariates. The 'closeness' should be controllable by how strict the caliper is set. More strict calipers would lead to more discarded units from the minority group.
Maybe I am also having a false understanding of the mahalanobis-based matching procedure, but is it possible (and recommended) to do this with MatchIt
?