Dear all, I am writing an R code to fit a Bayesian mixed logit (BML) via MCMC / MH algorithms following Train (2009, ch. 12). Unfortunately, after many draws the covariance matrix of the correlated random parameters tend to become a matrix with almost perfect correlation, so I think there is a bug in the code I wrote but I do not seem to be able to find it.. dull I know. Has anybody written a code for BML with R and would like to share it with me or even take a quick look at my code? I would be extremely grateful for any help. Many thanks to everybody! Carlo *************************************** Senior Research Associate Centre for Social and Economic Research on the Global Environment (CSERGE),
Carlo Fezzi (ENV <C.Fezzi <at> uea.ac.uk> writes:> > Dear all, > > I am writing an R code to fit a Bayesian mixed logit (BML) via MCMC / MHalgorithms following Train (2009, ch. 12).> > Unfortunately, after many draws the covariance matrix > of the correlated random parameters tend to become > a matrix with almost perfect correlation, so I think > there is a bug in the code I wrote but I do not seem to be > able to find it.. dull I know. > > Has anybody written a code for BML with R and would like to share it with meor even take a quick look at my code? I> would be extremely grateful for any help.(1) maybe better at r-sig-mixed-models at r-project.org (2) are you trying this on real, or on simulated data? The collapse of the covariance matrix in this way is a very common symptom of overfitting/underidentification in mixed models. I wouldn't say it necessarily constitutes a bug in your code. In principle you should be able to get an uncorrelated answer if you use a big enough, sufficiently well-behaved simulated data set, but not necessarily for real data ... (3) have you tried the MCMCglmm package, which is a very fast and flexible MCMC-based approach to GLMMs?
Thanks Ben, I am tryin on simulated data, say 300 repondents, 8 choice per person, only 2 random parameters... so i think it should be well behaved... so I am probably doing a mistake! :-) Thank for poiting out the MCMCglmm package, ultimately I need to write my own non-linear untility function, so I do not think I can use standard packages hence I am writing my own code... you know if MCMCglmm can deal with non-linear in parameters utilities, Cheers, Caro -- View this message in context: http://r.789695.n4.nabble.com/bayesian-mixed-logit-tp4304327p4306498.html Sent from the R help mailing list archive at Nabble.com.