Hi Carl and Julie,
Thank you for your feedback! jags.parallel in R2jags seemed pretty straightforward so I went ahead and tried it. I can get the code to run on one core, but no two. Here is my code and error:
# this runs on 1 core
samps <- jags(data=data,parameters.to.save=c("beta", "mu"),n.iter=3000,
model.file="D:/Dropbox/PhD/Loading/Bayesian_Analysis/ExponentialGammaPriors.JAG",
n.chains=2, n.burnin=1000,n.thin=5)
# I get an error when I run this one in parallel
samps <- jags.parallel(data=data,parameters.to.save=c("beta", "mu"),n.iter=3000,
model.file="D:/Dropbox/PhD/Loading/Bayesian_Analysis/ExponentialGammaPriors.JAG",
n.chains=2, n.burnin=1000,n.thin=5)
Error in get(name, envir = envir) : invalid first argument
#I get the same error if I write my model as a function and then use model.file=thefunction. I found this post and tried making the suggested changes using do.call()
y=nit
X=X.mod
data <- list(y = nit, X=X.mod, n = n, l = l)
parms <- c("beta","mu")
n.iter=3000
n.chains=2
n.burnin=1000
n.thin=5
samps <- do.call(jags.parallel,list(names(data),inits,parms,
"D:/Dropbox/PhD/Loading/Bayesian_Analysis/ExponentialGammaPriors.JAG",
n.iter,n.chains,n.burnin,n.thin))
# but then I get another error
Error in checkForRemoteErrors(lapply(cl, recvResult)) :
2 nodes produced errors; first error: Number of initialized chains (length(inits)) != n.chains
# I have 13 "beta" parameters and 721 "mu" parameters. I am confused why it seems to be asking for the number of chains to equal the number of initial estimates for all parameters?
# if I set inits to something I get this error
Error in file(con, "w") : all connections are in use
Thank you for your help!