I am happy to announce that the latest release candidates of Cmdstan and Stan are now available on Github!
This release cycle brings the complex type, support for a new built-in distribution, better handling of sampling with multiple chains, more efficient algebra solver and inv_Phi function and improve error messaging
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 more efficient while maintaining a high level of reliability.
If everything goes according to plan, the 2.28 version will be released next Tuesday.
Below are some of the highlights of the new release.
Complex type
Stan now supports complex numbers with all of the standard complex functions, including natural logarithm log(z)
, natural exponentiation exp(z)
, and powers pow(z1, z2)
, as well as all of the trig and hyperbolic trigonometric functions and their inverse, such as sin(z)
, acos(z)
, tanh(z)
and asinh(z)
.
More detailed documentation that will be part of the User’s guide is currently available here. The function reference is available here.
Skew double exponential distribution
All typical distributions-related functions are now available for the Skew double exponential distribution:
skew_double_exponential_lpdf
, skew_double_exponential_cdf
, skew_double_exponential_lcdf
, skew_double_exponential_lccdf
and skew_double_exponential_rng
.
The functions reference is available here.
More efficient multi chain sampling with cmdstan using threads in a single executable
It is now possible to sample using NUTS with multiple chains with a single executable with multiple chains running using threads. This should be slightly faster in general and also reduces the memory footprint as all chains share the same copy of data, while previously each chain had its own copy of all the input data.
When using within-chain parallelization all chains started within a single executable can share all the available threads. This means what once a chain finishes the threads will be reused in the other chains. This type of resource sharing was previously unavailable.
More details are currently available here.
New num_threads
command-line argument
The number of threads used with within-chain parallelization can now be specified as a regular argument to the CmdStan executable.
Previously the number of threads was specifed via an environment variable STAN_NUM_THREADS.
Details are available here.
More efficient Power & Newton algebra solvers and the inv_Phi function
The autodifferentiation in the Powell and Newton solvers now efficiently computes cotangents by replacing matrix inversion with a smaller number of matrix solves.
The inv_Phi should be approximately 2x faster with precision of 16 digits with changes based on the Fortran algorithm described in Wichura, M. J. (1988) Algorithm AS 241: The percentage points of the normal distribution. Applied Statistics, 37, 477–484.
Automatic handling of precompiled headers on Windows with RTools 4.0
With CmdStan 2.28, precompiled headers that speedup model compilation are enabled by default on Windows when using RTools 4.0. Previously, they were only enabled if the user manually specified PRECOMPILED_HEADERS=true
in the make/local file.
Improved error messaging/type error explanations in stanc3
The Stan-to-C++ compiler now has an improved error messaging, particulary with better explanations in case of type mismatches.
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, make sure you point to the folder where you extracted the tar.gz file with
set_cmdstan_path(os.path.join('path','to','cmdstan'))
With CmdStanR you can install the release candidate using
cmdstanr::install_cmdstan(version = "2.28.0-rc2", cores = 4)
And then select the RC with
cmdstanr::set_cmdstan_path(file.path(Sys.getenv("HOME"), ".cmdstanr", "cmdstan-2.28.0-rc2"))