I assume my understanding of propensity score matching using R's matchit
package is wrong.
MatchIt has a ratio
argument where I can specifiy k:1 matchings. I did a 2:1 matching with the lalonde
dataset which gives me in result 185 treated and 370 controlls.
In another variante I did 1:1 matching but in two iterations. So in first step I pulled the first 185 best machtes, removed them from the original/source data and pulled the next 185 best matches.
My assumption was that the result would be the same. But it isn't.
> a = sort(rownames_from_ratio_matching)
> b = sort(rownames_from_two_iterations_matching)
> table(a == b)
FALSE TRUE
326 44
> table(a %in% b)
FALSE TRUE
7 363
What is the reason behind this? I assume there is a statistical reason and not a technical one.
Minimal working example
library("MatchIt")
data("lalonde")
# 2:1 matching
m.out1 <- matchit(
treat ~ age + educ + race + married + nodegree + re74 + re75,
data = lalonde,
method = "nearest",
distance = "glm",
ratio = 2
)
df_out1 = match.data(m.out1)
## First 1:1 matching
m.out2 <- matchit(
treat ~ age + educ + race + married + nodegree + re74 + re75,
data = lalonde,
method = "nearest",
distance = "glm"
)
df_out2 = match.data(m.out2)
# row names of treated matches
treated2 = rownames(df_out2[df_out2$treat == 0,])
# remove the treated matches form the original data frame
lalonde <- lalonde[!(row.names(lalonde) %in% treated2),]
## Second 1:1 matching
m.out3 <- matchit(
treat ~ age + educ + race + married + nodegree + re74 + re75,
data = lalonde,
method = "nearest",
distance = "glm"
)
df_out3 = match.data(m.out3)
treated3 = rownames(df_out3[df_out3$treat == 0,])
rownames_from_ratio_matching = rownames(df_out1[df_out1$treat == 0,])
rownames_from_two_iterations_matching = c(treated2, treated3)
# unexpected FALSE
all(sort(rownames_from_ratio_matching) == sort(rownames_from_two_iterations_matching))