https://github.com/tpapp/stanrun.jl
Run Stan samples from Julia.
https://github.com/tpapp/stanrun.jl
Last synced: 4 months ago
JSON representation
Run Stan samples from Julia.
- Host: GitHub
- URL: https://github.com/tpapp/stanrun.jl
- Owner: tpapp
- License: other
- Created: 2019-01-29T13:36:57.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-05-05T11:35:15.000Z (about 1 year ago)
- Last Synced: 2025-07-03T07:05:19.270Z (12 months ago)
- Language: Julia
- Size: 50.8 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# StanRun.jl

[](https://github.com/tpapp/StanRun.jl/actions?query=workflow%3ACI)
[](http://codecov.io/github/tpapp/StanRun.jl?branch=master)
A collection of routines for running [CmdStan](https://mc-stan.org/users/interfaces/cmdstan.html).
## Installation
This package is registered. Install with
```julia
pkg> add StanRun
```
You need a working [CmdStan](https://mc-stan.org/users/interfaces/cmdstan.html) installation, the path of which you should specify in `JULIA_CMDSTAN_HOME`, eg in your `~/.julia/config/startup.jl` have a line like
```julia
# CmdStan setup
ENV["JULIA_CMDSTAN_HOME"] = expanduser("~/src/cmdstan-2.36.0/") # replace with your path
```
## Usage
It is recommended that you start your Julia process with multiple worker processes to take advantage of parallel sampling, eg
```sh
julia -p auto
```
Otherwise, `stan_sample` will use a single process.
Use this package like this:
```julia
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.