Package: cmdstanr 0.8.1

Andrew Johnson

cmdstanr: R Interface to 'CmdStan'

A lightweight interface to 'Stan' <https://mc-stan.org>. The 'CmdStanR' interface is an alternative to 'RStan' that calls the command line interface for compilation and running algorithms instead of interfacing with C++ via 'Rcpp'. This has many benefits including always being compatible with the latest version of Stan, fewer installation errors, fewer unexpected crashes in RStudio, and a more permissive license.

Authors:Jonah Gabry [aut], Rok Češnovar [aut], Andrew Johnson [aut, cre], Steve Bronder [aut], Ben Bales [ctb], Mitzi Morris [ctb], Mikhail Popov [ctb], Mike Lawrence [ctb], William Michael Landau [ctb], Jacob Socolar [ctb], Martin Modrák [ctb], Ven Popov [ctb]

cmdstanr_0.8.1.tar.gz
cmdstanr_0.8.1.zip(r-4.5)cmdstanr_0.8.1.zip(r-4.4)cmdstanr_0.8.1.zip(r-4.3)
cmdstanr_0.8.1.tgz(r-4.4-any)cmdstanr_0.8.1.tgz(r-4.3-any)
cmdstanr_0.8.1.tar.gz(r-4.5-noble)cmdstanr_0.8.1.tar.gz(r-4.4-noble)
cmdstanr_0.8.1.tgz(r-4.4-emscripten)cmdstanr_0.8.1.tgz(r-4.3-emscripten)
cmdstanr.pdf |cmdstanr.html
cmdstanr/json (API)
NEWS

