Hi there. I was running the MI package for imputing the missing variables with the code below: data <- read.csv("data.csv")
library(mi) library(doParallel) mdf <- missing_data.frame(data) show(mdf) mdf <- change(mdf, y = c("X"), what = "type", to = c("un")) mdf <- change(mdf, y = c("X"), what = "type", to = c("ir")) image(mdf) rm(data) #good to remove large unnecessary objects to save RAM #options(mc.cores = 2) #imputations <-mi(mdf, n.iter = 30, n.chains = 4, max.minutes = 20) registerDoParallel(cl <- makeCluster(getOption("mc.cores", 10), setup_strategy = "sequential")) imputations <- mi(mdf, n.iter = 30, n.chains = 4, max.minutes = 20, parallel=FALSE) stopCluster(cl) show(imputations) plot(imputations)
Unfortunately, as it reaches Plot it gives me an error: Error in as. double(y): cannot coerce type 'S4' to a vector of type 'double'.
Also while running the iteration in 4 chains, certain iterations are not converged too. It would be helpful if I could solve this problem.