cobalt
can check balance on data not matched with MatchIt
. If you have either the matching weights or pair membership, you can supply either of those to bal.tab()
. If you have the matching weights, you would enter the following:
bal.tab(treat ~ x1 + x2 + x3, data = data, weights = matching_weights)
where treat
is the treatment, x1
, etc. are the covariates, data
is the dataset containing all the units prior to matching, and matching_weights
is a vector of matching weights. For variable k:1 matching, you construct matching weights as follows: unmatched units get a weight of 0, matched treated units get a weight of 1, and matched control units get a weight of 1 divided by the total number of control units matched to the same treated unit. So, if treated unit A
was matched to controls units B
and C
, B
and C
would each get weights of 1/2. This is equivalent to what you were doing manually.
If you have pair membership, you should transform it into weights in order to be able to estimate the treatment effect using a weighted regression (e.g., as described in the MatchIt
documentation). If you don't want to compute matching weights but have pair membership, you can supply pair membership to the match.strata
argument of bal.tab()
, which will automatically construct matching weights and use them to compute the balance statistics. The argument supplied to match.strata
should be a factor with NA
for unmatched units and a pair identifier for the matched units.
Remember that when computing the standardized mean differences, there are several ways to compute the standardization factor. For matching, it makes the most sense to use the standard deviation of the covariate in the treated group prior to matching. It may be that the results you are comparing yours to used a different formula.