I misspoke - this isn’t a shortcut - it’s the only robust and efficient way to code this. trying to re-order and/or subset the fited parameters to match the ordering expected by the standalone generated quantities model would be slow and inefficient. every change made to the parameters block is an opportunity for error. so perhaps requiring the parameter blocks to match is a kind of shortcut - but it’s a good one.
the use case reported here is totally valid - the solution is to rewrite the model along the lines described in the Stan User’s Guide - 1.14 Prediction, forecasting, and backcasting | Stan User’s Guide - Predictions as Generated Quantities -
- the data passed in consists of both datasets
- the parameter block is the same as in the data fitting model
- the new data is used in the generated quantities block
does this outline make sense?
note: closed CmdStan issue; added docs issue instead: CmdStan - generate-quantities - document how to use new data for prediction · Issue #269 · stan-dev/docs · GitHub