Create MatlabStan StanFit object from existing samples

G’day folks,

A successful call to stan.m returns a StanFit object that can access all of Brian’s neat code, including StanFit.extract() for extracting samples.

What I want to be able to do is create a StanFit object directly and feed it existing samples (from CSV files generated using CmdStan) and be able to subsequently use StanFit.extract().

Is there a built-in way to do this? Or has someone figured out a workaround?

I’ve done some digging around in Brian’s code, but it’s not obvious to me whether this is possible.


Operating System: Mac OS X Yosemite 10.10.5 (14F2511)
Interface Version: MatLabStan
CmdStan v2.15.0

In generla, they get created through the output file that CmdStan writes, which is a rather unwieldy format in Stan 2. Not sure how much MatlabStan relies on in that format.

We’re hoping to clean that up for Stan 3 if that ever arrives!

Thanks @Bob_Carpenter.

I imagine that there’s a way to do it from the samples CSV files alone, but it’s not straightforward. I guess I have some work to do.

Instead of hacking StanFit to bits, I’ll probably just do everything manually through +mstan (read_stan_csv, parse_stan_params, etc.).