将它们和边际效应与乘法插补数据进行匹配

Matchthem and Marginal Effects with multiply imputed data

提问人:George 提问时间:11/15/2023 更新时间:11/15/2023 访问量:13

问:

我正在研究一个包含乘法插补数据的 PSM 模型。我试图获得估计的边际效应。我可以很容易地得到合并的逻辑回归模型,但我似乎无法看到边际效应。我正在附上我的代码以获得任何帮助。我是边际效应函数的新手,但我在 Matchthem 的上下文中需要它。欢迎任何帮助,代码如下:

library(mice) 
library(MatchThem) 
library(cobalt)
library(survey)
library(marginaleffects)

data('osteoarthritis')

summary(osteoarthritis)

imputed.datasets<-mice(osteoarthritis,m=5)

matched.datasets<-matchthem(OSP~AGE+SEX+BMI+RAC+SMK, 
                            datasets=imputed.datasets, 
                            approach='within', 
                            method='full', 
                            distance = 'glm', 
                            link = 'logit')

bal.tab(matched.datasets,stats=c('m','ks'), imp.fun='max', abs=TRUE)

matched.models<-with(matched.datasets, 
                     svyglm(KOA~OSP,family=quasibinomial()), 
                     cluster=TRUE)

matched.results<-pool(matched.models)
summary(matched.results,conf.int=TRUE)
summary(matched.results,conf.int=TRUE, exponentiate = TRUE)


comp.imp <- lapply(matched.datasets, function(fit) {
  avg_comparisons(fit, newdata = subset(fit$matched.datasets, 'OSP' == 1),
                  variables = "OSP", wts = "weights", vcov = "HC3"
  )
})

pooled.comp <- mice::pool(comp.imp)

我敢肯定,这只是我忽略了这一点。

边际效应 倾向得分匹配

评论


答: 暂无答案