Matching produces a set of matching weights, one for each unit. Those who don't receive a match are given a weight of zero. In 1:1 matching without replacement, those who are matched are given a weight of 1. Things get more complicated with K:1 matching and matching with replacement. There are formulas to transform the matched set into weights. Typically this is done by assigning weights as the inverse of the number of control units matched to each treated unit. For example, if one treated unit had two control matches, the control units would each receive a weight of .5. When matching with replacement, control units that are matched more than once get a weight for each treated unit they are paired with, and then those weights are added together. For example, if a control unit was one of two control units matched with one treated unit, and the only control unit matched with another treated unit, it would get a weight of .5 + 1 = 1.5.
With these weights, you can run a weighted regression of the outcome on the treatment. Robust standard errors should be used.
matchit() in the
MatchIt package automatically returns matching weights when it performs a match. You can just extract those and use them in a call to
svyglm() or however else you like to compute robust standard errors with weighted regressions.