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.
Initialization failed.

This is after all the data have been fed. How do I find out which statement caused the error?

Have you upgraded to 2.16 of cmdstan/Rstan whatever Stan you’re using? In 2.15 some of the error messages were getting hidden accidentally. If not, try that. If you have, best bet is to just run through the model commenting out sections till to find what’s triggering it.

Usually errors like that are from constraints messed up (like trying to use a negative standard deviation) or from indexing errors. Feel free to post the model.

The log probability errors are hard because Stan just checks the value of log prob at each model evaluation and doesn’t keep track of where it underflowed. You can debug these by adding print statements every time you have a ~ or target+= evaluation to track it down.

Other errors often are sometimes reported with a line number, and sometimes not (eg dimension mismatches).

it’s not the case that any one statement is wrong; this message indicates that the sampler cannot initialize the unconstrained parameters of the model. check the parameters and the priors you’re putting on them.