stan-dev / bayesplot

bayesplot R package for plotting Bayesian models
https://mc-stan.org/bayesplot
GNU General Public License v3.0
431 stars 82 forks source link

Phase out functions that reside in posterior #295

Open sims1253 opened 1 year ago

sims1253 commented 1 year ago

bayesplot is still offering metrics like rhat that now reside in the posterior package. Not do both packages implement them, the implementations differ (afaik posterior is the up-to-date one while bayesplot is lacking behind). Bayesplot should either just wrap posterior or completely remove those functions to have a single space for them I think.

jgabry commented 1 year ago

Thanks for opening the issue. The situation is a bit confusing because the functions unfortunately have the same name but do different things. bayesplot's rhat function isn't computing rhat itself, it's just provided for convenience to extract the rhat values. That means that for a model fit using CmdStanR the rhat values should be the same as the ones computed by posterior. For RStan models we get the old version of Rhat because RStan is lagging behind and hasn't updated to using posterior yet.

Maybe the rhat() function in bayesplot should be deprecated in favor of a function named extract_rhat()? That would avoid confusion about what's going on under the hood. What do you think?

sims1253 commented 1 year ago

I agree, that renaming the functions could help with clarity. It would also prevent masking when loading posterior and bayesplot together.