I am attempting to use the Match function from the Matching package to create a matched dataset on 4 variables. I want two of these variables to be exact matches and two to be within a set range.
I have the following code:
X <- cbind(tmpcomb$sexf, tmpcomb$dobyear, tmpcomb$municipality_code, tmpcomb$first_test)
colnames(X) <- c("sex", "dobyear", "municipality", "test_date")
Tr <- tmpcomb$Tr
#Define caliper for age within 5 years (see package documentation for caliper)
cal_age <- 5/sd(tmpcomb$dobyear)
cal_test_date <- 180/sd(tmpcomb$first_test, na.rm = T)
#match
tmp_matched <- Match(Tr = Tr, X = X, exact = c(0, 1, 0, 1), caliper = c(.001, cal_age, .001, cal_test_date))
summary(tmp_matched)
I want sex and municipality to be exact, dobyear to be within 5 years, and first_test to be within 180 days. I believe that what I have written in for caliper is incorrect, though, as it is only doing exact matches. Could someone please explain to me how to use caliper in this setting, I think I must be doing something incorrectly. Thanks!