Shinystan for cmdstan output

Hello everyone,

I’ve spend a little bit of time on creating a version of shinystan that will take as upload .csv file(s) output from cmdstan. This way it should be more accessible, not only for R users. Please take a look at the initial version and let me know if you find flaws or bugs / errors. It can currently be found here

I’ll try to find a more sustainable location for it, as my personal free account will not sustain to much use.

Hope it’s useful for some of you,

Best,

Duco

8 Likes

Just noting, that this might be one of those things that can experience problems due to the fact that information is lost when output is saved to .csv and then loaded from there, because cmdstan saves the .csv output “with at most 6 digits of precision”. Then if you have parameters or generated quantities that vary only very little, their variance with this precision can be zero and computing R-hat can give NaN or something. And I don’t know what other problems the rounding can cause, maybe some related to simplices as @avehtari noted in the Slack chat.

bravo Duco - this is super cool!

no longer!
as of CmdStan 2.25, command line arg “sig-figs” allows for max 18 digits precision: 8 Command-Line Interface Overview | CmdStan User’s Guide

1 Like

Allows but defaults to 6?

1 Like

correct

  • saving at 18 digits instead of 6 will make csv files 3x’s as large
  • usually you don’t need even 6 digits of precision

edit: OK, I see the point about low variance. basically, just another reason we need to move beyond Stan CSV as output format.

1 Like

But when you do, our other code is not able to warn the user why there is a problem as suspected for ShinyStan and as can happen with simplex and stand alone generated quantities generate_quantities can fail with simplex · Issue #420 · stan-dev/cmdstanr · GitHub (this was the main reason I posted this additiona comment here). I and some other have also spent some hours figuring out why Rhat and ESS computations didn’t match before realizing the limited csv accuracy. Thus even when most of the time 6 digits is enough, it can cause sometimes cause unexpected and difficult to solve problems.

The discussion in that simplex and generated quantities issue also mentions the eventual move to binary format. I guess that is needed also for reliable check pointing.

3 Likes

That’s excellent!

1 Like