# NOT RUN {
# make sure sex is a factor:
cldata<-within(cldata, sex<-factor(sex))
# we define the data frame with all the variables
data<-cldata[,c("measure","age", "sex", "city")]
mylevel<-c(1,1,1,1)
# And the formula of the substantive lm model
formula<-as.formula(measure~sex+age+I(age^2)+(1|city))
#And finally we run the imputation function:
imp<-jomo.smc(formula,data, level=mylevel, nburn=100, nbetween=100, model="lmer")
# Note we are using only 100 iterations to avoid time consuming examples,
# which go against CRAN policies.
# If we were interested in a model with interactions:
# formula2<-as.formula(measure~sex*age+(1|city))
# imp2<-jomo.smc(formula2,data, level=mylevel, nburn=100, nbetween=100, model="lmer")
# The analysis and combination steps are as for all the other functions
# (see e.g. help file for function jomo)
# }
Run the code above in your browser using DataLab