You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry I wasn't sure where to post as I can't tell if this is a bug or not. At least I can't replicate the issue with a simpler bit of code so it very well maybe an issue on my end...
Essentially I am trying to make use of the model$generate_quantities() method but am running into issues with data conversion between R -> Stan. That is...
model$generate_quantities(
data = data,
fitted_params = object@results
)
Chain 1 Exception: mismatch in dimension declared and found in context;
processing stage=data initialization; variable name=gq_link_function_inputs;
position=0; dims declared=(21,4); dims found=(84,1)
The error message also points to this line of Stan code in the data block:
int <lower=1> gq_n_quant;
int<lower=0> gq_n_par;
matrix[gq_n_quant, gq_n_par] gq_link_function_inputs; // <--------------
But when inspecting the data object being passed into method call using browser() I can see:
Any idea what might be going on or if theres anything I can run to get more diagnostic information? As mentioned I tried setting up a minimal example but wasn't able to replicate the issue on a smaller scale bit of code sorry.
CmdStanR version number
‘0.7.1’
The text was updated successfully, but these errors were encountered:
Note the use of c() instead of list(). I'm not entirely sure how my matrix got into this state but it seems to trip cmdstanr up. That being said I'm not really sure this is a bug with cmdstanr per se as this doesn't appear to be a valid matrix as nearly all standard matrix operations fail e.g.
> mat <- structure(list(0, 0, 0, 0, 0, 0), .Dim = c(3L, 2L))
> mat + 1
Error in mat + 1 : non-numeric argument to binary operator
I guess this is just very unintuitive base R behaviour...
Would be awesome if cmdstanr could be updated to still make use of objects like these given its still valid in that it has all the needed data; but I understand this is a pretty niche edge case and may open a can of worms on error handling (e.g. case where a cell has 2 list entries) so no worries if you feel there is nothing to be done here.
Describe the issue
Sorry I wasn't sure where to post as I can't tell if this is a bug or not. At least I can't replicate the issue with a simpler bit of code so it very well maybe an issue on my end...
Essentially I am trying to make use of the
model$generate_quantities()
method but am running into issues with data conversion between R -> Stan. That is...The error message also points to this line of Stan code in the data block:
But when inspecting the data object being passed into method call using
browser()
I can see:Any idea what might be going on or if theres anything I can run to get more diagnostic information? As mentioned I tried setting up a minimal example but wasn't able to replicate the issue on a smaller scale bit of code sorry.
CmdStanR version number
‘0.7.1’
The text was updated successfully, but these errors were encountered: