Parallel R2OpenBUGS Example ここから並行計算のコードを紹介します。普通に計算すると8分ぐらいかかりましたが、平行でやると2分弱かかった。75%時間の短縮に成功しました。ちなみに、この リンク を参考にしました。 Parallel R2OpenBUGS Example Greg Nishihara 2013 January 28 This is an example of how I use OpenBUGS with R2OpenBUGS during my daily work. I make artificial data to illustrate the technique to run R2OpenBUGS in parallel. First load the libraries needed. library(snow) library(snowfall) library(R2OpenBUGS) First create a working directory if it doesn't exist. WORKDIR = "~/Data/R2OpenBUGS_Parallel_Example" if (!file.exists(WORKDIR)) { dir.create(WORKDIR) } Next set the number of chains, iterations, and burnins to run. NCHAINS = 4 NITER = 40000 NBURNIN = 10000 NTHIN = 1 Next, create separate directories for each chain. chain.directories = paste(WORKDIR, "/chain", 1:NCHAINS, sep = "") if (sum(file.exists(chain.directories)) == 0) { sapply(chain.directories, dir.create) } Make 1000 fak...