Debabrata Midya
2009-Jul-02 01:07 UTC
[R] MCMCpack: Selecting a better model using BayesFactor
Dear R users, Thanks in advance. I am Deb, Statistician at NSW Department of Commerce, Sydney. I am using R 2.9.1 on Windows XP. This has reference to the package “MCMCpack”. My objective is to select a better model using various alternatives. I have provided here an example code from MCMCpack.pdf. The matrix of Bayes Factors is: model1 model2 model3 model1 1.000 14.08 7.289 model2 0.071 1.00 0.518 model3 0.137 1.93 1.000> PostProbMod(BF)model1 model2 model3 0.82766865 0.05878317 0.11354819 I need assistance to interpret the results. If I am wrong, please correct me. 1. By looking at the matrix of Bayes Factors, Can I say that model1 is better then the other models. Because Bayes Factor for Model1 relative to Model2 is 14.08 > Bayes Factor for Model1 relative to Model3 is 7.289. 2. By looking at the values for PostProbMod(BF), Can I say that model1 is better then the other models because the posterior probability is higher for model1 (0.83 approximately) than the other models. 3. Overall, by looking at the values for PostProbMod(BF), one can say that higher posterior probability indicates the better model. Once again, thank you very much for the time you have given. I am looking forward for your reply. Regards, Deb R Code: library(MCMCpack) data(birthwt) model1 <- MCMCregress(bwt~age+lwt+as.factor(race) + smoke + ht, data=birthwt, b0=c(2700, 0, 0, -500, -500, -500, -500), B0=c(1e-6, .01, .01, 1.6e-5, 1.6e-5, 1.6e-5, 1.6e-5), c0=10, d0=4500000, marginal.likelihood="Chib95", mcmc=50000) model2 <- MCMCregress(bwt~age+lwt+as.factor(race) + smoke, data=birthwt, b0=c(2700, 0, 0, -500, -500, -500), B0=c(1e-6, .01, .01, 1.6e-5, 1.6e-5, 1.6e-5), c0=10, d0=4500000, marginal.likelihood="Chib95", mcmc=50000) model3 <- MCMCregress(bwt~as.factor(race) + smoke + ht, data=birthwt, b0=c(2700, -500, -500, -500, -500), B0=c(1e-6, 1.6e-5, 1.6e-5, 1.6e-5, 1.6e-5), c0=10, d0=4500000, marginal.likelihood="Chib95", mcmc=50000) BF <- BayesFactor(model1, model2, model3) BF PostProbMod(BF) ****************************************************************************** This email message, including any attached files, is confidential and intended solely for the use of the individual or entity to whom it is addressed. The NSW Department of Commerce prohibits the right to publish, copy, distribute or disclose any information contained in this email, or its attachments, by any party other than the intended recipient. If you have received this email in error please notify the sender and delete it from your system. No employee or agent is authorised to conclude any binding agreement on behalf of the NSW Department of Commerce by email. The views or opinions presented in this email are solely those of the author and do not necessarily represent those of the Department, except where the sender expressly, and with authority, states them to be the views of NSW Department of Commerce. The NSW Department of Commerce accepts no liability for any loss or damage arising from the use of this email and recommends that the recipient check this email and any attached files for the presence of viruses. ****************************************************************************** [[alternative HTML version deleted]]