#Loading libraries
library(survey)
#Loading the dataset
data(osteoarthritis)
#Multiply imputing the missing values
imputed.datasets <- mice::mice(osteoarthritis, m = 5)
#Estimating weights of observations in the multiply imputed datasets
weighted.datasets <- weightthem(OSP ~ AGE + SEX + BMI + RAC + SMK,
imputed.datasets,
approach = 'within',
method = 'glm',
estimand = "ATT")
#Analyzing the weighted datasets
models <- with(weighted.datasets,
svyglm(KOA ~ OSP, family = binomial))
#Checking the 'models' object
is.mimira(models)
Run the code above in your browser using DataLab