# NOT RUN {
#Loading the dataset
data(osteoarthritis)
#Multiply imputing the missing values
imputed.datasets <- mice(osteoarthritis, m = 5, maxit = 10,
method = c("", "", "mean", "polyreg", "logreg", "logreg", "logreg"))
#Estimating weights of observations in the multiply imputed datasets
weighted.datasets <- weightthem(OSP ~ AGE + SEX + BMI + RAC + SMK, imputed.datasets,
approach = 'within', method = 'ps')
#Analyzing the weighted datasets
models <- with(data = weighted.datasets,
exp = glm(KOA ~ OSP, weights = weights, family = binomial))
# }
Run the code above in your browser using DataLab