[R-sig-hpc] .combine in foreach

Patrick Brandt patrick.t.brandt at gmail.com
Mon Dec 20 02:35:27 CET 2010


There are some multiple chain, multiple model MCMC specifications
using RMPI/snow in my papers.  Replication info and example code is
available at

http://www.utdallas.edu/~pbrandt/pbrandt/Replication.html

See specifically the zip/tarballs with R code for the Brandt,
Colaresi, and Freeman (2008) paper (there are some custom functions
that will give you back coda mcmc.lists across models -- some of this
is now in my MSBVAR pkg).  The Brandt and Freeman (2009) papers does
parallel chains using rmpi/snow.

For MCMC-like analysis I have found that using snow works best, esp.
if the models work in similar run times.  If you have multiple models
/ specifications that are going to run in different run-times (e.g.,
longer v. shorter samplers, or MH-steps that become progressively more
complex across specifications), I have some example code that I can
share off list (it is not ready for release, so please email me if you
are interested) , then you may want to look at clusterApplyLB() to
calling the models.

PTB

-- 
Patrick Brandt
Associate Professor
Political Science
School of Economic, Political and Policy Sciences
University of Texas at Dallas
Personal site: http://www.utdallas.edu/~pbrandt
MSBVAR site: http://yule.utdallas.edu




On Sat, Dec 18, 2010 at 9:11 AM, Maas James Dr (MED) <J.Maas at uea.ac.uk> wrote:
> I’m testing using the foreach package to see if it will parrallelize a Bayesian MCMC routine.  It appears to work well, just gives back huge results files when I run multiple iterations.  I’m looking at the .combine option ... is there an easy way to get it combine the results across components and still maintain the matrix structure?  Several of the outputs are 3x3 matrices, but I get 1000 of them, one in each component.  If possible I’d like to get the mean matrix, i.e  (m1 +m2+m3 ... m1000 ) / 1000  if that makes any sense!?
>
> Any suggestions most welcome, thanks for help.
>
> J
>
> ===============================
> Dr. Jim Maas
> University of East Anglia
>
> _______________________________________________
> R-sig-hpc mailing list
> R-sig-hpc at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-hpc
>



More information about the R-sig-hpc mailing list