Cmdstan sample() - exclude parameters?


In rstan:stan(), it can exclude parameters by using arguments pars= and include = FALSE.

How may I achieve the same in cmdstanr::sample()? Thanks!

Unfortunately this isn’t possible yet in CmdStanR because CmdStan always writes all variables to CSV. We can control which variables we read in from the CSV but not which ones are written.

There’s an open issue for this in the CmdStan repo from a while ago and I just added a comment to hopefully revive the discussion there:

If it gets implemented in CmdStan then we can expose it in CmdStanR.

1 Like

Yes, please!
Is there any hack to achieve this in generated quantities?
Like defining a matrix inside braces that encompass all the calculations?

local variables aren’t output, so yes, using nested blocks for calculation would work.

1 Like