I would appreciate it if anyone can help me with this issue, I have changed my priors, however, it does not work. I try to simulate from a multivariate normal distribution based on a given dataset.
The issue is:
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can't start sampling from this initial value.
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity
.
.
.
Chain 1: Initialization between (-2, 2) failed after 100 attempts.
Chain 1: Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model.
[1] "Error in sampler$call_sampler(args_list[[i]]) : Initialization failed.
Okay, I simulated some data from a random covariance matrix in python and used your model to recover it. (NOTE: I used a zero mean for the random multivariate normal draws).
I initialized the above model with inits=0 and it ran fine. Moreover, with N=10000 I recovered my covariance matrix.
Can you explain more what data you are using (i.e. are you sure that your data has zero mean?)
You could augment your model by putting mus in the parameters block and giving it a tight prior around 0. Then if your data doesn’t have zero mean, the model will still have a chance to fit and you would see what the model wants the mean to be.
Thank you so much for your reply! I also standardized my data, but I got the same error.
There are 50 variables and have small variances, and covariances are so close to zero as well.
Do you think the problem is the covariance chol ~ lkj_corr_cholesky(1)?
which would indicate a higher belief that the correlation is the identity.
Still, it is interesting that you are still getting log(0) did you try initializing with all zeros? (I don’t know how to do this in R, but in cmdstanpy you add inits=0 to the sampler)
Thanks! But unfortunately, got the same result when I tried to sample the whole dataset.
SAMPLING FOR MODEL 'anon_model' NOW (CHAIN 1).
SAMPLING FOR MODEL 'anon_model' NOW (CHAIN 2).
SAMPLING FOR MODEL 'anon_model' NOW (CHAIN 3).
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can't start sampling from this initial value.
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1:
I might split the datasets into 3 batches of data.