Change to behavior of length zero parameters

Hello,

I’m having a problem with some Stan models that were working a few months ago but now fail after sampling. The full code can be found here https://github.com/ColtoCaro/compMS

At the end of sampling I get the following error: “Error in checkForRemoteErrors(val) :
4 nodes produced errors; first error: invalid class “stanfit” object: The following variables have undefined values: slope_b[1],…”

The parameters mentioned in the error were all declared as size zero. I built my Stan code so that certain parameters could be declared but not actually used, e.g.
parameters{
real beta_b[n_b] ;
}
where n_b might equal zero depending on user entry.

Has anything changed in the last few months regarding how Stan handles zero length parameters?

Also of interest, the following error now appears, though it doesn’t seem to prevent the code from executing.

“Error in new_CppObject_xp(fields$.module, fields$.pointer, …) :
no valid constructor available for the argument list
trying deprecated constructor; please alert package maintainer”

Any advice would be greatly appreciated.

Thanks,

Jonathon O’Brien

I think that’s saying you’re trying to reference an undefined variable. Can you confirm that your code never actually references it? Do you happen to have a minimal broken case?

You were right!

Something in the data file triggered an unintended consequence. Thanks for the help!

Jonathon

1 Like