rm(list = ls()) library("MatchIt") library("tableone") library(\'survival\') library(\'Zelig\') data(lalonde) head(lalonde) set.seed(1234) m.out <- matchit(treat ~ educ + black + hispan, data = lalonde, method = "nearest",ratio=4,caliper=0.001) m.data <- match.data(m.out) table(m.data$treat,m.data$educ) summary(m.out) plot(m.out,type="jitter") plot(m.out,type="QQ") plot(m.out,type="hist") table1 <- CreateTableOne(vars = c(\'educ\', \'black\', \'hispan\',\'married\',\'nodegree\'), data = m.data, strata = \'treat\') table1 table(m.data$treat,m.data$married) d1 <- m.out$match.matrix #行名称(实验组)对应值(配对的id)#
请发表评论