I'm working on propensity score matching, with replacement. I am using matchIt package in R. But I found that the argument m.order="random" seems not to work after I specify replace=TRUE.
For example, I created a sample dataset:
testdata = data.frame(treat=c(0,0,0,0,1,1,1,1,1,1),
re75=c(1,2,3,4,1,2,3,4,5,6),
race=c(1,1,1,0,1,0,1,1,1,0)
)
Then do matching:
m.out <- matchit(treat ~ race,
data = testdata,
method = "nearest",
ratio = 1,
replace = TRUE,
m.order = "random"
)
I expect the matching results should be different everytime I run the code again. But the matchIt always give the following matching result (have tried changing random seed):
> m.out$match.matrix
[,1]
5 "3"
6 "4"
7 "3"
8 "3"
9 "3"
10 "4"
Could anyone tell me why is that? How the order of matching is determined in matchIt() when replace=TRUE.