0

I try to do a "simple" exact 1 to 1 matching. I would expect that the resulting data consist of two groups with the same size. But in my MWE it looks like this where the groups are not of thes same size.

Sample Sizes:
              Control Treated
All             48.        52
Matched (ESS)   16.66      31
Matched         34.        31
Unmatched       14.        21
Discarded        0.         0

I'm sure I misunderstand something here.

Here is an MWE constructing sample data.

# see: https://cran.r-project.org/web/packages/MatchIt/vignettes/MatchIt.html
library("MatchIt")

set.seed(0)

df <- data.frame(
    group = sample(c('X', 'Y'), 100, replace = TRUE),
    foo = sample(LETTERS[1:4], 100, replace = TRUE),
    bar = sample(10:20, 100, replace = TRUE)
)

m.out <- matchit(
    group ~ foo + bar,
    data = df,
    method = "exact",
)

summary(m.out)

# get data
m.data <- match.data(m.out)

head(m.data)

The head of the resulting data.

> head(m.data)
   group foo bar   weights subclass
1      Y   A  18 1.0000000        1
2      X   D  19 1.4623656        2
3      Y   D  19 1.0000000        2
5      X   A  11 0.5483871        4
8      X   C  11 1.0967742       17
14     X   C  17 0.5483871       16

In my expectation the resulting data should look like this, where each pair has the same value in foo and bar.

    group foo bar
1       Y   A  18
37      X   A  18

2       X   D  19
3       Y   D  19

5       X   A  11
28      Y   A  11

6       Y   A  12
10      Y   A  12

7       X   A  10
92      X   A  10

...
buhtz
  • 10,774
  • 18
  • 76
  • 149

0 Answers0