SAS Proc PSMATCH与R Matchit倾向得分匹配样本

时间:2020-07-07 22:51:29

标签: r sas propensity-score-matching

是否可以在SAS Proc PSMatch和R Matchit之间产生相同的匹配?它们产生相同的预测概率/距离,并且每组具有相同的受试者数,但是样本不同。我读了三件事:

  1. MatchIt将设置priorities以将已处理内容与控件进行匹配;顺便说一句,真的很棒。
  2. MatchIt将在匹配之前shuffle进行观测,因此要重现匹配的样本,应设置一个种子
  3. MatchIt会randomly选择控制对象,使其落入卡尺中。

此外,有人可以解释卡尺的定义方式吗?在SAS中,我有:stat = lps caliper(mult = stddev)= 0.5 ... R中的等效项只是:distance ='logit',caliper = 0.5?

示例:SAS Data

SAS代码:

proc logistic data = school;
class Music(ref='Yes') Gender/ param = glm;  
model Music= Gender Absence;
output out = school_prob prob = pred_prob;
run;


proc psmatch data = school_prob region = allobs;
class Music Gender;
psdata treatvar = Music(Treated='Yes')  PS = pred_prob;
match method = greedy(k = 1) stat = lps caliper(mult = stddev) = 0.5;
output out(obs = match) = psmatch_dat matchid = MatchID;
run;

R代码:

library(haven)
library(MatchIt)
## save the data 'school' from sas as music.sas7bdat
school <- read_sas(music.sas7bdat)

school$Music <- ifelse(school$Music == 'Yes', 1, 0)
school$Gender <- ifelse(school$Gender == 'Female', 1, 0)
school$Music <- as.factor(school$Music)
school$Gender <- as.factor(school$Gender)

hold_match <- matchit(Music ~ Gender + Absence, data = school, method = 'nearest', distance = 'logit', caliper = 0.5)

psmatch_dat <- match.data(hold_match)

感谢您的帮助!

0 个答案:

没有答案