I have a model with a parameter that is a large vector of 17,840 elements. For the model to run, I need to call command stan with the init values.
I created a file for init values of the parameters (both the large one, and a few smaller). However, when calling stan, I get an error about variable dimensions. It seems like no matter what I do to the vector of values in the init file, Stan will only read 1,685 of them. Is there some kind of hard limit in the code?
The error message was:
mismatch in dimension declared and found in context; processing stage=initialization; variable name=student_re; position=0; dims declared=(1685); dims found=(17840)
Note: The init file does contain a vector 17804 elements.
On a side note, it can be a bit cumbersome to have a vector of 0.1 repeated 1600 times. Might be helpful to have a way to indicate a large vector of the same value in the init file. (i.e. alpha[16000] <- 0.1)
I’m attempting to give command Stan suggested starting values for the parameters of the model, using an init file as described on page 54 and 84 of the CmdStan User’s Guide (Version 2.15.0) .
Don’t understand what you mean by doing that in the transformed data block. Don’t the initialisation values need to be in the init file?
Initialization is for parameters. The data is passed in separately. If you have data that’s derivable from other pieces of data, you can define it in the transformed data block, as I showed above for alpha.