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


#1

filed cmdstan issue: https://github.com/stan-dev/cmdstan/issues/594

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


Random number generation separate for generated quantities?
#2

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?


#3

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


#4

RStan.


#5

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


#6

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.


#7

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


#8

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


#9

👍

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


#10

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.