#Loading libraries
#Loading the dataset
data(osteoarthritis)
#Multiply imputing the missing values
imputed.datasets <- mice::mice(osteoarthritis, m = 5)
#Weighting the multiply imputed datasets
weighted.datasets <- weightthem(OSP ~ AGE + SEX + BMI + RAC + SMK,
imputed.datasets,
approach = 'within',
method = 'glm')
#Analyzing the weighted datasets
models <- with(weighted.datasets,
WeightIt::glm_weightit(KOA ~ OSP,
family = binomial))
#Pooling results obtained from analyzing the datasets
results <- pool(models)
summary(results)
Run the code above in your browser using DataLab