Thanks for the response, Matt.  I had loaded the amelia package, but I just forgot to copy and paste that into the code I submitted to the mailing list.  Anyways, I was able to get the script working after some adjustments.  Below is the working script:

library(Amelia)
library(mitools)
library(nlme)
library(mitools)
library(foreach)
library(doSNOW)
registerDoSNOW(makeCluster(7, type = "SOCK"))

ameliapar <- function(x, m=7, p2s=2, ...) {
  foreach (i = 1:m,
           .combine = "ameliabind",
           .packages="Amelia") %dopar% {
             amelia(x, m=1, p2s=p2s, ...)
           }
}

ameliapar(x = africa, m=7, cs = "country", ts = "year", logs = "gdp_pc")

Thanks for your help!

-Isaac


On Mon, Feb 27, 2012 at 9:46 AM, Matt Blackwell <blackwel@fas.harvard.edu> wrote:
Hi Isaac, 

Perhaps this is too simple an answer, but I think you might be missing the "library(Amelia)" call at the beginning of the script. When I add that to the top of the snippet, the code runs clean on my machine. Please let us know if that does not fix the problem. 

Hope that helps!

Cheers,
matt.

~~~~~~~~~~~
Matthew Blackwell
PhD Candidate
Institute for Quantitative Social Science
Department of Government
Harvard University

On Monday, February 27, 2012 at 9:44 AM, Matt Blackwell wrote:

Hi Isaac, 

Perhaps this is too simple an answer, but I think you might be missing the "library(Amelia)" call at the beginning of the script. When I add that to the top of the snippet, the code runs clean on my machine. Please let us know if that does not fix the problem. 

Hope that helps!

Cheers,
matt.

~~~~~~~~~~~
Matthew Blackwell
PhD Candidate
Institute for Quantitative Social Science
Department of Government
Harvard University

On Tuesday, February 21, 2012 at 1:48 PM, Isaac Petersen wrote:

Hi,

I want to impute a data set multiple times, 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, so any help would be greatly appreciated!
--
Amelia mailing list served by HUIT
More info about Amelia: http://gking.harvard.edu/amelia
Amelia mailing list