# How does the CEM package (R/Stata) handle missingness on outcome variable?

I'm trying to understand how coarsened exact matching works when there is missingness in the outcome variable. I need to match observations on several predictors and then estimate different models using various outcome variables, some of which include missing values.

Replication in R (automatic coarsening for simplicity of replication):

library('cem')

set.seed(12345)
treat <- rbinom(100, 1, 0.5)
x1 <- rnorm(100, mean = 50, sd = 20)
x2 <- rnorm(100, mean = 10, sd = 5)
y1 <- rnorm(100, mean = 30, sd = 3)
y2 <- y1; y2[90:100] <- NA

df <- data.frame(treat, x1, x2, y1, y2)


Note that y2 is identical to y1, except that missing values have been introduced for the last 10 observations.

matched <- cem('treat', drop=c('y1', 'y2'), data=df, keep.all = T)
matched

m1 <- att(matched, y1 ~ treat + x1 + x2, data = df)
m1


This simple linear estimation using y1 as outcome yields:

          G0 G1
All       48 52
Matched   35 39
Unmatched 13 13

Linear regression model on CEM matched data:

SATT point estimate: -0.799485 (p.value=0.177235)
95% conf. interval: [-1.949084, 0.350114]

m2 <- att(matched, y2 ~ treat + x1 + x2, data = df)
m2


Using y2 yields:

          G0 G1
All       48 52
Matched   35 39
Unmatched 13 13

Linear regression model on CEM matched data:

SATT point estimate: -0.925112 (p.value=0.135748)
95% conf. interval: [-2.124466, 0.274241]


The results are different, but I cannot find out (from package documentation or the objects returned in R) what happens under the hood. Does it use listwise deletion to remove the observations with missing values? If so, what if a case with a missing value on y2 is matched to a case without missingness? Does it drop the whole stratum (both cases)?

• Why is Stata mentioned in the title and given as a tag? – Nick Cox Feb 23 at 12:20
• Since the CEM package is implemented in both R and Stata (by the same developers), I expect it treats missingness the same way in both programs. But I might be wrong. – Rnout Feb 24 at 13:33
• I can't comment on that, but there is (still) nothing in your question about Stata. – Nick Cox Feb 24 at 13:46

The default is to run lm on the data using the estimating matching weights as weights in a weighted regression. att() simply calls lm(). The default in lm() is to call na.omit() on the model matrix, which discards all units that have missing values for the predictors or outcome. Because the matching strata are used only to produce weights with model = "linear", information about stratum membership is lost when estimating the treatment effect, so the missing value processing ignores stratum membership and only deletes observations with missing outcomes regardless of the missingness of the other members of their stratum.