[R] Running Amelia with parallel processors in Windows

dadrivr dadrivr at gmail.com
Tue Feb 21 23:05:27 CET 2012


Hi,

I want to impute a data set multiple times with Amelia, but the data set is
large so it takes a long time.  As a result, I'm trying to run the multiple
imputation with parallel processors in Windows, but am having trouble.  Here
is a quick example:

######
library(foreach)
library(doSNOW)
registerDoSNOW(makeCluster(4, type = "SOCK"))
getDoParWorkers()
getDoParName()
getDoParVersion()

data(africa)

iterations <- 4
foreach(i = 1:iterations) %dopar% {
  amelia(x = africa, m=1, cs = "country", ts = "year", logs = "gdp_pc")
}
######

When I run the foreach loop, I receive the following warning
Error in { : task 1 failed - "could not find function "amelia""

This is a bizarre error because I have loaded the amelia package and can
impute data sets fine outside of the foreach loop.  Moreover, if I change
%dopar% to %do% to run the imputations in sequence rather than in parallel,
the imputations run fine with no errors.  How do I get Amelia to impute one
data set (m=1) on each of 4 different processors.  Finally, how do I combine
the data sets after imputing them in parallel -- I assume using the
ameliabind() function?  How can I do this?

Thanks for all your help.  By the way, I'm new to Amelia and parallel
processing, so any help would be greatly appreciated!

--
View this message in context: http://r.789695.n4.nabble.com/Running-Amelia-with-parallel-processors-in-Windows-tp4408482p4408482.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list