Hello I am simulating some data for checking my model in Rstan suing rstansim. I get the following error message but I cannot understand why is it the case.
Can someone help me with it?
Thank you!
"Error in sampler$call_sampler(args_list[[i]]) : "
error occurred during calling the sampler; sampling not done
Stan model ‘rstan_simplesimul’ does not contain samples.
Rejecting initial value:
Log probability evaluates to log(0), i.e. negative infinity.
Stan can’t start sampling from this initial value.
Initialization between (-2, 2) failed after 100 attempts.
Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model.
[1] “Error in sampler$call_sampler(args_list[[i]]) : Initialization failed.”
What package is this simulate_data function coming from? It doesn’t look like it is doing what you think it is doing (calling sampling with the "fixed_param" option and setting the parameters equal to the values in data_listFakeCP).
The "W" = c(1,0,0,0) line is causing you problems. Change it to "W" = c(0.25, 0.25, 0.25, 0.25) or something (simplex probabilities can’t be exactly 1 or 0).
You can use the _rng functions in the generated quantities block.
The generated quantities block doesn’t affect the inference, so I don’t usually think of it as part of the model so much. Generated quantities is for making predictions based on the output of your model.
Edit: That make sense? I’m not sure I said that clearly.
Just to be clear you can’t use _rng functions in transformed parameters, but I’m being too lazy to read the full thread so I’m probably missing something.