I am quite new to Stan and Bayesian Inference in a way so I apologize in advance if my question seems a bit basic. I am trying to create a bayesian hierarchical model with my data in R. Everything was fine until I started using non integer data, so I created a simple test model (see below) as a learning tool. However, I can’t seem to make it sample. I tried to look in other posts but couldn’t find a solution.

When I run my R script, my initial value gets rejected and I get the following errors:

Rejecting initial value:
Log probability evaluates to log(0), i.e. negative infinity.
Stan can’t start sampling from this initial value.

Initialization between (-1, 1) failed after 100 attempts.

My guess is that X * alpha and / or X * beta can be negative for some values of alpha and beta, in which case they are not admissible for the beta density.

Ah, well then the second column of X needs to be scaled so that the numbers are much smaller. Otherwise, you will have numerical problems. Try dividing by 10000 or so.

Rejecting initial value:
Log probability evaluates to log(0), i.e. negative infinity.
Stan can’t start sampling from this initial value.

Initialization between (-1, 1) 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.”
[2] “In addition: Warning message:”
[3] “In readLines(file, warn = TRUE) :”
[4] " incomplete final line found on ‘C:\Users\Diogo\Documents\Diogo\R data\beta4.stan’"
[1] “error occurred during calling the sampler; sampling not done”

No, it’s the same. Why would it, though? I thought Stan initialized parameters with random values in the range of [-2;2] if nothing else was specified.

The problem is that your third value of y is literally zero, so the density is either going to be zero or infinity depending on whether the shape parameters are greater than 1.

Oh, wow… How did I miss that. Thank you so much! I had been struggling with this for a while, now!
Model ran just fine! I can now use the full extent of my data now.