Adding standalone generated quantities option to cmdstan (and rstan and pystan)

filed cmdstan issue: Add standalone generated quantities options to cmdstan · Issue #594 · stan-dev/cmdstan · GitHub

now that we’ve got standalone generated quantities merged into core Stan, we need to add hooks into the interfaces.

from this issue:

Allow users to generate additional quantities of interest (i.e., non-parameter variables which depend on the data and/or fitted parameters), after having fit a model to a specific dataset
and saved the sample to a file. After instantiating the model, for each draw in the sample, run the generated quantities block using parameter values in that draw.

The standalone_generate function requires as inputs:

  • the model
  • the dataset used to fit it
  • the set of draws from the posterior.

For cmdstan, the generated csv file contains the draws and can be read back in using existing methods in stan/io. It should also be possible to read in an R dumpfile which contains a the matrix of draws.

how does this sound?
cheers,
Mitzi

I’ve got something plumbed into cmdstan that works with files of cmdstan-generated .csv outputs. it’s got a few rough edges.

which group wanted the standalone generated quantities feature and what interface will they be using?

What does the generated signature end up looking like? I can probably plumb it through rstan

RStan.

found a bug in the core Stan stuff. will resume this conversation when it’s fixed.

not a bug in core Stan impelmentsion - it’s a feature(?) - method in stan/services/sample requires input draws of unconstrained parameters:

here is the spec for standalone generated quantities:

it outlines what needs to be done for cmdstan, rstan, and pystan.

@mitzimorris, just catching up. Ping me if you want my help with anything or want to discuss?

thanks @syclik - will do - for now working on higher priority projects.

👍

I’m not following this issue too closely, but if there’s anything you need from me, I’m around.

FWIW, the rstan interface will presumably input constrained parameters and convert them to unconstrained ones internally before calling the standalone generated quantities block. I think we can compile the standalone generated quantities block with the existing infrastructure.