# Install cmdstanr in R:
install.packages('cmdstanr', repos = c('https://r-multiverse.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/stan-dev/cmdstanr/issues

On CRAN:

bayesbayesianmarkov-chain-monte-carlomaximum-likelihoodmcmcstanvariational-inference

32 exports 138 stars 5.47 score 26 dependencies 5 dependents

Last updated 27 days agofrom:02259ef7aa (via v0.8.1)

Exports:as_cmdstan_fitas_drawsas_mcmc.listas.CmdStanDiagnoseas.CmdStanGQas.CmdStanLaplaceas.CmdStanMCMCas.CmdStanMLEas.CmdStanPathfinderas.CmdStanVBcheck_cmdstan_toolchaincmdstan_default_install_pathcmdstan_default_pathcmdstan_make_localcmdstan_modelcmdstan_pathcmdstan_versioncmdstanr_exampledraws_to_csveng_cmdstaninstall_cmdstannum_threadsprint_example_programread_cmdstan_csvread_sample_csvrebuild_cmdstanregister_knitr_engineset_cmdstan_pathset_num_threadswrite_stan_filewrite_stan_jsonwrite_stan_tempfile

Dependencies:abindbackportscheckmateclidata.tabledistributionalfansigenericsgluejsonlitelifecyclemagrittrmatrixStatsnumDerivpillarpkgconfigposteriorprocessxpsR6rlangtensorAtibbleutf8vctrswithr

Getting started with CmdStanR

Rendered fromcmdstanr.Rmdusingknitr::rmarkdownon Jun 22 2024.

Last update: 2024-06-03
Started: 2019-10-15

How does CmdStanR work?

Rendered fromcmdstanr-internals.Rmdusingknitr::rmarkdownon Jun 22 2024.

Last update: 2023-12-13
Started: 2020-06-24

Profiling Stan programs with CmdStanR

Rendered fromprofiling.Rmdusingknitr::rmarkdownon Jun 22 2024.

Last update: 2023-07-26
Started: 2021-01-25

R Markdown CmdStan Engine

Rendered fromr-markdown.Rmdusingknitr::rmarkdownon Jun 22 2024.

Last update: 2023-09-26
Started: 2020-08-03

Working with Posteriors

Rendered fromposterior.Rmdusingknitr::rmarkdownon Jun 22 2024.

Last update: 2024-04-23
Started: 2023-06-26

Readme and manuals

Help Manual

Help pageTopics
CmdStanR: the R interface to CmdStancmdstanr-package CmdStanR cmdstanr
Create a 'draws' object from a CmdStanR fitted model objectas_draws as_draws.CmdStanGQ as_draws.CmdStanLaplace as_draws.CmdStanMCMC as_draws.CmdStanMLE as_draws.CmdStanPathfinder as_draws.CmdStanVB
Convert 'CmdStanMCMC' to 'mcmc.list'as_mcmc.list
Coercion methods for CmdStan objectsas.CmdStanDiagnose as.CmdStanGQ as.CmdStanLaplace as.CmdStanMCMC as.CmdStanMLE as.CmdStanPathfinder as.CmdStanVB cmdstan_coercion
Create a new CmdStanModel objectcmdstan_model
CmdStanDiagnose objectsCmdStanDiagnose
CmdStanGQ objectsCmdStanGQ
CmdStanLaplace objectsCmdStanLaplace
CmdStanMCMC objectsCmdStanMCMC
CmdStanMLE objectsCmdStanMLE
CmdStanModel objectsCmdStanModel
CmdStanPathfinder objectsCmdStanPathfinder
Fit models for use in examplescmdstanr_example print_example_program
CmdStanR global optionscmdstanr_global_options
CmdStanVB objectsCmdStanVB
Write posterior draws objects to CSV files suitable for running standalone generated quantities with CmdStan.draws_to_csv
CmdStan knitr engine for Staneng_cmdstan
Run CmdStan's 'stansummary' and 'diagnose' utilitiescmdstan_diagnose cmdstan_summary fit-method-cmdstan_diagnose fit-method-cmdstan_summary
Return Stan codecode fit-method-code
Transform a set of unconstrained parameter values to the constrained scaleconstrain_variables fit-method-constrain_variables
Sampler diagnostic summaries and warningsdiagnostic_summary fit-method-diagnostic_summary
Extract posterior drawsdraws fit-method-draws
Calculate the log-probability and the gradient w.r.t. each input for a given vector of unconstrained parametersfit-method-grad_log_prob grad_log_prob
Extract gradients after diagnostic modefit-method-gradients gradients
Calculate the log-probability , the gradient w.r.t. each input, and the hessian for a given vector of unconstrained parametersfit-method-hessian hessian
Extract user-specified initial valuesfit-method-init init
Compile additional methods for accessing the model log-probability function and parameter constraining and unconstraining.fit-method-init_model_methods init_model_methods
Extract inverse metric (mass matrix) after MCMCfit-method-inv_metric inv_metric
Calculate the log-probability given a provided vector of unconstrained parameters.fit-method-log_prob log_prob
Leave-one-out cross-validation (LOO-CV)fit-method-loo loo
Extract log probability (target)fit-method-lp lp lp_approx
Extract metadata from CmdStan CSV filesfit-method-metadata metadata
Extract (penalized) maximum likelihood estimate after optimizationfit-method-mle mle
Extract number of chains after MCMCfit-method-num_chains num_chains
Access console outputfit-method-output output
Return profiling datafit-method-profiles profiles
Extract return codes from CmdStanfit-method-return_codes return_codes
Extract sampler diagnostics after MCMCfit-method-sampler_diagnostics sampler_diagnostics
Save fitted model object to a filefit-method-save_object save_object
Save output and data filesconfig_files data_file fit-method-data_file fit-method-latent_dynamics_files fit-method-output_files fit-method-profile_files fit-method-save_config_files fit-method-save_data_file fit-method-save_latent_dynamics_files fit-method-save_metric_files fit-method-save_output_files fit-method-save_profile_files latent_dynamics_files metric_files output_files profile_files save_config_files save_data_file save_latent_dynamics_files save_metric_files save_output_files save_profile_files
Compute a summary table of estimates and diagnosticsfit-method-print fit-method-summary print.CmdStanMCMC print.CmdStanMLE print.CmdStanVB summary
Report timing of CmdStan runsfit-method-time time
Transform all parameter draws to the unconstrained scalefit-method-unconstrain_draws unconstrain_draws
Transform a set of parameter values to the unconstrained scalefit-method-unconstrain_variables unconstrain_variables
Return the variable skeleton for 'relist'fit-method-variable_skeleton variable_skeleton
Install CmdStan or clean and rebuild an existing installationcheck_cmdstan_toolchain cmdstan_make_local install_cmdstan rebuild_cmdstan
Check syntax of a Stan programcheck_syntax model-method-check_syntax
Compile a Stan programcompile model-method-compile
Run Stan's diagnose methoddiagnose model-method-diagnose
Expose Stan functions to Rexpose_functions fit-method-expose_functions model-method-expose_functions
Run stanc's auto-formatter on the model code.format model-method-format
Run Stan's standalone generated quantities methodgenerate_quantities model-method-generate-quantities
Run Stan's Laplace algorithmlaplace model-method-laplace
Run Stan's optimization algorithmsmodel-method-optimize optimize
Run Stan's Pathfinder Variational Inference Algorithmmodel-method-pathfinder pathfinder
Run Stan's MCMC algorithmsmodel-method-sample sample
Run Stan's MCMC algorithms with MPImodel-method-sample_mpi sample_mpi
Input and output variables of a Stan programmodel-method-variables variables
Run Stan's variational approximation algorithmsmodel-method-variational variational
Read CmdStan CSV files into Ras_cmdstan_fit read_cmdstan_csv
Register CmdStanR's knitr engine for Stanregister_knitr_engine
Get or set the file path to the CmdStan installationcmdstan_path cmdstan_version set_cmdstan_path
Write Stan code to a filewrite_stan_file
Write data to a JSON file readable by CmdStanwrite_stan_json