sung-youn.kim@stonybrook.edu
2003-Apr-18 19:02 UTC
[R] MCMCpack gelman.plot and gelman.diag
Hi, A question. When I run gelman.diag and gelman.plot with mcmc lists obtained from MCMCregress, the results are following.> post.R <- MCMCregress(Size~Age+Status, data = data, burnin = 5000, mcmc = 100000,+ thin = 10, verbose = FALSE, beta.start = NA, sigma2.start = NA, + b0 = 0, B0 = 0, nu = 0.001, delta = 0.001)> post1.R <- MCMCregress(Size~Age+Status, data = data, burnin = 5000, mcmc = 100000,+ thin = 10, verbose = FALSE, beta.start = -3, sigma2.start = NA, + b0 = 0, B0 = 0, nu = 0.001, delta = 0.001)> post2.R <- MCMCregress(Size~Age+Status, data = data, burnin = 5000, mcmc = 100000,+ thin = 10, verbose = FALSE, beta.start = 3, sigma2.start = NA, + b0 = 0, B0 = 0, nu = 0.001, delta = 0.001)> post.R.all <- mcmc.list(post.R, post1.R, post2.R) > gelman.diag(post.R.all, confidence = 0.95, transform=FALSE)Potential scale reduction factors: Point est. 97.5% quantile [1,] NaN NaN [2,] NaN NaN [3,] NaN NaN [4,] NaN NaN Multivariate psrf 1> gelman.plot(post.R.all, bin.width = 20, max.bins = 100, confidence = 0.95, transform = FALSE, auto.layout = TRUE, ask = FALSE)******* Error: ******* Cannot compute Gelman & Rubin's diagnostic for any chain segments for variables (Intercept) Age Status sigma2 This indicates convergence failure Should I have run them with more chains? Any hint? thanks in advance, -- Sung-youn Kim -------------- Dept. of Political Science Stony Brook University (SUNY at Stony Brook) Office: (631)-632-7664 Web: http://www.ic.sunysb.edu/www/stu/sungyoki
2 problems here-- 1) you need to use different seeds in the three runs. you can do this by specifying the seed argument in MCMCregress(). 2) if you look at the C++ code the first full-conditional that is sampled from is [\beta|\sigma^2, y]. Since you are using the same starting values for \sigma^2 in all three runs (and the same seed) you are getting exactly the same stream of draws in each run. if you specify seed and sigma2.start differently for each run you should be able to use the Gelman diagnostics. KQ On Fri, 18 Apr 2003 sung-youn.kim at stonybrook.edu wrote:> Hi, > > A question. When I run gelman.diag and gelman.plot > with mcmc lists obtained from MCMCregress, the results are following. > > > post.R <- MCMCregress(Size~Age+Status, data = data, burnin = 5000, mcmc = 100000, > + thin = 10, verbose = FALSE, beta.start = NA, sigma2.start = NA, > + b0 = 0, B0 = 0, nu = 0.001, delta = 0.001) > > post1.R <- MCMCregress(Size~Age+Status, data = data, burnin = 5000, mcmc = 100000, > + thin = 10, verbose = FALSE, beta.start = -3, sigma2.start = NA, > + b0 = 0, B0 = 0, nu = 0.001, delta = 0.001) > > post2.R <- MCMCregress(Size~Age+Status, data = data, burnin = 5000, mcmc = 100000, > + thin = 10, verbose = FALSE, beta.start = 3, sigma2.start = NA, > + b0 = 0, B0 = 0, nu = 0.001, delta = 0.001) > > post.R.all <- mcmc.list(post.R, post1.R, post2.R) > > gelman.diag(post.R.all, confidence = 0.95, transform=FALSE) > Potential scale reduction factors: > > Point est. 97.5% quantile > [1,] NaN NaN > [2,] NaN NaN > [3,] NaN NaN > [4,] NaN NaN > > Multivariate psrf > > 1 > > gelman.plot(post.R.all, bin.width = 20, max.bins = 100, confidence = 0.95, transform = FALSE, auto.layout = TRUE, ask = FALSE) > > ******* Error: ******* > Cannot compute Gelman & Rubin's diagnostic for any chain > segments for variables (Intercept) Age Status sigma2 > This indicates convergence failure > > > Should I have run them with more chains? Any hint? > > thanks in advance, > > -- > Sung-youn Kim > -------------- > Dept. of Political Science > Stony Brook University (SUNY at Stony Brook) > Office: (631)-632-7664 > Web: http://www.ic.sunysb.edu/www/stu/sungyoki > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >-------------------------------------------------------- Kevin Quinn Assistant Professor Department of Political Science and Center for Statistics and the Social Sciences Box 354320 Padelford Hall University of Washington Seattle, WA 98195-4320 Office: (206) 221-6981 Fax: (206) 221-6873 Email: quinn at stat.washington.edu