We are very happy to announce that the 2.37.0 release of CmdStan is now available on Github! As usual, the release of CmdStan is accompanied by new releases of Stan Math, core Stan, and Stanc3.
This release cycle brings improvements to Stan’s constrained types, quality-of-life improvements to CmdStan, and many stability improvements and bug fixes.
Contributors, sponsors and donators
We would like to thank everyone that contributed to this release with their bug reports, feature or bug fix discussions, and code or code reviews.
Several issues in early versions of this release were caught and reported by the community, and we are grateful for their time and effort in improving Stan.
We would also like to thank all of our sponsors and donators who have supported us during this last release cycle and in years past. Thanks to the Flatiron Institute for providing us with the computing resources to run unit tests and build scripts for our repositories.
You can support Stan via NumFocus or the Github sponsorship program.
Release highlights
New and Improved Constraints
Similar to last release’s sum_to_zero_vector, this release features a new type, the sum_to_zero_matrix. This type sums to zero across both rows and columns.
Additionally, the existing simplex, column_stochastic_matrix, and row_stochastic_matrix types have been updated to use a new transformation under the hood, which should be faster and more stable in different posterior geometries.
Finally, building on the jacobian += statement, and _jacobian functions added in Stan 2.36, this release adds new functions that expose the implementations of Stan’s built-in constraints to the user.
Each of the built-in transforms now has three corresponding functions:
<transform>_unconstrain– applies the (unconstraining) transform<transform>_constrain– applies the inverse (constraining) transform<transform>_jacobian– applies the inverse (constraining) transform and increments the Jacobian adjustment term accordingly
CmdStan Improvements
For some time now CmdStan has supported running multiple chains in one call to the executable. This required some tricky specification of filenames, which was sometimes unintuitive. While this prior behavior is still supported, there is a new option of simply supplying a comma-separated-list of filenames, one per chain.
CmdStan will now report more useful errors when encountering an unwritable file or running into an error due to a full hard drive.
The default output of CmdStan now uses more digits. This should reduce errors when the output of one run is used as the input for another, e.g. when running standalone generated quantities or using Pathfinder to initialize MCMC.
The laplace_sample algorithm no longer consumes an unnecessarily long amount of memory. Additionally, Pathfinder has had improvements internally to reduce memory usage when PSIS resampling is not requested.
Finally, the stansummary command bundled with CmdStan now reports ESS/second once more.
New hypergeometric functions
The hypergeometric functions (hypergeometric_pFq, as well as specializations for 1F0, 2F1, and 3F2) are now available in the language
Bug fixes! Other changes!
This release also contains a large number of bug fixes across all levels of the Stan ecosystem.
Many functions in the Math library and compiler-generated code have been updated to use C++17 features and perfect forwarding, which fixed several edge case bugs and should improve performance.
The compiler has had a few improvements, including additional argument checking in the Javascript build and the ability to specify - as the argument to the CLI, which makes the compiler read the program from standard input.
Some details are available in the release notes for each project:
How to install the new release?
Download the tar.gz file here, extract it, and use it the way you use any Cmdstan release. We also have an online Cmdstan guide available at https://mc-stan.org/docs/cmdstan-guide.
If you are using cmdstanpy you can install using
cmdstanpy.install_cmdstan()
With CmdStanR you can install using
cmdstanr::install_cmdstan()
Note that both cmdstanpy and CmdStanR users are recommend to update their versions of those libraries when installing a new CmdStan to get support for newer features and the latest bug fixes.
Preview: Embedded Laplace approximations in Stan
The long-awaited functionality for using an embedded Laplace approximation inside Stan has been merged into our development branches, but we’re letting it marinate for an extra version before making it generally available. But if you are someone who has been waiting for this, we’d be glad to have you try it out on our develop branches and give us feedback!
