Error evaluating the log probability at the initial value

Hi @idontgetoutmuch,

(Love your screen name!) Wow, I had this exact same problem about four days ago. I solved it by looking through the source code – as you know, the problem you’re encountering occurs during initialization. What happens is that if you don’t specify any constraints (or initial values) for a parameter, then initial values for that parameter will be drawn randomly from a uniform distribution with range [-2, 2] by default. That’s even if you’ve specified a lognormal prior for that parameter. If you specify <lower=0>, then the parameter values will be drawn from roughly the range [0.14, 7]. I checked this and I think the code actually uses a lognormal distribution with a location parameter of 0 (i.e. log of 1) and a scale parameter of 1 (I just checked some initial values against some randomly generated values, I didn’t look for the C++ code). So that’s why you need to specify <lower=0> even though you’re correct that your lognormal prior isn’t actually getting used in generating initial values for x[1,].

One thing I don’t understand, though, is that it looks like you only have three variables in x[1,], which means that one out of eight times you should still get positive values for all three. I’m not sure why the initialization failed after 100 attempts. Maybe someone else here could clear that up.

Just a heads-up: here’s a post with the problem I ran into two days after this one that you’re posting about, maybe it can help you avoid the next pothole.

Good luck!