Closed bschneidr closed 1 year ago
Thanks for opening this, this is a tricky one!
The fact that sd_1
is a vector of length 1 is causing our pre-processing to structure it as a real
rather than a vector[1]
before passing to be unconstrained. This then trips the dims
error, since a real
has no declared dimensions.
I'll sort out a fix and add this as a test case
Thanks, @andrjohns. That explanation makes sense to me. Please let me know if there's anything else I can do to help resolve this.
A bugfix for this has now been added, can you try installing the github version of cmdstanr
:
remotes::install_github("stan-dev/cmdstanr")
And then try your model again?
Thanks @andrjohns for fixing this. I just tested it using the latest cmdstan release + the current cmdstanr master branch + latest brms + @bschneidr's example from above and there's no error anymore. I'm going to go ahead and close this and we can reopen if necessary (@bschneidr if you still run into an error let us know and we'll investigate further).
I tested this out and everything's playing nicely and working as expected. Thank you @jgabry and @andrjohns for resolving this so quickly!
Describe the bug I'm fitting a simple varying intercepts model using 'brms' and 'cmdstanr'. The model fits without an issue and I can work with the model output without issue generally, except when I try to extract unconstrained draws. In this case, I get the following message:
I can't see that there's anything wrong with the model syntax, but maybe I'm missing something. I'm guessing that somewhere in reading/writing JSON or CSV, there's a type mismatch where something should be a matrix/array but is instead a vector. But that's just a guess.
To Reproduce
Created on 2023-09-23 by the reprex package (v2.0.1)
Expected behavior I expected
model_fit$unconstrain_draws()
to return the unconstrained parameter draws.Operating system
CmdStanR version number
0.6.0
Additional context The purpose for this is I want to make some adjustments to the unconstrained parameter draws. I don't think it really matters for debugging, but in case you're interested the adjustments are to deal with complex survey data, along the lines of this discussion on Discourse: https://discourse.mc-stan.org/t/survey-weights-in-brms-stan-simulation-based-on-design-effect-feedback-sought/28625/13