Initialization failed - symmetric and positive definite error

I need to have a sigma that is both symmetric and positive definite that I can use to pass in the multi_student_t_lpdf function. Also, I think it needs to have a valid prior.

I tried many ways but I was not able to get all the requirement satisfied.

Can someone please help me by giving me some simple sample code?

Thank you very very much.
Regards,
Pan Shu

Take a look at the multivariate normal examples in the manual, they’re really thorough and should work with the team distribution as well.

1 Like

You can sample covariance matrices from an inverse wishart distribution.
You need to define hyperpriors for v_0 and W_0.
See https://github.com/stan-dev/stan/wiki/Prior-Choice-Recommendations for some advice. And as sakrejda said, the manual.

   sigma ~ inv_wishart(v_0,W_0)

The manual chapter on regression has examples as @sakrejda points out. But they recommend using a Cholesky factor for a correlation matrix with an LKJ prior then scaling with a scale vector with its own independent priors.