简体   繁体   English

从 Matchit 中提取 SMD 到 gtsummary

[英]Extract SMD from Matchit into gtsummary

i would like to extract the SMD values from MatchIt https://cran.r-project.org/web/packages/MatchIt/vignettes/assessing-balance.html#recommendations-for-balance-assessment我想从 MatchIt https: //cran.r-project.org/web/packages/MatchIt/vignettes/assessing-balance.html#recommendations-for-balance-assessment 中提取 SMD 值

into a gt summary table进入 gt 汇总表

library("MatchIt") library("gtsummary")库(“MatchIt”) 库(“gtsummary”)

data("lalonde", package = "MatchIt")

#1:1 NN matching w/ replacement on a logistic regression PS
m.out <- matchit(treat ~ age + educ + race + married + 
                   nodegree + re74 + re75, data = lalonde,
                 replace = TRUE)
m.out

summary(m.out)

Is there any option to extract the SMD values from the summary function?是否有任何选项可以从摘要 function 中提取 SMD 值? Thank you very much非常感谢

What do you mean by SMD? SMD是什么意思? You can save the summary into a new object with s <- summary(m.out) and then use View(s) to dig through the generated list.您可以使用s <- summary(m.out)将摘要保存到新的 object 中,然后使用View(s)挖掘生成的列表。 If you want to extract the Std. Mean Diff.如果要提取Std. Mean Diff. Std. Mean Diff. you can do so like that:你可以这样做:

summary(m.out)[["sum.all"]][, "Std. Mean Diff."]
#>    distance         age        educ   raceblack  racehispan   racewhite 
#>  1.79408605 -0.30944526  0.05496466  1.76154189 -0.34984254 -1.88186760 
#>     married    nodegree        re74        re75 
#> -0.82630927  0.24497023 -0.72108381 -0.29026291

Created on 2022-08-15 by the reprex package (v2.0.1)代表 package (v2.0.1) 于 2022 年 8 月 15 日创建

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM