提问人:George 提问时间:11/18/2023 更新时间:11/18/2023 访问量:16
Cobalt 和 MatchThem:插补后分析
Cobalt and MatchThem: Post Imputation analysis
问:
我正在通过 MatchThem 和 Cobalt 使用带有多重插补的倾向分数匹配来执行平衡功能。在我的学科中,在 psm 研究中,习惯上提供一个表格,其中包含匹配前和匹配后每个变量的治疗组(即暴露和对照)的平均值。Cobalt 似乎没有通过插补数据集提供此类信息,坦率地说,我很惊讶。所以,对我来说,这意味着我将不得不自己访问数据并执行鲁宾规则。我可以访问匹配数据集的插补数据,但我继续遇到的问题是无法将资产负债表(即 bal.tab)的结果转换为可行的数据框。bal.tab 提供的列表不能被强制到一个可行的数据框中。有没有人对如何进行这种胁迫有任何想法?我是否在MICE或MatchThem中遗漏了可能能够做到这一点的东西?这是我正在使用的最小可行代码:
require(mice)
require(MatchThem)
require(cobalt)
require(survey)
require(marginaleffects)
require(dplyr)
#data for use-------------------------------------------------------------------
data('osteoarthritis')
#summary checking for missing values--------------------------------------------
summary(osteoarthritis)
mean(osteoarthritis$AGE)
#imputing the missing values using pmm via mice---------------------------------
imputed.datasets<-mice(osteoarthritis,m=5)
#performing the matching--------------------------------------------------------
matched.datasets<-matchthem(OSP~AGE+SEX+BMI+RAC+SMK,
datasets=imputed.datasets,
method='nearest',
distance = 'logit',
caliper = .20)
#gets the means for each dataset into a list
bal<-bal.tab(matched.datasets, which.imp=.all, disp=c("means"))
bal
#my attempt to coerce into a data frame
df <- ldply (bal, data.frame, optional = TRUE)
View(df)
答: 暂无答案
上一个:漂亮的印花朱莉娅套装
下一个:如何为匹配观测值生成变量
评论
cobalt