是否可以在SAS Proc PSMatch和R Matchit之间产生相同的匹配?它们产生相同的预测概率/距离,并且每组具有相同的受试者数,但是样本不同。我读了三件事:
此外,有人可以解释卡尺的定义方式吗?在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)
感谢您的帮助!