After applying matching on multiple imputed datasets. How do I set the reference levels for categorical variables in my final model. For example how do I set the reference level for KOA as 1 instead of 0 ? Thanks
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)
You can just make the outcome KOA == 0
, e.g.,
svyglm(KOA == 0 ~ OSP, family = quasibinomial())
Note this doesn't really have anything to do with matching or multiple imputation.