[R] MCMC/Bayesian framework in R?

Ben Bolker bolker at ufl.edu
Thu Jul 2 12:59:05 CEST 2009




Carsten Dormann wrote:
> 
> Dear R-users (and developers),
> 
> I am looking for an efficient framework to carry out parameter 
> estimations based on MCMC (optionally with specified priors). My goal is 
> as follow:
> * take ANY R-function returning a likelihood-value (this function may 
> itself call external programmes or other code!)
> * run a sampler that covers the multidimensional parameter space (thus 
> creating a posterior distribution)
> * do the above efficiently (!)
> 
> What I want to estimate with this type of setup (apart from the optimal 
> parameter values themselves):
> * parameter uncertainty (i.e. the posterior distribution, indicating how 
> much support the data give to each model parameter)
> * parameter interdependency (to somehow measure effective model
> complexity)
> Both I would extract from the MCMC-trace.
> 
> Sounds simple? It possibly is - just not for me.
> I compared several MCMC algorithms implemented in R, from Win/OpenBUGS 
> over MCMCmetrop1R (MCMCpack; my current favourite) and metrop (mcmc) to 
> gibbs and rwmetrop (LearnBayes) and gibbs_met (gibbs.met). These 
> implementations differ dramatically in efficiency (MCMCmetrop1R was over 
> 20 times faster than gibbs_met).
> Since my functions can be complex (mainly ODEs, complex environmental 
> models programmed in Fortran or C to be called by the system-function), 
> I cannot use OpenBUGS or JAGS.
> 
> MCMCmetrop1R samples from a multinormal distribution, but I would like 
> to have the option to use priors (that's what I refer to as "Bayesian" 
> here: sorry for irritating statisticians with this interpretation). HOW?
> 
> What I did so far (in vain) to find the answer:
> I searched the R-help list (MCMC, Bayes) for suitable threads.
> I looked at all packages listed in R task view Bayesian 
> (http://cran.r-project.org/web/views/Bayesian.html), even those written 
> for specific problems (e.g. regression)
> I searched "the internet" for alternative names for the concepts, or 
> alternative implementation frameworks (e.g. sage)
> 
> Before I start programming (in C inefficiently myself), I would like to 
> seek your advice.
> 
> Any help (also implementations in other languages/software as long at it 
> is GPL or alike) would be appreciated!
> 
> Carsten
> 

Why can't you just hand MCMCpack a (likelihood*prior) function rather
than a likelihood function?  If your likelihood function is calculated
in some other program, you can wrap it in an R function that computes
the prior and returns likelihood*prior ...

  whether MCMCpack is "efficient" enough depends on what you
want to do -- it is very hard to get efficient Bayesian solutions
without hand-tuning them or taking advantage of the structure
of the problem (in a way that you can't do because you're
treating your likelihoods as black boxes)

  good luck
    Ben Bolker

-- 
View this message in context: http://www.nabble.com/MCMC-Bayesian-framework-in-R--tp24304542p24304795.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list