Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable rhat and ess for tidy.brmsfit() #149

Merged
merged 7 commits into from
Mar 31, 2024
Merged

Conversation

alyst
Copy link

@alyst alyst commented Feb 8, 2024

Add support for calculating Rhat and ESS convergence metrics to tidy.brmsfit2.
For Rhat, it uses brms::rhat() method, for ESS, it uses posterior::ess_basic().
Actually, the posterior package has support for vectorized calculation of many metrics, including mean, std, quantiles etc (using MatrixStats under the hood), so it could be potentially used in the other places instead of apply(samples, 2, fun) to improve the performance.

@bbolker
Copy link
Owner

bbolker commented Feb 8, 2024

Hmm, this is a nice idea and I really appreciate PRs, but ... could you see if you can easily resolve the checks that are failing ... ?

Alexey Stukalov added 2 commits February 8, 2024 14:29
somehow applying rhat/ess_bulk on the draws_array directly resulted in wrong values, it needs to be passed to summarize_draws()
@alyst
Copy link
Author

alyst commented Feb 8, 2024

Tests fixed

@alyst
Copy link
Author

alyst commented Feb 9, 2024

Since it turned out that using posterior::summarise_draws() was required to correctly calculate both rhat and ess, I can change the code to also use summarise_draws() for mean/median, std/mad and quantile calculation -- so that all the metrics (except HDPinterval) are calculated by one call.

@bbolker bbolker merged commit 6226e66 into bbolker:main Mar 31, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants