Reusing model and fit object to run generated_quantities block

I fit a model with over 200 parameters this week and it took about 72 hours to finish. I use pystan 2 (if it’s relevant) and dumped a pickle of model and fit object after the job ran. In retrospect, I should have used a generated_quantities block after the fit to calculate the loglikelihood and also to output the samples for combined parameters. Say, I have beta1 from normal(0,1) prior and beta2 from normal(0,0.1) and I need samples for beta3 which is defined as beta1+beta2. Is there a way to “load” the model and the fit object and just have it run the generated_quantities block? TIA.

P.S. Not relevant to the original post but to remove the potential confusion, I’m using beta2 to model changes around beta1 after the rat training phase is over with s.d. of 0.1 capping the amount of change to beta1.

Hi,
this is supported on cmdstanpy (Run Generated Quantities — CmdStanPy 0.9.64 documentation), but appears to have been left out of pystan2: Add support and tests for standalone generated quantities · Issue #416 · stan-dev/pystan2 · GitHub. However, for many use cases, I find it easiest to just compute the generated quantities in the host language as that gives me more flexibility, so I wouldn’t discard that option.

Best of luck with your model!