Hi All,
Now I got curious and checked out the jags.parallel function in
R2jags, and I have issues with the implementation (therefore cc-ed to
Yu-Sung Su).
1) the jags.parallel() sets the seed on the workers by calling
clusterSetRNGStream, so that jags() can assign unique seed values to
the inits using the "base::Mersenne-Twister" RNG in JAGS. This would
ensure that chains rarely overlap (which is the current implementation
in WinBUGS, OpenBUGS having no option to change RNG only seed value).
2) JAGS can do better: it uses 4 RNG's by default one for each chain,
and one can use the L'Ecuyer RNG [load.module("lecuyer")] to make sure
that n.chain>4 will produce unique chains.
3) Martyn Plummer took the effort to expose the RNG initialization
(function parallel.seeds in rjags package), so one can call this
without having to call jags.model(...,
n.adapt=0)$state(internal=TRUE).
4) I used this function in the dclone package to allow parallel
execution for JAGS models using snow type clusters or forking
(jags.parfit function). On snow type clusters, it is possible to call
individual lower level JAGS related functions, replicating the rjags
implementation for parallel computations (parCodaSamples,
parJagsModel, parListFactories, parListModules, parLoadModule,
parSetFactory, parUnloadModule, parUpdate).
5) Also, having a same model file written out >1 times on a Socked
cluster (multiple core PC) might result in read/write access problems
thus conflicts among the cores.
6) Why load the "glm" module within jags() without an option to do so?
It might cause problems due to the limitations of block updating.
Cheers,
Peter
--
Péter Sólymos, Dept Biol Sci, Univ Alberta, T6G 2E9, Canada AB
[log in to unmask], Ph 780.492.8534, http://psolymos.github.com
Alberta Biodiversity Monitoring Institute, http://www.abmi.ca
Boreal Avian Modelling Project, http://www.borealbirds.ca
On Wed, Mar 6, 2013 at 1:42 PM, Sedat Sen <[log in to unmask]> wrote:
> Hi list,
>
> Thanks for those very valuable inputs. They were really helpful for me to
> decide where to start. I think I will start trying JAGS and STAN based on
> your suggestions. It is also good to know that there are other options like
> using C, INLA etc.
>
> Best,
>
> Sedat
>
>
>
>
> On Wed, Mar 6, 2013 at 10:27 AM, Arnaud Mosnier <[log in to unmask]> wrote:
>>
>> I support Paco's proposal, depending on the model structure, you can see a
>> huge improvement if you use JAGS in parallel or not.
>> In my case (i.e. using a complex hierarchical model), the speed increased
>> by a factor 100 or even more.
>>
>> Arnaud
>>
>>
>> 2013/3/6 Francisco Rodriguez Sanchez <[log in to unmask]>
>>>
>>> Hi Sedat,
>>>
>>> I would try running JAGS in parallel (see function jags.parallel in
>>> R2jags package). You may be able to use the same script you already have in
>>> BUGS language, so it won't take you much time to try (but see Jags manual
>>> for slight differences). In most cases I have found a remarkable increase in
>>> speed. If it remains too slow, then you can consider one of the alternatives
>>> that have been suggested in previous messages.
>>>
>>> Cheers,
>>>
>>> Paco
>>>
>>> El 05/03/2013 20:52, Sedat Sen escribió:
>>>
>>> Dear list,
>>>
>>> I am doing a simulation study which involves 16 different conditions
>>> (different sample size, # of items etc.). I will analyze an IRT model using
>>> 100 data sets with a Bayesian method. I can do it with WinBUGS and R. I can
>>> also use R2WinBUGS package. But the problem with my analyses is that it
>>> takes too much time. For instance, it takes 2 days to analyze 10 data sets
>>> when I use bugs function in R. Given that I will do 1600 analyses, I assume
>>> my design will take weeks. I know WinBUGS is quite slow when the model is
>>> complex.
>>>
>>> I was wondering if someone can give me some suggestions on how to
>>> overcome this problem. Can I do these analyses just using R rather than
>>> using R to call WinBUGS? Does it make any difference in terms of time if I
>>> use only R? Suggestion about any other software packages is also welcome.
>>>
>>> Thanks in advance,
>>> --
>>> Sedat
>>> ------------------------------------------------------------------- This
>>> list is for discussion of modelling issues and the BUGS software. For help
>>> with crashes and error messages, first mail [log in to unmask] To mail
>>> the BUGS list, mail to [log in to unmask] Before mailing, please check the
>>> archive at www.jiscmail.ac.uk/lists/bugs.html Please do not mail attachments
>>> to the list. To leave the BUGS list, send LEAVE BUGS to
>>> [log in to unmask] If this fails, mail [log in to unmask], NOT
>>> the whole list
>>>
>>>
>>> --
>>> Dr Francisco Rodriguez-Sanchez
>>> Forest Ecology and Conservation Group
>>> Department of Plant Sciences
>>> University of Cambridge
>>> Downing Street
>>> Cambridge CB2 3EA
>>> United Kingdom
>>> http://sites.google.com/site/rodriguezsanchezf
>>>
>>> ------------------------------------------------------------------- This
>>> list is for discussion of modelling issues and the BUGS software. For help
>>> with crashes and error messages, first mail [log in to unmask] To mail
>>> the BUGS list, mail to [log in to unmask] Before mailing, please check the
>>> archive at www.jiscmail.ac.uk/lists/bugs.html Please do not mail attachments
>>> to the list. To leave the BUGS list, send LEAVE BUGS to
>>> [log in to unmask] If this fails, mail [log in to unmask], NOT
>>> the whole list
>>
>>
>> ------------------------------------------------------------------- This
>> list is for discussion of modelling issues and the BUGS software. For help
>> with crashes and error messages, first mail [log in to unmask] To mail
>> the BUGS list, mail to [log in to unmask] Before mailing, please check the
>> archive at www.jiscmail.ac.uk/lists/bugs.html Please do not mail attachments
>> to the list. To leave the BUGS list, send LEAVE BUGS to
>> [log in to unmask] If this fails, mail [log in to unmask], NOT
>> the whole list
>
>
>
>
> --
> SS
> ------------------------------------------------------------------- This
> list is for discussion of modelling issues and the BUGS software. For help
> with crashes and error messages, first mail [log in to unmask] To mail
> the BUGS list, mail to [log in to unmask] Before mailing, please check the
> archive at www.jiscmail.ac.uk/lists/bugs.html Please do not mail attachments
> to the list. To leave the BUGS list, send LEAVE BUGS to
> [log in to unmask] If this fails, mail [log in to unmask], NOT
> the whole list
-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list
|