I had an issue with extracting scalar values, with cmdstanr v0.2, as reported in an issue (filed by @mitzimorris ) so I updated to v0.4, and now I have the opposite problem: I can only extract scalar parameters. For vector parameters, I get the following message
> log_lik_draws <- fit$draws("log_lik")
Error in `[.default`(private$draws_, , , variables, drop = FALSE) :
subscript out of bounds
Is there a workaround this – other than downgrading back to cmdstanr 2.0?
I get the same error when trying to call fit$summary(), etc.
Sorry for the problems :) And thanks for helping tracking them down.
This might be an outdated version of the posterior package on your system as this case of extracting a non-scalar variable is definitely in our unit tests, but granted we only test with the latest version of the posterior package.
Thanks for the suggestion. I gave it a try, but this did not fix the issue. The current version of posterior I’m using is 0.1.4.
I’m also using R 4.0.2, and I realize cmdstanr was built with 4.0.5. I could update R, but I’d rather avoid doing this, since this means I’d also need to update a whole lot of packages and potentially perturb my workflow.
Charles sent me the files by email, just posting here for anyone with a similar issue.
This problem was caused by the fit object being created by 0.2 and used by 0.4 version, which will not work, except if you still had the CSV files stored (in which case you could create the fit object from them anyways). Charles only had a rds file containing the fot object.
The solution was to downgrade and retrieve the draws.