Fast cmdstanr summary function

Hi everyone. I wrote a small R library for quickly computing posterior summaries of draws_df objects. It’s available at the link below. I’ve seen that there’s been some discussion of speeding up summaries before, but this goes beyond speeding up the mean/median/sd and also improves the speed of computing the convergence metrics. My function is not as generic / deeply-tested as posterior::summarise_draws(), but it gives me a good performance boost for my purposes. Maybe someone will find it useful, just thought I’d share.

Blog post with a bit more detail: Fast cmdstanr summary function – andrewghazi.github.io
Github repo: GitHub - andrewGhazi/fsummary: Fast cmdstanr summaries

6 Likes

Cool, thanks for sharing this!

Very cool! I had the same issue and solved it with a wrapper of the stansummary command-line utility.

2 Likes

Ah interesting, I didn’t know about this. I’ll have to check how it compares.

The stansummary utility in CmdStan is using an older version of Rhat, not the rank-normalized computations introduced in this [1903.08008] Rank-normalization, folding, and localization: An improved $\widehat{R}$ for assessing convergence of MCMC paper. I’m working on a refactor that will correct this; also improve performance. Like all refactors, easier said than done.

1 Like

I wondered about this! Thanks for confirming. Compared to posterior, stansummary does not provide tail ESS either. Is this something we can hope for too?

yes. we were lucky to pick up a new Stan dev who implemented the rank-normalization needed to do the bulk, tail Rhat, it’s just a matter of using that for ESS as well. as I said, WIP.

2 Likes