I am trying to do a PSM analysis with a package MatchItin R using the "exact match" for some variables and the "nearest neighbor" method for other variables in the same dataset
For the purposes of this question I will use an approximate data set lalonde.
test = matchit(treat ~ age + educ + married, method = "nearest",
exact = c(married), data = lalonde)
I expected this code to do an exact match for the variable married(binary variable with 0and 1), and then do the “closest” match for all the other variables in the model.
However, I received the following warning message:
Warning message: exact variables not contained in the data. An exact match has not been made.
When considering the summary of the output MatchIt, only the “closest” method was used. I don’t know where the error is, since only the “exact” method is used, the function identifies exact matches, but not in combination with another matching method.
Do you know any method of combining the exact and nearest neighbor matches in the same dataset, or do you know where my error is?
source
share