R中的马氏距离与最近邻匹配 [英] Nearest-neighbor matching with the Mahalanobis distance in R
问题描述
我想使用R中的MatchIt包,使用带有卡尺的马氏距离来执行最近的邻居匹配.我应该使用 matchit
函数的以下两个参数中与马哈拉诺比斯距离相关的哪个参数:
I would like to use the MatchIt package in R to perform nearest neighbor matching using the Mahalanobis distance withing some caliper. Which of the following two parameters of the matchit
function that are related to the Mahalanobis distance should I use:
-
distance ="mahalanobis"
参数,或 -
mahvars
参数(例如,mahvars = c("X1","X2"))
?
- the
distance="mahalanobis"
param, or - the
mahvars
param (e.g.,mahvars = c("X1", "X2")
?
两者之间有什么区别?
有关此文档的文档很简短(请参见第16和19页): https://imai.fas.harvard.edu/research/files/matchit.pdf .
The documentation is terse about this (see pages 16 and 19): https://imai.fas.harvard.edu/research/files/matchit.pdf.
推荐答案
来自 https://cran.r-project.org/web/packages/MatchIt/vignettes/matching-methods.html :
设置 distance ="mahalanobis"
和 method ="nearest"
可使 MatchIt
与Mahalanobis进行近邻匹配距离,而不考虑倾向得分.并使用主公式中提供的协变量.
Setting the distance="mahalanobis"
and method="nearest"
make MatchIt
to run Nearest-neighbour matching with the Mahalanobis distance, without the consideration of the propensity score. And the covariates supplied in the main formula are used.
这篇关于R中的马氏距离与最近邻匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!