Overview
CmdStanR is an interface to Stan for R users (see CmdStanPy for Python).
If you are new to CmdStanR we recommend starting with these vignettes:
Goals
A clean interface to Stan services so that CmdStanR can keep up with Stan releases.
The R code calls CmdStan executables rather than linking to Stan’s C++, and uses Rcpp only for the optional
$expose_functions()and model methods.Modularity: CmdStanR runs Stan’s algorithms and lets downstream modules do the analysis.
Flexible BSD-3 license.
Installation
Installing the R package
You can install the latest release of the CmdStanR R package with
# we recommend running this in a fresh R session or restarting your current session
install.packages("cmdstanr", repos = c('https://stan-dev.r-universe.dev', getOption("repos")))This does not install the vignettes, which take a long time to build, but they are always available online at https://mc-stan.org/cmdstanr/articles/.
The development version is currently the release candidate for CmdStanR 1.0, which we’d like people to test. Install it from GitHub with
# install.packages("remotes")
remotes::install_github("stan-dev/cmdstanr@v1.0")The release notes and documentation for the candidate are at https://mc-stan.org/cmdstanr/rc.
Installing CmdStan
If you don’t already have CmdStan installed then, in addition to installing the R package, it is also necessary to install CmdStan using CmdStanR’s install_cmdstan() function. A suitable C++ toolchain is also required. Instructions are provided in the Getting started with CmdStanR vignette.
Contributing
There is a lot of work still to be done, and we welcome contributions from anyone! If you are interested in contributing, please comment on an open issue or open a new one on GitHub. For more details, please check CONTRIBUTING.md.
License
CmdStanR, like CmdStan and the core Stan C++ code, is licensed under the following licenses:
- Code: BSD 3-clause (https://opensource.org/license/bsd-3-clause/)
- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)