• CmdStan User's Guide
  • Introduction
  • QuickStart Guide
  • 1 CmdStan Installation
    • 1.1 Installation via conda
      • 1.1.1 CmdStan install location under conda
    • 1.2 Installation from GitHub
      • 1.2.1 Downloading the source code
      • 1.2.2 Building CmdStan
    • 1.3 Checking the Stan compiler
    • 1.4 Troubleshooting the installation
      • 1.4.1 Common problems
    • 1.5 C++ Toolchain
    • 1.6 Using GNU Make
  • 2 Example Model and Data
  • 3 Compiling a Stan Program
    • 3.1 Invoking the Make utility
    • 3.2 Dependencies
    • 3.3 Compiler errors
    • 3.4 Troubleshooting C++ compiler or linker errors
    • 3.5 C++ compilation and linking flags
      • 3.5.1 Optimizing by ignoring range checks
  • 4 MCMC Sampling
    • 4.1 Running the sampler
    • 4.2 Running multiple chains
      • 4.2.1 Using the num_chains argument to run multiple chains
      • 4.2.2 Using shell for running multiple chains
    • 4.3 Stan CSV output file
    • 4.4 Summarizing sampler output(s) with stansummary
  • 5 Optimization
  • 6 Variational Inference
  • 7 Generating Quantities of Interest from a Fitted Model
  • Reference Manual
  • 8 Command-Line Interface Overview
    • 8.1 Input data argument
    • 8.2 Output control arguments
    • 8.3 Initialize model parameters argument
    • 8.4 Random number generator arguments
    • 8.5 Chain identifier argument: id
    • 8.6 Command line help
    • 8.7 Error messages and return codes
  • 9 MCMC Sampling using Hamiltonian Monte Carlo
    • 9.1 Iterations
    • 9.2 Adaptation
      • 9.2.1 Step size optimization configuration
      • 9.2.2 Warmup schedule configuration
    • 9.3 Algorithm
      • 9.3.1 Samples from a set of fixed parameters
      • 9.3.2 HMC samplers
    • 9.4 Sampler diagnostic file
    • 9.5 Examples
      • 9.5.1 Running multiple chains with a specified RNG seed
      • 9.5.2 Changing the default warmup and sampling iterations
      • 9.5.3 Saving warmup draws
      • 9.5.4 Initializing parameters
      • 9.5.5 Specifying the metric and stepsize
      • 9.5.6 Changing the NUTS-HMC adaptation parameters
      • 9.5.7 Increasing the tree-depth
      • 9.5.8 Capturing Hamiltonian diagnostics and gradients
      • 9.5.9 Suppressing progress updates to the console
      • 9.5.10 Everything example
  • 10 Maximum Likelihood Estimation
    • 10.1 Optimization algorithms
    • 10.2 The quasi-Newton optimizers
    • 10.3 The Newton optimizer
  • 11 Variational Inference Algorithm: ADVI
    • 11.1 Variational algorithms
    • 11.2 Configuration
    • 11.3 CSV output
  • 12 Standalone Generate Quantities
  • 13 Extracting log probabilities and gradients for diagnostics
    • 13.1 Configuration
    • 13.2 CSV output
  • 14 Diagnosing HMC by Comparison of Gradients
  • 15 Parallelization
    • 15.1 Multi-threading with TBB
      • 15.1.1 Compiling
      • 15.1.2 Running
    • 15.2 Multi-processing with MPI
      • 15.2.1 Dependencies
      • 15.2.2 Compiling
      • 15.2.3 Running
    • 15.3 OpenCL
      • 15.3.1 Dependencies
      • 15.3.2 Compiling
      • 15.3.3 Running
  • CmdStan Tools
  • 16 stanc: Translating Stan to C++
    • 16.1 Instantiating the stanc binary
    • 16.2 The Stan compiler program
  • 17 stansummary: MCMC Output Analysis
    • 17.1 Building the stansummary command
    • 17.2 Running the stansummary program
      • 17.2.1 Sampler parameters
      • 17.2.2 Model parameters and quantities of interest
    • 17.3 Command-line options
  • 18 diagnose: Diagnosing Biased Hamiltonian Monte Carlo Inferences
    • 18.1 Building the diagnose command
    • 18.2 Running the diagnose command
    • 18.3 diagnose warnings and recommendations
      • 18.3.1 Divergent transitions after warmup
      • 18.3.2 Maximum treedepth exceeded
      • 18.3.3 Low E-BFMI values - sampler transitions HMC potential energy.
      • 18.3.4 Low effective sample sizes
      • 18.3.5 High \(\hat{R}\)
  • 19 print (deprecated): MCMC Output Analysis
  • Appendices
  • 20 Stan CSV File Format
    • 20.1 CSV column names and order
    • 20.2 MCMC sampler CSV output
      • 20.2.1 Sampler Stan CSV output file
      • 20.2.2 Diagnostic CSV output file
      • 20.2.3 Profiling CSV output file
    • 20.3 Optimization output
    • 20.4 Variational inference output
    • 20.5 Generate quantities outputs
    • 20.6 Diagnose method outputs
  • 21 JSON Format for CmdStan
    • 21.1 Creating JSON files
    • 21.2 JSON syntax summary
    • 21.3 Stan data types in JSON notation
      • 21.3.1 Empty arrays in JSON
  • 22 RDump Format for CmdStan
    • 22.1 Creating dump files
    • 22.2 Scalar variables
    • 22.3 Sequence variables
    • 22.4 Array variables
    • 22.5 Matrix- and vector-valued variables
      • 22.5.1 Vector dump format
      • 22.5.2 Matrix dump format
      • 22.5.3 Arrays of vectors and matrices
    • 22.6 Complex-valued variables
    • 22.7 Integer- and real-valued variables
      • 22.7.1 Scientific notation
      • 22.7.2 Infinite and not-a-number values
    • 22.8 Quoted variable names
    • 22.9 Line breaks
    • 22.10 BNF grammar for dump data
  • 23 Using external C++ code
  • Bibliography

CmdStan User’s Guide

19 print (deprecated): MCMC Output Analysis

The print utility is deprecated, but is still available until CmdStan v3.0. Use the stansummary utility instead.