Release of CmdStan 2.34

We are very happy to announce that the 2.34.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. A PyStan update will follow shortly.

This new release brings several improvements to the headline features of the last release – tuple types and the Pathfinder algorithm, new distributions, and other improvements.

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. 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

Tuple “unpacking”

A new feature has been added that will be familiar to users of Python and other languages. Tuple-like items can now appear on the left-hand side of an = in assignment, in a feature known as “unpacking”. See docs for more.

For example, the following is now valid:

parameters {
  matrix[N, M] A;
}
model {
  matrix[N, M] Q;
  matrix[M, M] R;
  (Q, R) = qr_thin(A); // qr_thin returns a tuple(matrix, matrix)
}

Improved CmdStan outputs

Several new output options are available for CmdStan to produce JSON files for easier processing.

  • output save_cmdstan_config=1 will produce a JSON file which contains a serialized copy of the configuration for this run of CmdStan. This should be equivalent to what is currently printed as comments at the top of the CSV file.
  • For sampling algorithms, the argument adaptation save_metric=1 will produce a JSON file that contains the adapted step size and inverse metric. This file can be used with the pre-existing metric argument to initialize later runs.

Additionally, several bugs in the way file names were constructed by CmdStan have been resolved. This should hopefully lead to a more predictable experience when using multi-chain sampling runs or when saving the outputs of individual paths of Pathfinder.

New distributions

This release saw the addition of two new distributions to Stan.

New Pathfinder arguments

The Pathfinder algorithm introduced in the previous release has two additional arguments which may be interesting to those working on further improvements to the algorithm or in specific modelling problems where evaluating the log probability is prohibitively expensive, but it is believed a priori that a normal approximation will be good.

  • psis_resample – if set to false, this disables PSIS resampling of the multiple paths. The returned result is now the draws from each individual path concatenated together.
  • calculate_lp – if set to false, this avoids calculating the log density of draws from the normal approximations. This inherently implies psis_resample be turned off as well.

Both arguments default to true, which is the behavior in prior releases. See more details in docs.

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()

Leave a comment