A naive question from a non-statistician: I'm looking into running a
Bayesian analysis of a model with high dimensionality. It's not a standard model (the likelihood requires a lot of code to implement), and I'm using a Linux machine. Was wondering if someone has any thoughts on what the advantages of OpenBugs are as opposed to just R (or should I be thinking WinBUGS under Wine?)? The AMCMC package in R promises to run MCMC's very rapidly. Have read that OpenBugs as a project was 'stalling' in 2007. Peter ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
Your request is too vague for us to be very helpful. However OpenBUGS
runs without very frequent crashes only on some ix86 Linux machines -- and what those are is unclear and Uwe Ligges and I (working on BRugs) have been unable to find one recently. There are dozens of Bayesian MCMC packages on CRAN (look at its Bayesian task view). Most are less general and faster than BUGS. There is no 'AMCMC package in R'. There is at least one third-party effort of that name, not on CRAN and explicitly claiming The R function amcmc() will tend to run rather _slowly_, (his emphasis) so perhaps that is not the one you mean. On Sun, 22 Jun 2008, Peter Muhlberg wrote: > A naive question from a non-statistician: I'm looking into running a > Bayesian analysis of a model with high dimensionality. It's not a > standard model (the likelihood requires a lot of code to implement), 'code' in what language? Note that MCMC does *not* require the likelihood to be calculated, and its renaissance in statistics ca 30 years ago was for models for which the likelihood is not even known completely. > and I'm using a Linux machine. Was wondering if someone > has any thoughts on what the advantages of OpenBugs are as > opposed to just R (or should I be thinking WinBUGS under Wine?)? The > AMCMC package in R promises to run MCMC's very rapidly. Have read > that OpenBugs as a project was 'stalling' in 2007. > > Peter -- Brian D. Ripley, [hidden email] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
In reply to this post by Peter Muhlberg
I've done some looking around in R and elsewhere to answer my question
on the value of R vs. Bugs for MCMC. So, for anyone who is curious, here's what I think I've found: Bugs compiles its code, which should make it much faster than a pure R program. Packages such as AMCMC run MCMC in R, potentially with a user-defined C function for the density--which should make it comparable in speed to Bugs. The packages MCMCpack (MCMCmetrop1R function) and mcmc seem designed to run w/ a density function written in R. MCMCpack does have functions that use precompiled C code from the Scythe library (which looks nice), but I see no simple way to add a C density function. AMCMC and Bugs seem to use adaptive MCMC, but the other R packages don't appear to do so, which may mean another performance reduction. I see no way to insert my own proposal density in the R functions. JAG, a Java-based version of BUGS, apparently allows users to create their own samplers, which might be a way to insert a different proposal density. Details about how to install a sampler are not given in the manual, which, incidentally, is nevertheless much better than the Bugs manual. Also, the proposal density I'd want would probably treat different variables differently, so I may need Metropolis within Gibbs, not standard Gibbs sampling. Can't get a clear picture of what JAG's algorithm(s) are--the manual doesn't mention Metropolis. WinBugs and OpenBugs can't be made to run easily on Linux. It looks like WinBugs running under WINE might be the simplest viable configuration, though I don't know how well or quickly it runs under WINE or how much memory WINE ends up consuming. Given all this, it may be easiest for my purposes to try to tweak the AMCMC code to allow a different proposal density. Maybe. Peter ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
Hey, good topic for a thread. I've wrestled with this over the years.
I think there's some user confusion about what WinBUGS does. People who did not see BUGS before WinBUGS tend not to understand this in the same way... The unique / important contributions from WinBUGS are the collection of working examples and the Doodle code generator thing. All of the rest of it can be easily replaced by open source tools that exist or could easily exist. On Sun, Jun 22, 2008 at 11:34 AM, Peter Muhlberg <[hidden email]> wrote: > I've done some looking around in R and elsewhere to answer my question > on the value of R vs. Bugs for MCMC. So, for anyone who is curious, > here's what I think I've found: Bugs compiles its code, which should > make it much faster than a pure R program. Packages such as AMCMC run > MCMC in R, potentially with a user-defined C function for the > density--which should make it comparable in speed to Bugs. The > packages MCMCpack (MCMCmetrop1R function) and mcmc seem designed to > run w/ a density function written in R. MCMCpack does have functions > that use precompiled C code from the Scythe library (which looks > nice), but I see no simple way to add a C density function. AMCMC and > Bugs seem to use adaptive MCMC, but the other R packages don't appear > to do so, which may mean another performance reduction. Think of "performance" as a combination of development time and run time. Andrew Martin's MCMCpack reduces development time by giving people some pre-packaged Gibbs sampling fitters for standard models, such as logistic regression. It still uses the same iterative sampling routines "under the hood" as most other MCMC approaches. The only difference there is that it has routines formatted in a way that will be familiar to R users. I do not believe a simulation model conducted in MCMCpack will take a different amount of "run time" than a well coded, custom version of the same that is prepared in WinBUGS or any other GIBBS sampler. The big difference is that MCMCpack offers routines for familiar models, and if one wants to "thrown in" some random parameter here or there, then MCMCpack won't be able to handle it. The U. Chicago professors provide the package bayesm which is roughly the same kind of thing. For pre-existing model types, an MCMC model can be conducted. Students ask "Why learn BUGS when I can use MCMCpack (or bayesm)?" Answer: no reason, unless you want to propose a model that is not already coded up by the package. > > I see no way to insert my own proposal density in the R functions. > JAG, a Java-based version of BUGS, apparently allows users to create If you mean to refer to Martyn Plummer's project JAGS: http://www-ice.iarc.fr/~martyn/software/jags/ JAGS is "Just Another Gibbs Sampler", and it is decidedly not written in Java. It is, rather, written in C++. JAGS is proposed as a more-or-less complete drop in replacement for BUGS, so the user can write up a BUGS style model and then hand it over to JAGS for processing, the same way we used BUGS before the WinBugs came along and tried to make it a pointy-clicky experience. JAGS has versions of the classic BUGS examples, and I think it is very well done. If you want to run a Gibbs Sampling exercise in Linux, I suggest you seriously consider using JAGS. You might use WinBUGS Doodle thingie to sketch out the code for your model, but then translate it to JAGS. (I put a bit of thought into packaging an RPM for Fedora users a few months ago, but ran into a few little packaging errors that put me off of it. Now I'm running Ubuntu and packaging for that is harder, at least for me...) I notice there are some R packages that are providing pre-packaged estimators for common models through JAGS. Check witness: bayescount Bayesian analysis of count distributions with JAGS bayesmix Bayesian Mixture Models with JAGS It is disappointing/frustrating to me that the source code for WinBUGS/OpenBugs is kept in secret, because here's what I'd really like. 1. Make a version of Doodle for sketching out models. As far as I can see, Doodle is the only truly uniquely valuable component in Win/Open BUGS. It helps people get started by providing a code template. 2. Create an avenue for that Doodle code to travel to JAGS. rJAGS exists as an interface between R and jags. -- Paul E. Johnson Professor, Political Science 1541 Lilac Lane, Room 504 University of Kansas ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
In reply to this post by Peter Muhlberg
Hi Paul & Brian: Thanks for your replies!
Paul: Thank you for the encouragement. You're right that I don't need the working examples or Doodle generator in WinBugs. I'm wondering what open-source components could easily substitute for the core Bugs functionality? Do you know if any of these work on a Linux computer? It does look like JAG would do the trick for a Linux system. My reservations, though, for my task are a few: JAG is java-based and I'm not sure how much of a performance hit there would be relative to C. The manual isn't very helpful for someone who wants to do something outside the box, in my case using my own proposal density and using different proposal densities for different parameters (probably w/ Metropolis in Gibbs). I'm not sure I can make JAG do the latter. I guess I could look through the code base (argh!)--but by then I might be better off learning enough about C and Scythe to write a point density function and using AMCMC. Brian: Thanks for the warning about instability in OpenBugs. As for me, I don't see any straightforward way to even install it on a Linux system. The Task View was very helpful (didn't realize there was a Bayesian one)--UMACS seems very promising, but will need to go through the documentation. I'm just looking for a general and flexible way to implement a Bayesian model that will run quickly. I'm guessing this is a need not a few people have. You are right that AMCMC is 3rd party. It runs slowly in R *relative to the user defining and passing the code a C function as opposed to R function for the point density.* Given that it's largely just an interface to C, I can't see how it could run slowly w/ a C density function. I misspoke: by 'likelihood' I meant point density estimate (p(y | theta, model)). Thanks all! Peter ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
Powered by Nabble | Edit this page |