rpropensity-score-matchingmatchit

How the matching order is determined when replace = TRUE in R matchIt


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.


Solution

  • When matching with replacement, it doesn't matter which treated unit is matched first because the results of each match do not affect the results of other matches; all matches are completely independent.

    The m.order argument does not affect the order of control units, which are always in the order they are observed in the data. When there are no ties, this does not affect the matching. In a case like yours in which there are ties, the control units earlier in the dataset will be matched first. This may be changed in future versions; it does seem reasonable to think that the order of control units would be changed based on this argument.