Package description

An overview of the package and how it differs from RStan.

cmdstanr-package

CmdStanR: the R interface to CmdStan

Installing and setting the path to CmdStan

Install CmdStan, assuming the necessary C++ toolchain.

install_cmdstan() rebuild_cmdstan() cmdstan_make_local() check_cmdstan_toolchain()

Install CmdStan or clean and rebuild an existing installation

set_cmdstan_path() cmdstan_path() cmdstan_version()

Get or set the file path to the CmdStan installation

Running CmdStan from R

Run CmdStan from R.

cmdstan_model()

Create a new CmdStanModel object

CmdStanModel

CmdStanModel objects

check_syntax()

Check syntax of a Stan program

compile()

Compile a Stan program

generate_quantities()

Run Stan's standalone generated quantities method

optimize()

Run Stan's optimization algorithms

sample()

Run Stan's MCMC algorithms

sample_mpi()

Run Stan's MCMC algorithms with MPI

variational()

Run Stan's variational approximation algorithms

cmdstanr_example() print_example_program()

Fit models for use in examples

Fitted model objects and methods

CmdStanMCMC

CmdStanMCMC objects

CmdStanMLE

CmdStanMLE objects

CmdStanVB

CmdStanVB objects

CmdStanGQ

CmdStanGQ objects

cmdstan_summary() cmdstan_diagnose()

Run CmdStan's stansummary and diagnose utilities

draws()

Extract posterior draws

init()

Extract user-specified initial values

inv_metric()

Extract inverse metric (mass matrix) after MCMC

loo()

Leave-one-out cross-validation (LOO-CV)

lp() lp_approx()

Extract log probability (target)

metadata()

Extract metadata from CmdStan CSV files

mle()

Extract (penalized) maximum likelihood estimate after optimization

num_chains()

Extract number of chains after MCMC

output()

Access console output

return_codes()

Extract return codes from CmdStan

sampler_diagnostics()

Extract sampler diagnostics after MCMC

save_object()

Save fitted model object to a file

save_output_files() save_latent_dynamics_files() save_data_file() output_files() latent_dynamics_files() data_file()

Save output and data files

summary()

Compute a summary table of estimates and diagnostics

time()

Report timing of CmdStan runs

Other tools for working with CmdStan

read_cmdstan_csv()

Read CmdStan CSV files into R

write_stan_json()

Write data to a JSON file readable by CmdStan

write_stan_file()

Write Stan code to a file

Knitr engine for CmdStanR

register_knitr_engine()

Register CmdStanR's knitr engine for Stan

eng_cmdstan()

CmdStan knitr engine for Stan