Re: MCMC in Mathematica

*To*: mathgroup at smc.vnet.net*Subject*: [mg96036] Re: MCMC in Mathematica*From*: Asim <maa48 at columbia.edu>*Date*: Mon, 2 Feb 2009 06:21:29 -0500 (EST)*References*: <gm0q4e$rmq$1@smc.vnet.net>

On Jan 31, 1:12 am, Ramiro <ramiro.barran... at gmail.com> wrote: > Hello, > > I use Mathematica a lot and now I would like to do MCMC to work on > some of my problems. Is this something that people with experience > would recommend? Or should I move to a different programming language > such as C++ or R? I have done a little samples of MCMC on mathematica > and it does not take much code to get it running, but I am wondering > if I would be better off in the long-run to work on something that > would be faster. > > Thank you, > Ramiro Hi Ramiro The choice between Mathematica and C or C++ depends upon the type of statistical models you want to estimate, and the size of the data sets you have in mind. If you are thinking of panel data situations and nonlinear models with many latent variables and large data sets, then C would be a better outcome. There is, often, no way to avoid loops in MCMC, and this slows down stuff in Mathematica as well as R considerably because of their interpreted nature. In my own work, I use the Gnu Scientific Library in C, as it allows the use of BLAS for matrix algebra, and has almost all the random variables you need in a MCMC situation. Of course, using C means more work in allocation and deallocation of matrices etc, but I have found it to be very useful because no project really needs running something only once. Over repeated runs, and different model specifications, the speed of C is a distinct advantage for complex models and large data situations. Mathematica and R are similar is speed, but R has more packages available for Bayesian analysis, and for statistics in General. Of course, Mathematica has the better interface. Have fun Asim Ansari