I am able to successfully run a PSM model using Matchit, but I am struggling to output the actual paired matches. My code is here ...
model_raw <- matchit(source ~ last_payment_amount +
balance_at_purchase + days_since_chgoff,
data=model1_file, method="nearest", distance="glm",
caliper=.50)
summaryfileraw <- summary(model_raw)
mraw_data <- match.data(model_raw)
head(model_raw$match.matrix)
model1_file[1, ]
model1_file[3128, ]
matrixraw <- model_raw$match.matrix
I can see, for example that obs "1" from the Control matched "3218" from the Treatment. But, in the context of the actual data file, these values do not mean anything and I cannot seem to export these values from the match.matrix in a way that retains the original data. I do have an account number (cleverly called "account number") in the original data. Is there a way to export the output such that I can see the "account number" for obs "1" and obs "3128"?
I have tried the code below with no joy:
head(model_raw$match.matrix)
model1_file[1, ]
model1_file[3128, ]
print(model_raw$match.matrix)
matrixraw <- model_raw$match.matrix
write.csv(matrixraw, file="C:\\PSM TESTING\\matrixraw.csv")