StanSample

Project Status Build Status

Installation

This package is registered. It can be installed with:

pkg> add StanSample.jl

StanSample.jl v3 is slightly breaking in that the default return of read_samples has been update to be a NamedTuple, i.e. output_format=:namedtuple, while it used to return a 3 dimensional Array.

You need a working Stan's 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.27.0/") # replace with your path

This package is modeled after Tamas Papp's StanRun.jl package.

Usage

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 StanSample

See the docstrings (in particular ??StanSample) for more help.

Versions

Version 4.0.0 (BREAKING RELEASE!)

  1. Make KeyedArray chains the read_samples() default output.
  2. Drop the output_format kwarg, e.g.: read_samples(model, :dataframe).
  3. Default output format is KeyedArray chains, i.e.: chns = read_samples(model).

Version 3.1.0

  1. Introduction of Tables.jl interface as an output_format option (:table).
  2. Overloading Tables.matrix to group a variable in Stan's output file as a matrix.
  3. Re-used code in read_csv_files() for generated_quantities.
  4. The read_samples() method now consistently applies keyword arguments start and chains.
  5. The table for each chain output_format is :tables.

Version 3.0.1

  1. Thanks to the help of John Wright (@jwright11) all StanJulia packages have been tested on Windows. Most functionality work, with one exception. Stansummary.exe fails on Windows if warmup samples have been saved.

Version 3.0.0

  1. By default read_samples(model) will return a NamedTuple with all chains appended.
  2. output_format=:namedtuples will provide a NamedTuple with separate chains.

Version 2.2.5

  1. Thanks to @yiyuezhuo, a function extract has been added to simplify grouping variables into a NamedTuple.
  2. read_sample() output_format argument has been extended with an option to request conversion to a NamedTuple.

Version 2.2.4

  1. Dropped the use of pmap in StanBase