1

I've been using the MatchIt package in R to do treatment versus control matching, and I can't get the optimal matching to work with my own dataset.

If I run the following code:

m.out <- matchit(match_formula, data=stats, method='optimal', distance='logit', ratio=2)

where the formula is

treatment ~ t_1 + t_2 + t_3 + t_4 + t_5 + t_6 + t_7 + t_8 + t_9 + 
t_10 + t_11

then I end up with the error

Error in fullmatch.matrix(d, min.controls = ratio, max.controls = ratio, : omit.fraction must be NULL or numeric between -1 and 1

I couldn't find anywhere in the matchit method to specify an omit.fraction variable or what that even does. Is there any way to get around this bug and perform optimal matching?

istewart
  • 437
  • 5
  • 18
  • 2
    Please make a reproducible example: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – emilliman5 Jul 03 '17 at 16:15
  • `matchit` is using the `fullmatch` function from from the `optmatch` package. See the help file from there. – lmo Jul 03 '17 at 17:00

1 Answers1

5

Figured it out!

Because I had more control than treatment units, optmatch was unable to assign all control units to at least one treatment, which led to the error above. The solution was to switch the control and treatment populations and use a matching ratio of 1 in order to match all control units to a treatment unit.

Bonus: the optimal matches were an even better fit than the "nearest neighbor" matches, which I guess is to be expected.

istewart
  • 437
  • 5
  • 18
  • That's so strange. I feel that `optmatch` should know that many controls are to be matched to a few treated units. Thank you for posting! – Noah Jul 10 '17 at 17:38
  • Yeah it was totally the opposite of what I was expecting! I guess I need to read up more on matching in general. – istewart Jul 10 '17 at 19:12
  • How counterintuitive! Worked for me. Thanks for posting. – Lady_Bug Dec 06 '19 at 19:48