mice
mice copied to clipboard
Multilevel imputation with parlmice
Hello and thanks so much for all the work you do on mice. Following the setup from the multilevel mice vignette, I was able to get single-core mice to run on a 15 column, 28K row dataset. It took about 30 minutes to run.
I have tried to replicate the process but instead use parlmice for the parallel mice implementation. However, I am getting an error:
Error in checkForRemoteErrors(val) : 5 nodes produced errors; first error: invalid 'y' type in 'x && y'
The coding leading up to this is below. Is this a unique problem to me or is it that parlmice is not setup for multilevel models? Any help would be greatly appreciated?
# Create a new cluster ID as a placeholder
m_34_red <- m_34_red %>% group_by(NCESID) %>% mutate(NCESID = cur_group_id())
#First, run a 0 iteration model to see how mice sets up the data
ini <- parlmice(m_34_red, maxit = 0)
#Set ID as class variable for 2l.norm
pred1 <- ini$predictorMatrix
pred1[,"NCESID"] <- -2
#Declaring method as 2l.pan
meth1<-ini$method
meth1[which(meth1 == "pmm")] <- "2l.pan"
#Parallel
seqTime_mlm_par <- system.time(imp_mlm <- parlmice(m_34_red[,c(3:21)], cluster.seed = 22901,
method=meth1,
predictorMatrix = pred1, print = FALSE))
Hi @bbachilles, could you please share a reprex for this issue?
We are going to retire parlmice()
in favour of the much better behaved futuremice()
available in mice 3.14.12
. Hope that solves the problem.