Hello! I'm trying to create a matched dataset with similar individuals in my exposed and control groups. I recognize there are several ways to do this in R (ex. optmatch, match, and matchit functions). What I need to do is perform an exact match on variables (gender, region, timeperiod) and also match on age (2 years either way). If I can't use the MatchIt package, please also specify how to (1) evaluate the matched data (eg. the standardized mean differences of the variables) (2) create a final matched dataset that contains the outcome of interest.
Description of variables:
Group: exposed(=1), control(=0)
Gender: male, female, other
Region: north, south,east,west
Timeperiod: 1, 2
Age: 0 - 99 years old (continuous variable)
The R code I currently have:
m.m1 <- matchit(group ~ Gender + region+ timeperiod+age,
data = data,
exact=c("Gender", "region", "timeperiod", "age"), #NEED TO CHANGE AGE TO A RANGE
method = "nearest", caliper=0.2,
ratio = 2)
summary(m.m1)
plot(summary(m.m1))
matcheddata1<- match.data(m.m1) #creates matched dataset with other key variables (Ex. outcome)
Thanks in advance for any support you are able to provide!