Run Stan samples from Julia.
Author tpapp
3 Stars
Updated Last
1 Year Ago
Started In
January 2019


lifecycle build

A collection of routines for running CmdStan.


This package is registered. Install with

pkg> add StanRun

You need a working CmdStan installation, the path of which you should specify in JULIA_CMDSTAN_HOME, eg in your ~/.julia/config/startup.jl have a line like

# CmdStan setup
ENV["JULIA_CMDSTAN_HOME"] = expanduser("~/src/cmdstan-2.19.1/") # replace with your path


It is recommended that you start your Julia process with multiple worker processes to take advantage of parallel sampling, eg

julia -p auto

Otherwise, stan_sample will use a single process.

Use this package like this:

using StanRun
model = StanModel("/path/to/model.stan") # directory should be writable, for compilation
data = (N = 100, x = randn(N, 1000))     # in a format supported by stan_dump
chains = stan_sample(model, data, 5)     # 5 chain paths and log files

See the docstrings (in particular ?StanRun) for more.

Used By Packages

No packages found.