dummy-link

StanMCMCChains

Convert CmdStan chains to MCMCChains.Chains. Included in CmdStan v5.0.0.

Readme

StanMCMCChains

Build Status

Coverage Status

codecov.io

Introduction

This package converts the output produced by CmdStan.jl to a TuringLang/Chains object suitable for further processing by the MCMCChains package.

Usage

In the definition of the Stanmodel, request the output_format=:mcmcchains:

stanmodel = Stanmodel(num_samples=1200, thin=2, name="bernoulli", 
    model=bernoullimodel, output_format=:mcmcchains);

The subsequent call to stan() will now return a MCMCChains.Chains object in chains as in the included Bernoulli example:

... (snipped)

  rc, chains, cnames = stan(stanmodel, observeddata, ProjDir, diagnostics=false,
    CmdStanDir=CMDSTAN_HOME);
    
... (snipped)

It is also possible to do this conversion after the call to stan():

stanmodel = Stanmodel(num_samples=1200, thin=2, name="bernoulli", 
    model=bernoullimodel);

  rc, sims, cnames = stan(stanmodel, observeddata, ProjDir, diagnostics=false,
    CmdStanDir=CMDSTAN_HOME);
  
  chains = convert_a3d(sims, cnames, Val(:mcmcchains))

The bernoulli example also demonstrated how a Chains object can be saved and restored.

Further examples

Several more examples will be contained in StanMCMCChainsExamples.jl.

First Commit

02/26/2019

Last Touched

4 months ago

Commits

88 commits

Used By: