bayesplot icon indicating copy to clipboard operation
bayesplot copied to clipboard

Request: Extend extractors to work with mcmc.list objects

Open nickrobinson251 opened this issue 6 years ago • 1 comments

Would it be possible to extend extractor methods, such as rhat and neff_ratio, to work with mcmc.list objects, of the type you get back from working with rjags/coda.samples?

Currently, bayesplot-extractors.R says

Currently methods are only provided for stanfit (\pkg{rstan}) and stanreg (\pkg{rstanarm}) objects, but adding new methods should be relatively straightforward.

I'm working with rjags and new to bayesplot. I find the mcmc_* methods helpful for visualising mcmc draws, and would love to use bayesplot for diagnostic checks, etc. Thanks for all the work on bayesplot!

nickrobinson251 avatar Apr 27 '18 21:04 nickrobinson251

Glad you’re finding bayesplot useful! And yeah, the special extractor functions could definitely be extended. You should still be able to use bayesplot for diagnostic plots now if you can create an object of the same structure as the ones returned by the bayesplot extractors. Using the extractors isn’t a requirement, it just makes it easier. But since it does make it quite a bit simpler to have the extractors, I’m open to adding more to the package. We may end up moving the extractors into our other packages (the ones for stanfit objects into rstan, stanreg objects into rstanarm, generic methods in rstantools, etc) because it makes for sense for them to provide the methods for their own objects, but if that happens we can either keep the one for jags in bayesplot if it needs a home or ask Martyn to consider putting it in rjags.

jgabry avatar Apr 28 '18 00:04 jgabry

posterior package can convert mcmc.list objects to posterior objects, posterior has the best implementations for rhat's and ess's, and bayesplot works with posterior objects. Closing this one.

avehtari avatar Jan 15 '24 12:01 avehtari

Good call, thanks @avehtari

jgabry avatar Jan 16 '24 17:01 jgabry