R Programming – Addressing Weights in Mahalanobis Nearest-Neighbor Matching

causalitymahalanobismatchingr

When generating weights using nearest-neighbor matching with Mahalanobis distance, all of my weights for each treated and non-treated unit are "1". Below is my syntax using the MatchIt package in R:

m_matched <- matchit(pko ~ lnatres + lgdppc + lpop + lmilper,
                     data = merged,
                     method = "nearest",
                     estimand = "ATT",
                     distance = "mahalanobis")

m_matched <- match.data(m_matched)
> summary(m_matched$weights)

#   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#     1       1       1       1       1       1 

I am not sure why this is the case and I am wondering if anyone has any idea of what error on my part may be causing this. Or is this somehow a part of this method of matching?

Best Answer

When doing 1:1 matching without replacement, all matched units receive a weight of 1 and all unmatched units receive a weight of 0. match.data() removes the unmatched units from the dataset, so all that remains are the units with weights of 1.

How matching weights are computed is explained in the documentation for matchit(). When matching for the ATT, treated units receive a weight of 1, and matched control units receive a weight of $p_i/(1-p_i)$, where $p_i$ is the proportion of units in the pair that unit $i$ is in that are treated. For 1:1 matching, every pair has 2 units, 1 of which is treated, so $p_i = .5$. Applying that formula (which is the same formula used for computing ATT weights with propensity score weighting), all matched control units receive a weight of 1.