################### #MI based on PCA (continuous) ################### library(missMDA) library(mice) data(ozone) ## First the number of components has to be chosen nb <- estim_ncpPCA(ozone[,1:11]) ## Multiple Imputation with Bayesian method res.BayesMIPCA<-MIPCA(ozone[,1:11],ncp=nb$ncp,verbose=TRUE,method.mi = "Bayes") ## Diagnostics res.over<-Overimpute(res.BayesMIPCA) ## Regression on the multiply imputed data set and pooling with mice imp<-prelim(res.mi=res.BayesMIPCA,X=ozone[,1:11])#creating a mids object fit <- with(data=imp,exp=lm(maxO3~T9+T12+T15+Ne9+Ne12+Ne15+Vx9+Vx12+Vx15+maxO3v))#analysis res.pool<-pool(fit);summary(res.pool)#pooling ################### #MI based on MCA (categorical) ################### data(TitanicNA) ## First the number of components has to be chosen nb <- estim_ncpMCA(TitanicNA) ## Time-consuming, nb = 5 ## Multiple Imputation res.mi <- MIMCA(TitanicNA, ncp=5, verbose=TRUE) ## Analysis and pooling with mice imp<-prelim(res.mi,TitanicNA) fit <- with(data=imp,exp=glm(SURV~CLASS+AGE+SEX,family = "binomial")) res.pool<-pool(fit) summary(res.pool)