Processing math: 100%
Type to search
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
Jacobian adjustments
10.2
Optimization algorithms
10.3
The quasi-Newton optimizers
10.4
The Newton optimizer
11
Variational Inference Algorithm: ADVI
11.1
Variational algorithms
11.2
Configuration
11.3
CSV output
12
Standalone Generate Quantities
13
Laplace sampling
13.1
Configuration
13.2
CSV output
13.3
Example
14
Extracting log probabilities and gradients for diagnostics
14.1
Configuration
14.2
CSV output
15
Diagnosing HMC by Comparison of Gradients
16
Parallelization
16.1
Multi-threading with TBB
16.1.1
Compiling
16.1.2
Running
16.2
Multi-processing with MPI
16.2.1
Dependencies
16.2.2
Compiling
16.2.3
Running
16.3
OpenCL
16.3.1
Dependencies
16.3.2
Compiling
16.3.3
Running
CmdStan Tools
17
stanc
: Translating Stan to C++
17.1
Instantiating the
stanc
binary
17.2
The Stan compiler program
18
stansummary
: MCMC Output Analysis
18.1
Building the stansummary command
18.2
Running the
stansummary
program
18.2.1
Sampler parameters
18.2.2
Model parameters and quantities of interest
18.3
Command-line options
19
diagnose
: Diagnosing Biased Hamiltonian Monte Carlo Inferences
19.1
Building the diagnose command
19.2
Running the diagnose command
19.3
diagnose
warnings and recommendations
19.3.1
Divergent transitions after warmup
19.3.2
Maximum treedepth exceeded
19.3.3
Low E-BFMI values - sampler transitions HMC potential energy.
19.3.4
Low effective sample sizes
19.3.5
High
ˆ
R
20
print
(deprecated): MCMC Output Analysis
Appendices
21
Stan CSV File Format
21.1
CSV column names and order
21.2
MCMC sampler CSV output
21.2.1
Sampler Stan CSV output file
21.2.2
Diagnostic CSV output file
21.2.3
Profiling CSV output file
21.3
Optimization output
21.4
Variational inference output
21.5
Generate quantities outputs
21.6
Diagnose method outputs
22
JSON Format for CmdStan
22.1
Creating JSON files
22.2
JSON syntax summary
22.3
Stan data types in JSON notation
22.3.1
Empty arrays in JSON
23
RDump Format for CmdStan
23.1
Creating dump files
23.2
Scalar variables
23.3
Sequence variables
23.4
Array variables
23.5
Matrix- and vector-valued variables
23.5.1
Vector dump format
23.5.2
Matrix dump format
23.5.3
Arrays of vectors and matrices
23.6
Complex-valued variables
23.7
Integer- and real-valued variables
23.7.1
Scientific notation
23.7.2
Infinite and not-a-number values
23.8
Quoted variable names
23.9
Line breaks
23.10
BNF grammar for dump data
24
Using external C++ code
24.1
Derivative specializations
24.2
Special functions: RNGs, distributions, editing
target
Bibliography
A
A
Serif
Sans
White
Sepia
Night
CmdStan User’s Guide
This is an old version,
view current version
.
Appendices
This section contains the following appendices:
Stan CSV File Format
JSON format
RDump data format
Using external C++ code from within a Stan program