We are very happy to announce that the 2.39.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 the embedded Laplace approximation, new functions, and many fixes. Contributors, sponsors and donators We would like … Continue reading Release of CmdStan 2.39 →
We are very happy to announce that the 2.39.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 the embedded Laplace approximation, new functions, and many 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 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. Documentation for the embedded Laplace approximation is available here and here. 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 Aki Vehtari, Steve Bronder, and Charles Margossian. New yule_simon distribution This new discrete distribution was contributed by Zhi Ling with PMF, CDF, CCDF, and RNG functions available. 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. Some details are available in the release notes for each project: stan-dev/math stan-dev/stan stan-dev/stanc3 stan-dev/cmdstan 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.
We are very happy to announce that the 2.38.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 focused on stability and usability improvements, with a few new features and a lot of work under … Continue reading Release of CmdStan 2.38 →
We are very happy to announce that the 2.38.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 focused on stability and usability improvements, with a few new features and a lot of work under the hood for upcoming features. 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 Compiler usability improvements The Stan compiler’s job is primarily to turn Stan code into C++ code, but a very close second is to turn invalid Stan code into error messages. Both of these functionalities saw improvements this version. The C++ code generation saw several changes to try to improve compatibility with different compilers, avoid bad numeric properties that can arise when mixing integers into function calls expecting reals, and avoid some issues for user-defined functions that accepted complicated tuples or used names that are common in other C++ code. On the warning-and-error front, almost all the messages that the compiler can emit were given a once-over for wording consistency and clarity. Additionally, supported terminals can now display the messages in color! <img width="1024" height="447" data-attachment-id="578" data-permalink="https://blog.mc-stan.org/2026/01/13/release-of-cmdstan-2-38/image-2/" data-orig-file="https://blog.mc-stan.org/wp-content/uploads/2026/01/image.png" data-orig-size="1872,818" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="image" data-image-description="" data-image-caption="" data-large-file="https://blog.mc-stan.org/wp-content/uploads/2026/01/image.png?w=1024" src="https://blog.mc-stan.org/wp-content/uploads/2026/01/image.png?w=1024" alt="" class="wp-image-578" srcset="https://blog.mc-stan.org/wp-content/uploads/2026/01/image.png?w=1024 1024w, https://blog.mc-stan.org/wp-content/uploads/2026/01/image.png?w=150 150w, https://blog.mc-stan.org/wp-content/uploads/2026/01/image.png?w=300 300w, https://blog.mc-stan.org/wp-content/uploads/2026/01/image.png?w=768 768w, https://blog.mc-stan.org/wp-content/uploads/2026/01/image.png?w=1440 1440w, https://blog.mc-stan.org/wp-content/uploads/2026/01/image.png 1872w" sizes="(max-width: 1024px) 100vw, 1024px" /> Finally, the compiler build now also provides autocomplete scripts for PowerShell, zsh, and bash. If you download and source these in your shell profile, you can press Tab to suggest flags: <img width="1024" height="447" data-attachment-id="579" data-permalink="https://blog.mc-stan.org/2026/01/13/release-of-cmdstan-2-38/attachment/2/" data-orig-file="https://blog.mc-stan.org/wp-content/uploads/2026/01/2.png" data-orig-size="1872,818" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="2" data-image-description="" data-image-caption="" data-large-file="https://blog.mc-stan.org/wp-content/uploads/2026/01/2.png?w=1024" src="https://blog.mc-stan.org/wp-content/uploads/2026/01/2.png?w=1024" alt="" class="wp-image-579" srcset="https://blog.mc-stan.org/wp-content/uploads/2026/01/2.png?w=1024 1024w, https://blog.mc-stan.org/wp-content/uploads/2026/01/2.png?w=150 150w, https://blog.mc-stan.org/wp-content/uploads/2026/01/2.png?w=300 300w, https://blog.mc-stan.org/wp-content/uploads/2026/01/2.png?w=768 768w, https://blog.mc-stan.org/wp-content/uploads/2026/01/2.png?w=1440 1440w, https://blog.mc-stan.org/wp-content/uploads/2026/01/2.png 1872w" sizes="(max-width: 1024px) 100vw, 1024px" /> New functions for the Wiener first passage time distribution After significant effort by Stan developers Franziska Henrich, Steve Bronder, and Bob Carpenter, Stan now has support for CDF and CCDF functions for the wiener distribution family. These functions do not asymptote at 1, but rather at the probability to hit the top boundary, so they are called wiener_l[c]cdf_unnorm to reflect this. Documentation is available here. Bug fixes! 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! jacobian is now a reserved word in the language. While not quite ready for a release, a lot of other work has been in-progress on the embedded Laplace approximation feature. We hope to get this in your hands soon! Some details are available in the release notes for each project: stan-dev/math stan-dev/stan stan-dev/stanc3 stan-dev/cmdstan 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.
We are thrilled to announce that StanCon 2026 will take place in Uppsala, Sweden, from August 17th to August 21st, 2026. The conference brings together researchers and practitioners passionate about Bayesian inference and probabilistic programming in one of Sweden’s most historic and vibrant university cities. Attendees will enjoy a week of conference talks, workshops, and … Continue reading StanCon 2026, Uppsala, Sweden →
We are thrilled to announce that StanCon 2026 will take place in Uppsala, Sweden, from August 17th to August 21st, 2026. The conference brings together researchers and practitioners passionate about Bayesian inference and probabilistic programming in one of Sweden’s most historic and vibrant university cities. Attendees will enjoy a week of conference talks, workshops, and tutorials spanning both foundational methods and real-world applications. Stay tuned for updates! More information about registration, abstract submission, the program, and deadlines will be posted at https://www.stancon2026.org/. The conference is sponsored by Uppsala University, The Swedish Excellence Centre for Computational Social Science at Linköping University, eSSENCE, and Beijerstiftelsen. With kind regards from the organising committee Måns Magnusson (Uppsala University) Sara Hamis (Uppsala University) Aki Vehtari (Aalto University)
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. … Continue reading Release of CmdStan 2.37 →
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: stan-dev/math stan-dev/stan stan-dev/stanc3 stan-dev/cmdstan 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!
We are very happy to announce that the 2.36.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 new constrained types, improved diagnostics, and a new distribution for heavy-tailed count data. Contributors, sponsors and … Continue reading Release of CmdStan 2.36 →
We are very happy to announce that the 2.36.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 new constrained types, improved diagnostics, and a new distribution for heavy-tailed count data. 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 constraints for stochastic matrices and zero-sum vectors Three new constrained types have been added to Stan in this release: column_stochastic_matrix: A matrix where each column is a simplex row_stochastic_matrix: A matrix where each row is a simplex sum_to_zero_vector: A vector constrained to sum to zero Easier user-defined constraints Historically, users have implemented their own constraints by using target += or _lp functions to add the required Jacobian adjustments. This release adds a new statement, jacobian +=, and accompanying _jacobian functions to make it easier to implement user-defined constraints. Besides being clearer in their intent, these new forms also allow the jacobian to be turned off when it is not needed, such as when finding a maximum likelihood estimate via optimization. Improved diagnostics The stansummary command bundled with CmdStan has been updated with newer versions of the R-hat and ESS diagnostics based on the work in Rank-Normalization, Folding, and Localization: An Improved Rˆ for Assessing Convergence of MCMC (with Discussion). New distribution: beta_neg_binomial This distribution is useful for modeling heavy-tailed count data. Functions are available for the LPDF, CDF, LCDF, LCCDF, and RNG for this distribution. Bug fixes! Other changes! This release also contains a large number of bug fixes across all levels of the Stan ecosystem. Users of the Math library will need to update with care, as this release is accompanied by a major version bump of that submodule. Of note, C++17 will now be required to build Stan. Some details are available in the release notes for each project: stan-dev/math stan-dev/stan stan-dev/stanc3 stan-dev/cmdstan 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.
From sampling statement to distribution statement
The sampling statement name for tilde (~) statements in Stan documentation has been replaced with distribution statement. The background is the tilde (~) statement does not do any sampling (but due to the sampling statement name, some people had wrongly assumed so, which caused confusion) in the literature, tilde (~) is usually read “is distributed as” right side of the tilde (~) statement can only be a built-in or user defined distribution distribution statement makes it more natural to discuss the difference in defining the model with collection of distributions or with log density increments The change affects only the documentation. The documentation has been revised to be more clear on differences in describing models with distribution statements and increment log density (target +=) statements. As this blog lacks equations support, it’s best to go to read the updated documentation on distribution statement. In addition, Stan User’s Guide sections on censored data models and zero-inflated count models are good examples illustrating the difference between describing a data model with distribution statement or writing the likelihood directly with increment log density statement.
We are very happy to announce that the 2.35.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 release cycle focused on fixing bugs and adding quality of life improvements to … Continue reading Release of CmdStan 2.35 →
We are very happy to announce that the 2.35.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 release cycle focused on fixing bugs and adding quality of life improvements to the Stan ecosystem. 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 Bail out with fatal_error() There is a new statement type: fatal_error. This looks a lot like print or reject, but will immediately terminate the algorithm rather than being used to signal a divergence. A new RNG used internally Stan now uses the boost::mixmax pRNG for generating random numbers internally. The primary consequence of this for most users is that seeds from previous versions will not yield the same numerical results on this version. As per usual, exact reproducibility requires a fixed version of Stan, but this change is larger than normal, hence it being noted here. Improved CmdStan outputs Several new output options are available for CmdStan to produce JSON files for easier processing. – The diagnostic_file argument for the Laplace approximation sampler will now give a JSON output which contains the Hessian of the mode – The laplace method now supports the calculate_lp argument, similar to Pathfinder in the previous release. – Pathfinder will no longer return more draws than requested in certain circumstances. New distributions This release saw the extension of the wiener_lpdf distribution to a version with 7 parameters by Franziska Henrich. Existing signatures are unchanged. Deprecations The keyword jacobian is being reserved for use within the Stan language in a future version. Improved portability This release includes support for Windows on ARM64, and allows Windows users to use the standard make command in place of the mingw32-make command. Bug fixes! This release also contains a large number of bug fixes across all levels of the Stan ecosystem. Some details are available in the release notes for each project: stan-dev/math stan-dev/stan stan-dev/stanc3 stan-dev/cmdstan 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.
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 … Continue reading 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. binomial_logit_glm (documentation) dirichlet_multinomial (documentation) 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()
We are very happy to announce that the 2.33.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 two new exciting features that have been in the making … Continue reading Release of CmdStan 2.33 →
We are very happy to announce that the 2.33.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 two new exciting features that have been in the making for more than a year: a new Stan language type – tuples and a new algorithm – Pathfinder. The release also features some new functions – mostly related to tuples, and other minor improvements. There are also a number of long-deprecated language features that have now become errors with this version. Contributors, sponsors and donators We would like to thank everyone who 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. We would like to especially thank everyone who contributed to the Tuples and Pathfinder features that have been in the making for a long time (in alphabetical order): Ryan Bernstein, Steve Bronder, Bob Carpenter, Andrew Gelman, Niko Huure, Mitzi Morris, Aki Vehtari, Brian Ward and Lu Zhang! Release highlights Tuples The Stan language gained a new type: tuples! For any sequence of types, Stan provides a tuple data type. For example, tuple(real, array[5] int) xi; declares xi to be a tuple holding two values, the first of which is of type type real and the second of which is a 5-dimensional array of type int. Tuples can be of arbitrary size. The values in a tuple can be of arbitrary type, but the component types must be declared along with the declaration of the tuple. Tuples can be manipulated as a whole, or their elements may be accessed and set individually. Please see the tuples sections in the User’s Guide and Reference Manual for more details. Pathfinder A new Variational Inference algorithm is now available via CmdStan – Pathfinder! Pathfinder is a variational method for approximately sampling from differentiable log densities. Starting from a random initialization, Pathfinder locates normal approximations to the target density along a quasi-Newton optimization path, with local covariance estimated using the inverse Hessian estimates produced by the L-BFGS optimizer. Pathfinder returns draws from the Gaussian approximation with the lowest estimated Kullback-Leibler (KL) divergence to the true posterior. For more information see the Stan Reference Manual, the Pathfinder paper and Bob Carpenter’s tutorial. The pathfinder algorithm is currently not available in the cmdstanpy/r interfaces. The developers are working on adding that support shortly (hopefully in the next days). New functions and function signatures The new functions are all more efficient tuple-using versions of existing functions: – eigendecompose(A) is equivalent to (eigenvectors(A), eigenvalues(A)) – eigendecompose_sym(A) is equivalent to (eigenvectors_sym(A), eigenvalues_sym(A)) – qr_thin(A) is equivalent to (qr_thin_Q(A), qr_thin_R(A)) – qr(A) is equivalent to (qr_Q(A), qr_R(A)) – svd(A) is equivalent to (svd_U(A), singular_values(A), svd_V(A)) – csr_extract(A) is equivalent to (csr_extract_w(a), csr_extract_v(a), csr_extract_u(a)) These functions all return tuples and have a lower computational cost due to the shared work to produce multiple results. See Functions reference for more. – added vectorized signatures for log_sum_exp The function now supports all arguments that are typically supported in fully vectorized functions. Deprecations The following deprecations have been turned into errors: – The old array syntax, e.g. int arr[5];. Use array[5] int arr; instead. – Distribution functions ending in _log. Use either _lpdf or _lpmf. – The functions binomial_coefficient_log, multiply_log, and cov_exp_quad. Use lchoose, lmultiply, and gp_exp_quad_cov respectively. – The if_else function. Use the ternary operator cond ? true_value : false_value – Use of CDFs with a , between the first and second argument. Use |. – Comments beginning with #. Use //. – Use of <- for assignment. Use =. – The increment_log_prob function. Use the target += statement. – The get_lp() function. Use target(). – The use of nested multi-indices on the left-hand side of an assignment statement. For this version, these can all be automatically updated with the --canonicalize=deprecations argument to the auto-formatter. This is not guaranteed to work for versions following this one. Additionally, the following identifiers are now reserved words: array, offset, multiplier, lower, and upper. Other miscellaneous features – The num_chains argument for running multiple chains with a single executable is now available to all HMC variants other than the static engine – Improved accuracy of matrix_exp_multiply – using the RDump input files now shows a warning – the RDump input files will not support tuples and are unlikely to support the other new types in the future. Please switch to using JSON files for inputs. – Return statements now follow the same type of promotion rules as assignment and function argument passing. 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()
We are very happy to announce that the 2.32.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 Laplace approximation, the Jacobian adjustment for the optimization algorithms, more … Continue reading Release of CmdStan 2.32 →
We are very happy to announce that the 2.32.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 Laplace approximation, the Jacobian adjustment for the optimization algorithms, more supported arguments for the eigenvalues/eigenvectors functions and a ton of bugfixes. This release also includes a number of changes in the backend that will enable some big features in the next few releases (more on that at the end of blog post). The removal of the deprecated language features that were scheduled to become errors in this version was postponed to the next release. 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 Laplace approximation CmdStan now supports sampling from a Laplace approximation. The new method produces a sample from a normal approximation centered at the mode of a distribution in the unconstrained space. For more see the CmdStan documentation for the laplace method. cmdstanpy/r supports should be coming in the next weeks. Jacobian adjustments for optimization Enabling the adjustment produces the maximum a posteriori (MAP) estimate in addition to the existing penalized maximum likelihood estimate. For more details see here. Miscellaneous enhancements and bugfixes eigenvalues and eigenvectors function now accept complex matrices, recursive user-defined functions no longer need forward declarations, improved Stan-to-C++ compile times (especially noticeable for larger models), updated the Eigen library (a dependancy of Stan Math) to version 3.4, fixed an issue with building the TBB dependancy with gcc 13+, and many other minor improvements. Preview of upcoming features Many other changes were done to the Stan backend that will enable some of the features coming up in the next releases. The main ones that we are most excited about tuples and the Pathfinder algorithm. Tuples will allow functions to return more than one type of value simultaneously. For example, a function could be defined that returns both a matrix and some real-valued property of this matrix, or returning both the U and V matrices of a Singular Value Decomposition, removing the need for separate svd_U and svd_V functions which recompute a lot of the same things It will also allow easier and better representation of data that is a mix of different types or different sizes of the same type; currently, it is not possible in Stan to package these together. For more on the feature design, read the design doc here, or the open pull request here. For more on the Pathfinder algorithm, read the arxiv paper here and the open pull requests here and here. 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()