匹配它们和参考级别

问题描述 投票:0回答:1

在多个估算数据集上应用匹配后。如何在最终模型中设置分类变量的参考水平。例如,如何将 KOA 的参考级别设置为 1 而不是 0 ?谢谢

library(MatchThem)

data("osteoarthritis")

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

table(imputed.datasets$data$OSP)

table(imputed.datasets$data$KOA)

matched.datasets <- matchthem(OSP ~ AGE + SEX + BMI + RAC + SMK,
                              datasets = imputed.datasets,
                              approach = 'within',
                              method = 'nearest',
                              caliper = 0.05,
                              ratio = 2)

library(survey)
matched.models <- with(matched.datasets,
                       svyglm(KOA ~ OSP, family = quasibinomial()),
                       cluster = TRUE)
matching propensity-score-matching causal-inference
1个回答
0
投票

你可以直接做出结果

KOA == 0
,例如,

svyglm(KOA == 0 ~ OSP, family = quasibinomial())

请注意,这实际上与匹配或多重插补没有任何关系。

© www.soinside.com 2019 - 2024. All rights reserved.