CmdStan & Stan 2.39 Release Candidates

I am happy to announce that the latest release candidates of CmdStan and Stan are now available on Github!

This release cycle brings the embedded laplace approximation, new functions, and many fixes.

You can find the release candidate for CmdStan here. Instructions for installing are given at the bottom of this post.

Please test the release candidate with your models and report if you experience any problems. We also kindly invite you to test the new features and provide feedback. If you feel some of the new features could be improved or should be changed before the release, please do not hesitate to comment.

The Stan development team appreciates your time and help in making Stan better.

If everything goes according to plan, the 2.39 version will be released next week.

Below are some of the highlights of the new release.

The embedded Laplace approximation

After a few additional improvements to the underlying algorithm, we’re releasing a suite of functions to perform an embedded Laplace approximation, in a similar flavor to what is done in the INLA and TMB packages. These functions approximate the marginal likelihoods and conditional posteriors that arise in latent Gaussian models. The idea is to integrate out the latent Gaussian variables with a Laplace approximation and then perform standard inference on the hyperparameters. These functions give users a lot of flexibility when specifying a prior covariance matrix and a likelihood function, although the approximation is not guaranteed to work well for an arbitrary likelihood.

We’d like for people to fit their favorite latent Gaussian models with the embedded Laplace approximation, either using some of the built-in likelihoods or by specifying their own likelihood. We want to make sure the documentation provides enough guidance for users to write down their model.

Preliminary documentation for the embedded Laplace approximation is available here. These will continue to be updated during the release cycle, so check back!

Some additional materials are available here, though please note that the syntax has changed since these older materials were written.

This is a large feature, with a lot of credit to spread around. Particular thanks for these recent improvements go to @avehtari @stevebronder and @charlesm93

New yule_simon distribution

This new discrete distribution was contributed by @lingium with PMF, CDF, CCDF, and RNG functions available.

Preliminary documentation is available here

Other changes

There have been various other bug fixes and usability improvements this release, thank you to everyone who reported a bug in the last few months!

Various error messages output by the compiler were improved.

The gamma_lccdf function was made more numerically stable.

Added a converged__ column to the output of the optimization algorithms,
which documents why the optimization algorithm halted. A string explanation
is also added as a comment.

Length-1 tuples can now be declared using a trailing comma, e.g. tuple(real, ) x = (3.14, );. This is primarily valuable for using tuples with the embedded laplace approximation feature, which uses tuples to pass arguments to user-defined callbacks.

More details on all of the above and more are available in the preliminary release notes

How to install?

Download the tar.gz file from the link above, extract it and use it the way you use any Cmdstan release. We also have an online Cmdstan guide available at CmdStan User’s Guide .

If you are using cmdstanpy you can install the release candidate using


cmdstanpy.install_cmdstan(version='2.39.0-rc1')

With CmdStanR you can install the release candidate using


cmdstanr::install_cmdstan(version = "2.39.0-rc1", cores = 4)

I succesfully tested embedded Laplace and compiled 42 Stan models from posteriordb

The actual release should be posted tomorrow, there ended up being a scheduling conflict today that prevented us from preparing everything in time